Skip to content

Instantly share code, notes, and snippets.

@PirosB3
Created March 19, 2014 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PirosB3/9633905 to your computer and use it in GitHub Desktop.
Save PirosB3/9633905 to your computer and use it in GitHub Desktop.
[11:55pm] freakboy3742: (rules of the game)
[11:56pm] freakboy3742: Yeah - I can't easily check format - I'm a mentor, so I've been locked out of the "create proposal' buttons
[11:56pm] freakboy3742: IIRC, it's an in-browser WYSIWYG widget
[11:56pm] apollo13: well plaintext should be safe :þ
[11:56pm] freakboy3742: there might be some markup options
[11:56pm] freakboy3742: Plaintext is always safe
[11:56pm] freakboy3742: Anyway - Docs will do for now
[11:56pm] FunkyBob: freakboy3742: when you've got a sec
[11:57pm] freakboy3742: Just going to have to wrestle with Google's authentication stuff...
[11:57pm] freakboy3742: FunkyBob: You need me for a big thing or a little thing?
[11:57pm] FunkyBob: do you know anyone with compiler-writing experience?
[11:57pm] apollo13: haha
[11:57pm] apollo13: alex?!
[11:58pm] FunkyBob: heh
[11:58pm] freakboy3742: Yeah - that's my first pick
[11:58pm] • FunkyBob head-desks
[11:58pm] freakboy3742: I take it you mean more experience than "did a compiler course at uni"?
[11:58pm] FunkyBob: well, I've been working on yet-another-template-engine... (called rattle)
[11:59pm] FunkyBob: and I'm trying to get some background on algorithms for syntax parsing
[11:59pm] FunkyBob: tokenising is done
[11:59pm] PirosB3: done!
[11:59pm] PirosB3: https://groups.google.com/forum/#!topic/django-developers/OBGwFzHp8tQ
[11:59pm] FunkyBob: in fact, {{ }} is working well already
[11:59pm] PirosB3: Posted my proposal. Hope it's good
[12:00am] freakboy3742: PirosB3: I'll take a look
[12:00am] PirosB3: Please give me feedback
[12:00am] PirosB3: tell me if there is more to add
[12:01am] FunkyBob: Alex_Gaynor: awake?
[12:02am] k_sze[work] left the chat room. (Read error: Connection reset by peer)
[12:07am] dlogs left the chat room. (Remote host closed the connection)
[12:07am] dlogs joined the chat room.
[12:07am] PirosB3: maybe the part "about me" is too verbose
[12:09am] mkai left the chat room. (Read error: Connection reset by peer)
[12:22am] timograham left the chat room.
[12:23am] Alex_Gaynor: FunkyBob: what's up
[12:24am] FunkyBob: hey
[12:24am] FunkyBob: so, I'm toying about with some crazy shit... building a template engine that uses tokenize and ast
[12:25am] FunkyBob: and was wanting to find a sane approach to writing the token stream parser...
[12:25am] FunkyBob: I'm sure I could eventually make something that works... but why reinvent such a well studied area, right?
[12:25am] Alex_Gaynor: rply!
[12:26am] FunkyBob: ...?
[12:26am] Alex_Gaynor: It's a parsing library for python
[12:26am] FunkyBob: https://github.com/funkybob/rattle/blob/master/rattle/compile.py
[12:27am] FunkyBob: am using tokenize.generate_tokens to tokenise the tag contents....
[12:27am] rozwell joined the chat room.
[12:27am] • FunkyBob reads
[12:28am] FunkyBob: so lexer stage is "covered"
[12:30am] FunkyBob: Alex_Gaynor: looks handy... thanks!
[12:30am] loic84 left the chat room. (Remote host closed the connection)
[12:32am] loic84 joined the chat room.
[12:34am] PirosB3: whoa, thanks for the comments guys
[12:39am] freakboy3742: PirosB3: Ok - that's probably enough for a first pass
[12:40am] freakboy3742: Overall impressions: First 2/3rds is great.
[12:40am] PirosB3: thanks for all the comments freakboy3742
[12:40am] ArcTanSusan left the chat room. (Ping timeout: 264 seconds)
[12:40am] PirosB3: ok, what is the part I need to work most on?
[12:40am] freakboy3742: Good exposition of the problem, the project level concerns and so on.
[12:40am] ArcTanSusan joined the chat room.
[12:40am] PirosB3: am I explaining clearly my intent? and am I demonstrating that I have a plan for it?
[12:40am] freakboy3742: It starts to go a bit off the rails when you get to the bit about abstraction between "meta and components", and persistence.
[12:41am] PirosB3: I knew it
[12:41am] freakboy3742: This is a complex bit, which you've tried to cover in 2 paragraphs, and it isn't clear what you have in mind.
[12:41am] freakboy3742: The timeline is also a concern.
[12:41am] freakboy3742: Mostly due to granularity.
[12:41am] PirosB3: freakboy3742: should I split the timeline into more detail?
[12:41am] freakboy3742: Generally speaking, any estimate > 1 week will be, to use the technical term, wrong.
[12:41am] PirosB3: yep
[12:41am] freakboy3742: humans are really bad at estimating big chunks of time
[12:42am] freakboy3742: You need to break this down into smaller chunks.
[12:42am] FunkyBob: so you can get them wrong by smaller amounts
[12:42am] PirosB3: ok, that's what I will do
[12:42am] freakboy3742: It's OK if you've got broader "4 week" groupings - that's actually helpful
[12:42am] freakboy3742: but the internal work breakdowns need to be finer detail.
[12:43am] PirosB3: is the "about me" stuff too long?
[12:43am] freakboy3742: Nah - that's fine.
[12:43am] PirosB3: any part that should be trimmed down?
[12:43am] freakboy3742: No - the meta/persistence stuff needs to be beefed up a bit; no real fat there that I'm concerned about.
[12:43am] freakboy3742: The about me is useful flavour about you; it's easily ignored if we don't want to read your life story
[12:44am] freakboy3742: Plus - it's not like you've given us a 4 page resume - it's a half page summary of why you are involved in this particular project.
[12:44am] PirosB3: with regards to the part that you say would not work
[12:44am] freakboy3742: Right - you're subclassing Object
[12:44am] freakboy3742: So there's no trigger to call contribute_to_class
[12:44am] PirosB3: aha!
[12:45am] PirosB3: that's correct!
[12:45am] PirosB3: ok, so how would be handling this
[12:45am] PirosB3: contribute_to_class is fundamental
[12:45am] freakboy3742: Ok - so first off
[12:45am] freakboy3742: The starting point is that I shouldn't *need* to use any part of Django.
[12:45am] PirosB3: yes
[12:45am] freakboy3742: I should be able to write my own class, with it's own _meta attribute, and have it work with Django.
[12:46am] freakboy3742: That's an important piece of groundwork to establish.
[12:46am] freakboy3742: *But* there may be useful reusable logic
[12:46am] garrypolley joined the chat room.
[12:46am] PirosB3: that is very true
[12:46am] PirosB3: but a clear example of where some parts are important
[12:46am] PirosB3: is contribute_to_class
[12:47am] PirosB3: as you correctly stated
[12:47am] PirosB3: are developers going to implement their own?
[12:47am] freakboy3742: Maybe - at this point, I don't know
[12:47am] freakboy3742: it all depends on how much work is involved.
[12:47am] PirosB3: they can, as we will not have strict checks
[12:48am] EvilDMP left the chat room. (Quit: EvilDMP)
[12:48am] freakboy3742: So - what you're proposing is enough of a refactor so that ModelBase (or some base class of ModelBase) could be used with any third party wrapper
[12:48am] PirosB3: but it would be good to provide a "base"
[12:48am] freakboy3742: to provide the necessary common functionality
[12:48am] PirosB3: exactly
[12:48am] freakboy3742: That's the story your proposal needs to tell.
[12:49am] freakboy3742: Sample code may not even be necessary here
[12:49am] PirosB3: ok
[12:49am] PirosB3: also
[12:49am] PirosB3: The class Meta just becomes extra baggage.
[12:49am] freakboy3742: In what way?
[12:49am] PirosB3: Meta is popped in __new__
[12:49am] freakboy3742: It exists so that we can configure the behaviour of the ModelBase
[12:50am] PirosB3: ok
[12:50am] PirosB3: but can't we use the same pattern
[12:50am] freakboy3742: Sure we can
[12:51am] PirosB3: I need to work on the part "What is the best way for a user to override the existing Meta implementation?"
[12:51am] freakboy3742: Well, that's the *part* you need to work on, but you don't need to provide an answer.
[12:51am] freakboy3742: (at least, not a final answer)
[12:52am] freakboy3742: You need to indicate that the problem exists, and maybe point in the direction of possible solutions.
[12:52am] PirosB3: sure
[12:53am] PirosB3: I thing I understand the common mistake I am doing
[12:53am] PirosB3: which is assuming that the base class for custom stores is ModelBase
[12:53am] PirosB3: when it's Object
[12:53am] freakboy3742: Well, that's not *necessarily* a problem
[12:54am] freakboy3742: Like I said - it should be possible for me to write a completely 100% custom block of code that is Meta API compliant
[12:54am] freakboy3742: However, if I want to exploit code reuse, then it's fine to say that I have to subclass a particular base, and/or use a particular instantiation pattern (e.g., the class Meta)
[12:55am] PirosB3: ok
[12:55am] PirosB3: do you have a vision of what this would end up in?
[12:55am] freakboy3742: Not sure I follow
[12:55am] PirosB3: in terms of class syntax
[12:55am] PirosB3: as a developer, how would you like it to be?
[12:55am] FunkyBob: Alex_Gaynor: damn you, why did you have to be awake? No I'm gong to spend work hours on this
[12:56am] freakboy3742: Well, Is there any reason it's not just "class MyModel(<something subclassing ModelBase>): … class Meta:"
[12:57am] PirosB3: what about something like this? https://etherpad.mozilla.org/EghEd9sm7Y
[12:57am] freakboy3742: Again - subclassing object won't work
[12:57am] freakboy3742: The bit that make Meta do it's thing isn't in Meta - it's in ModelBase.
[12:59am] ambv left the chat room. (Quit: sys.exit(0) # computer went to sleep)
[12:59am] freakboy3742: Ok - so you seem to be missing how Meta actually works.
[12:59am] freakboy3742: Putting class Meta doesn't actually do *anything*.
[12:59am] freakboy3742: it's a class definition inside a class defintiion.
[01:00am] PirosB3: I know how it works
[01:00am] freakboy3742: The only thing that makes that design pattern do anything is the metaclass on the object *containing* the class meta
[01:00am] freakboy3742: What I'm saying is that GmailObject *can* subclass ModelBase - in which case you pick up a whole lot of functionality for free
[01:01am] freakboy3742: but it doesn't *have* to.
[01:01am] PirosB3: yes! that makes sense
[01:01am] PirosB3: of course
[01:02am] PirosB3: so we are replacing ModelBase with another class, in this case GmailObject
[01:02am] freakboy3742: I'm saying that no matter what the approach, you're going to need to subclass *something* other than Object.
[01:02am] freakboy3742: Either a class that you've written 100% yourself that creates a _meta object that is API compliant
[01:02am] loic84: please let's not ask people to write custom metaclasses
[01:03am] PirosB3: never
[01:03am] freakboy3742: Or a subclass of ModelBase that gives you all the helpers it can.
[01:03am] PirosB3: the latter is better
[01:04am] freakboy3742: Indeed (or, it should be)
[01:04am] freakboy3742: but the former is always a possibliity
[01:04am] PirosB3: we are not making type check
[01:04am] PirosB3: said this, shouldn't we be doing some "necessary" checks?
[01:04am] freakboy3742: Like what?
[01:05am] freakboy3742: If the duck doesn't quack right, it will blow up
[01:05am] freakboy3742: If there's a way to make it blow up gracefully, then sure - some checks may help
[01:05am] PirosB3: correct, but we don't want it to blow up at a wrong time
[01:05am] freakboy3742: Sure - but this is also a deep internal.
[01:05am] freakboy3742: This isn't something a user is going to see in the tutorial, for example.
[01:05am] freakboy3742: it's ok to expect a little bit of expertise.
[01:06am] PirosB3: ok
[01:06am] puntonim_ left the chat room. (Quit: puntonim_)
[01:07am] PirosB3: there is so much brainstorming to be done
[01:07am] dlogs left the chat room. (Remote host closed the connection)
[01:08am] PirosB3: freakboy3742: where do you think I should dig deeper to understand more
[01:08am] freakboy3742: I think it's probably a matter of spending more time with your Duck
[01:09am] freakboy3742: This is why I suggested the sample implementation as a deliverable of the project
[01:09am] ArcTanSusan left the chat room. (Quit: ArcTanSusan)
[01:09am] PirosB3: yep, I think so too
[01:09am] freakboy3742: because if you actually have to use your own API, then you're going to find all the problems
[01:09am] ArcTanSusan joined the chat room.
[01:09am] freakboy3742: (and - side note - the testbed project is something your proposal doesn't really mention)
[01:10am] PirosB3: I put a URL to it, but I should make it a chapter
[01:10am] PirosB3: actually, that I think is really importanyt
[01:10am] PirosB3: by going over it again, I can understand more, and I can explain others I understand too
[01:10am] freakboy3742: I mean in your timeline
[01:10am] freakboy3742: There was no time allocated to building a testbed
[01:10am] freakboy3742: unless you count the 0.5 weeks "evangelism"
[01:11am] freakboy3742: To my mind, this is almost a parallel project
[01:11am] PirosB3: ok
[01:11am] freakboy3742: and the lessons learned eating dog food will shape the formal API.
[01:11am] PirosB3: great
[01:11am] PirosB3: dog food for 3 months
[01:11am] garrypolley left the chat room. (Remote host closed the connection)
[01:11am] freakboy3742: Mmmmmmm… chunky....
[01:11am] freakboy3742:
[01:12am] PirosB3: yes its correct
[01:12am] PirosB3: it's the only way to actually understand what is needed
[01:13am] freakboy3742: Well, not the *only* way, but the most likely to yield useful results.
[01:14am] ArcTanSusan left the chat room. (Ping timeout: 252 seconds)
[01:14am] PirosB3: freakboy3742: with regards to the persistence part
[01:14am] PirosB3: where do you think is the best place to integrate it?
[01:14am] PirosB3: I was thinking maybe manager, or QuerySet
[01:14am] freakboy3742: Honestly - I'm still having difficulty understanding what *it* is
[01:15am] PirosB3: ok, let me explain it better
[01:15am] PirosB3: Duck.objects.all()
[01:15am] PirosB3: actually, real world example
[01:15am] PirosB3: Inbox.objects.all()
[01:15am] PirosB3: where are you going to call the mail api?
[01:16am] freakboy3742: Ok - so the name "Persistence" is perhaps what is throwing me off.
[01:16am] freakboy3742: What you;re talking about is the ORM proper - the querying bit.
[01:16am] PirosB3: yes
[01:17am] PirosB3: exactly
[01:17am] freakboy3742: Right - might want to say that then
[01:17am] PirosB3: I will rephrase this in my proposal
[01:17am] freakboy3742: Ok - in which case, it's not really a development task; it's a documentation task.
[01:17am] PirosB3: persistence is my invented term
[01:18am] PirosB3: where are you going to implement your mail ORM?
[01:18am] freakboy3742: Where doesn't matter.
[01:18am] freakboy3742: It needs to duck type the ORM's api
[01:18am] freakboy3742: i.e., you need to be able to respond to MyModel.objects.all()
[01:18am] freakboy3742: et al
[01:19am] freakboy3742: What you need to do is document the minimum possible spec for objects.
[01:19am] freakboy3742: i.e., in order to use a ModelForm, you must implement get() (plus save() on the model)
[01:19am] freakboy3742: If you want to use a ForeignKey, you need to implement filter() on a single attribute
[01:19am] freakboy3742: and so on.
[01:20am] PirosB3: ok
[01:20am] PirosB3: but can you really expect it to work as a "read" model?
[01:20am] freakboy3742: There's all sorts of stuff that you *can* do with Django's ORM, but there's a minimum set that will let you survive a simple Admin representation or a ModelForm.
[01:20am] freakboy3742: Why not?
[01:20am] PirosB3: exactly
[01:20am] freakboy3742: Inbox.objects.get(pk=1234)
[01:21am] freakboy3742: Does it really matter if it's a SQL data store or a wrapper around IMAP?
[01:21am] PirosB3: it will make it simple to survive simple things
[01:21am] PirosB3: I am not concerned about what type of datastore it is
[01:21am] PirosB3: that's up to the developer
[01:21am] PirosB3: I am just concerned that there are so many possible combinations of queres
[01:22am] PirosB3: that django gives for granted, and many third party apps
[01:22am] freakboy3742: Yes, there is a potentially infinite number of queries
[01:22am] freakboy3742: But the types of queries issued by *admin and modelforms* is significantly reduced.
[01:22am] PirosB3: what about other third party apps
[01:22am] freakboy3742: Admin generally won't do deep multi-table joins, for example, unless you write a custom filter that does that
[01:22am] freakboy3742: That's for other apps to worry about.
[01:23am] freakboy3742: Ultimately the API will need to be "do everything the ORM does".
[01:23am] freakboy3742: if you want to support *every* eventuality.
[01:23am] freakboy3742: But there's a minimum subset that will enable the basics to work
[01:23am] PirosB3: sure
[01:23am] freakboy3742: and it would be helpful to know what those basics are.
[01:23am] PirosB3: so that's up to the developers right?
[01:24am] freakboy3742: It's up to developers to implement as much of the full ORM API as they feel they will need
[01:24am] freakboy3742: Some won't be possible at all
[01:24am] freakboy3742: For example, multi-table joins in a document store are going to be hideously inefficient.
[01:24am] PirosB3: very true
[01:24am] freakboy3742: But retrieving a document by primary key - that's an easy win
[01:24am] freakboy3742: and that's all you really need in order to display the object in admin.
[01:25am] PirosB3: also, did I identify correctly that there is an inconsistency in the way Meta currently caches?
[01:25am] freakboy3742: yes - those implementations have definitely evolved.
[01:25am] freakboy3742: And you've pointed out how they can be cleaned up
[01:25am] freakboy3742: That part of your proposal was really solid.
[01:25am] PirosB3: ok good
[01:26am] PirosB3: so, just to recap
[01:26am] PirosB3: what is the biggest concern at the moment?
[01:26am] PirosB3: where does it need drastic improvement?
[01:27am] PirosB3: I would say, all the part regarding the decoupling of Meta
[01:27am] PirosB3: is a priority
[01:27am] PirosB3: so, by tomorrow I should:
[01:28am] theslow1 left the chat room. (Quit: Leaving)
[01:28am] PirosB3: 1) have a better idea of how to override Meta
[01:29am] PirosB3: 2) redo the entire timeline, with a 1 week plan
[01:29am] PirosB3: 3) rephrase persistence to ORM
[01:29am] freakboy3742: re(1) Worry less about the *how*, and more on describing the actual problem. Maybe *Suggest* a how, but the broader problem description is more important.
[01:30am] mkai joined the chat room.
[01:30am] freakboy3742: More elaboration on (3); and make more mention of the pilot/testbed project as a project goal, and in the timeline.
[01:30am] freakboy3742: but otherwise, sounds about right.
[01:31am] PirosB3: 4) correct typos
[01:31am] PirosB3: also, with regards to the holiday party
[01:31am] PirosB3: part
[01:31am] PirosB3: would it be a concern if I finish a week later?
[01:31am] tonebot left the chat room. (Remote host closed the connection)
[01:31am] freakboy3742: Actually, that's the one deadline that *does* matter.
[01:32am] freakboy3742: There's a hard signoff date imposed by Google.
[01:32am] tonebot joined the chat room.
[01:32am] PirosB3: oh really?
[01:32am] PirosB3: oh lol
[01:32am] freakboy3742: yes - we need to have all our paperwork and final reviews in.
[01:32am] PirosB3: so basically it's not possible, correct?
[01:32am] freakboy3742: (assuming you want to be paid, that is
[01:32am] PirosB3: ahah ok
[01:33am] freakboy3742: There's usually no problem starting early - the GSoC period actually starts with a 1 month "bonding" period
[01:33am] freakboy3742: and given the nature of your project, starting early on the actual heavy lifting wouldn't necessarily be a bad idea.
[01:33am] amizya: By curiosity, what does '# NOQA' means ?
[01:33am] freakboy3742: amizya: It's a directive to the flake8 linking tool
[01:33am] freakboy3742: that says "Yes, I know, what I've done here is deliberate, so stop warning me about it."
[01:34am] PirosB3: lol
[01:34am] freakboy3742: s/linking/linting/g
[01:34am] freakboy3742: It's an abbreviation for "No Quality Assurance required."
[01:34am] PirosB3: ok
[01:34am] PirosB3: with regards to 1)
[01:34am] PirosB3: the problem can be described as saying
[01:35am] amizya: aha, now it makes sense
[01:35am] amizya: thanks freakboy3742
[01:35am] PirosB3: actually
[01:36am] PirosB3: I could start by saying all the things ModelBase does, upon initialize
[01:36am] ArcTanSusan joined the chat room.
[01:38am] mkai left the chat room. (Quit: Leaving.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment