PMXBOT Log file Viewer

Help | Karma | Search:

#buildout logs for Saturday the 26th of January, 2013

(Back to #buildout overview) (Back to channel listing) (Animate logs)
[00:57:51] <aclark> !logs
[00:57:51] <pmxbot> http://dcpython.gekitsuu.org
[00:58:08] <aclark> pombreda_: looks like they were down :-)
[09:49:48] <pombreda_> aclark: ah :)
[10:03:54] <pombreda_> aclark: thank you
[10:35:08] <pombreda_> http://www.buildout.org/ site is really out of date, what could we do about it?
[16:02:10] <pombreda_> Hi J1m
[16:02:44] <pombreda_> What would be the way to remove a section using a buildout extension?
[16:05:20] <pombreda_> del buildout['section name'] is not implemented and del buildout._raw['section name'] does not do what I would need ... whic would the equivalent of parts -= <section name>
[16:05:38] <pombreda_> J1m: any hint?
[16:07:25] <J1m> no
[16:09:29] <pombreda_> J1m: shall use buildout._update ?
[16:09:35] <pombreda_> *shall I :P
[16:11:18] <J1m> It's a bad idea to internal implementation details.
[16:11:26] <J1m> gaaa
[16:11:35] <J1m> It's a bad idea to depend on internal implementation details.
[16:14:46] <pombreda_> J1m: roger that, I am hacking some test stuffs for doing conditional sections... section that get removed if they have a skip_if python expression that evals to True
[16:16:28] <J1m> If you're just hacking, hack on a fork of buildout itself. Rather that deleting sections, filter them when they're being gathered. This is something I'd be open to as a pull request.
[16:17:21] <J1m> The hardest part is deciding on a filtering condition language that isn't heinous.
[16:17:47] <J1m> btw, my vision for this is uses like: [mysection:win32]
[16:17:57] <J1m> or [mysection:COND]
[16:18:25] <J1m> I discussed this with someone here a few weeks ago.
[16:19:15] <pombreda_> J1m: ok, the filtering condition would at first be a python expression with no locals, no globals and no builtins... then relaxing this later
[16:19:21] <pombreda_> J1m: yes we did
[16:19:31] <pombreda_> J1m: that was with me :P
[16:19:35] <J1m> cool
[16:21:10] <pombreda_> J1m: buildout itself does not reserve the use of any options names except when in the buildout section, right?
[16:22:18] <J1m> There are a 2 option names that buildout uses, "recipe", "_buildout_section_name_".
[16:22:33] <J1m> oh and <
[16:22:50] <J1m> why would you care about option names?
[16:23:33] <J1m> Note that in buildout 2, there are many more restrictions on option and section names.
[16:24:34] <J1m> In particular, ':' is not allowed in either.
[16:26:04] <pombreda_> J1m: I would care if a design would be to add the expression as a section option, rather than in the section title. but if you prefer add this in the title that is a non issue
[16:26:31] <J1m> I prefer section titles.
[16:26:46] <pombreda_> J1m: :) ... hcekcing the config parser atm...
[16:26:50] <pombreda_> *checking
[16:27:56] <J1m> The first Python version of buildout, used internally at ZC had platform tags in section heafers {mysection:win32]. This was very helpful for project built on both linux and windows.
[16:28:13] <J1m> [mysection:win32]
[16:28:18] <J1m> (Not {)
[16:29:00] <pombreda_> :)
[16:29:13] <pombreda_> J1m: which is exactly the use case I have
[16:29:18] <J1m> note that win32 is consistent with Python syntax is win32 is an vailable var
[16:29:26] <J1m> s/is/if
[16:29:41] <pombreda_> J1m: on the dev side, I have varying eggs and parts needed for mac/linux/windows
[16:30:02] <pombreda_> J1m: on the prod side, the requirements are also quite different depending on OS
[16:30:09] <J1m> I expect we'd have some well considers predefined booleans, like win32, python2, python3, etc.
[16:30:29] <J1m> yup, that was our situation at one point too.
[16:31:23] <pombreda_> J1m: for predefined booleans, this provides a decent basis: https://github.com/kennethreitz/its.py/blob/master/its.py
[16:32:14] <pombreda_> conceptually at least
[16:32:33] <J1m> yup, excluding the underware
[16:34:03] <J1m> I would also spell out the python variants (python3 rather than py3).
[16:35:18] <J1m> I might expose sys as well. I don't think there are any security issues here.
[16:36:00] <pombreda_> sys.exit() :P
[16:36:32] <pombreda_> sys.path ?
[16:36:38] <J1m> <shrug> You can accomplish the same thing by typing invalid syntax.
[16:36:54] <pombreda_> :D
[16:37:16] <J1m> who cares? This isn't a long running process and if you accept buildout configs from untrusted sources, you probably have bigger problems.
[16:37:58] <pombreda_> J1m: indeed, .... so one design approach would: do not allow expressions to be defined in titles, that would be ugly... instead provide default booleans and additional expressions could defined in an expression option of [buildout]
[16:38:07] <pombreda_> *would be
[16:38:57] <J1m> yeah. I think expressions are the way to go and default booleans make the common cases simple.
[16:39:23] <J1m> [SECTIONNAME:EXPR]
[16:39:37] <pombreda_> so [section:win32] would look for a either a predef boolean or if not found in an expression provided for instance in [buildout] condition-expression = win32 = 'win32' in sys.platform
[16:40:21] <J1m> No.
[16:40:25] <J1m> either:
[16:40:50] <J1m> [S:win32] or [S:sys.platform='win32']
[16:41:15] <J1m> win32 (or windows or whatever) is just a very simple expression
[16:41:29] <J1m> simple because it's a predefined boolean.
[16:41:44] <J1m> I would not allow use definition of new booleans.
[16:41:44] <pombreda_> J1m: makes all sense
[16:41:54] <J1m> dang
[16:41:59] <J1m> [S:win32] or [S:sys.platform=='win32']
[16:42:29] <pombreda_> J1m: agreed... now this could be handled in many places... the earlier the better... imhonin configparser.py
[16:42:55] <pombreda_> which needs to made happy with this syntax anyway
[16:43:02] <J1m> no, configparser is just syntax.
[16:43:13] <pombreda_> ok
[16:43:30] <pombreda_> section_header = re.compile(r'\[\s*(?P<header>[^\s[\]:{}]+)\s*]\s*([#;].*)?$').match will need relaxing in anycase :P
[16:43:39] <J1m> well, maybe it could be handled there.
[16:43:42] <J1m> not sure
[16:43:54] <J1m> but currently, configparser is just syntax.
[16:44:20] <J1m> yes
[16:44:51] <pombreda_> J1m: the benefit is that in handling it early in the parser, the rest of the code could be left untouched
[16:44:59] <J1m> I think I would keep configparser simple and let it create tuple keys when there's an expression
[16:45:17] <pombreda_> even if that may sounds kludgy in terms of seperation of concerns
[16:45:19] <J1m> there are a number of good choke points.
[16:45:52] <J1m> I think it's buildout's concern to decide on the globals and thus the evaluation of the expressions.
[16:46:20] <J1m> It could easily apply the conditions at the point where it has constructed the raw data.
[16:46:39] <J1m> before it starts handling interpolation.
[16:46:57] <J1m> (or allowing interpolation, since it does that lazily)
[16:47:11] <J1m> then again, it could pass a dict of globals to configparser
[16:47:15] <J1m> <shrug>
[16:47:29] <J1m> maybe that's better
[17:06:13] <pombreda_> <J1m> "there are a number of good choke points." ==> which would be best then?
[17:07:28] <J1m> not sure. Let's go with your original idea and do it in configparser, but pass in a globals(/locals/namespace) dict.
[17:08:06] <J1m> so buildout decides what's available and configparser executes the expers and filters accordingly.
[17:08:15] <J1m> exprs
[17:08:49] <J1m> The globals should default to {} (meaning default to None, which is converted to an empty dict at run time)
[17:09:04] <pombreda_> I see three place where the configparser is called: _read_installed_part_options (does not make sense to have expression here), _open (which makes most sense) and _dir_hash which puzzles me
[17:10:42] <J1m> don't worry about dir_hash.
[17:10:45] <pombreda_> in the dir_hash parser call it does not makes sense to handle expressions
[17:10:47] <pombreda_> yep
[17:10:56] <pombreda_> that leaves one single call :)
[17:11:04] <J1m> yup
[17:16:01] <pombreda_> J1m: not sure what you mean about the default globals above, you mean in the function signature for configparser.parse ? chainging it from parse(fp, fpname) to parse(fp, fpname, globals=None)?
[17:16:16] <J1m> yup
[17:16:24] <pombreda_> ack
[17:19:50] <J1m> so you'll evaluate an expr with eval(expr, globals)
[17:19:56] <pombreda_> J1m: the syntax for the section title would become essentially the same as for an option except the separator would be header:expression instead of name=value
[17:20:15] <pombreda_> J1m: with an eventual removal of builtins
[17:20:22] <pombreda_> not sure that matters though
[17:20:29] <J1m> I wouldn't remove builtins.
[17:29:01] <pombreda_> J1m: a regex for parsing the title would become ... \[\s*(?P<header>[^\s[\]:{}]+)\s*:?(?P<expression>.*)\s*]\s*([#;].*)?$ this would require a bit split in something easier to read :P
[17:30:25] <pombreda_> [ spaces TITLE spaces : EXPRESSION spaces ] spaces COMMENTS
[17:30:58] <pombreda_> let me add some tests for this
[17:31:20] <pombreda_> J1m: I reckon your preffered way is to use doctests, right?
[17:32:07] <pombreda_> J1m: which BTW are great for testing but make for a rather odd documentation on the main pypi page
[17:33:04] <pombreda_> J1m: in general I am sure you reckon the doc is tad weak? we could get some Gsoc student to work on this?
[17:35:47] <pombreda_> J1m: zope seems to have fewer interest in this after 2008 though
[17:36:17] <J1m> wrt syntax: [ spaces TITLE spaces (: spaces EXPRESSION spaces)? ] spaces COMMENTS?
[17:36:18] <pombreda_> J1m: UI used to be manage the program for the Eclipse foundation so i am somewhat familiar with it
[17:36:37] <J1m> I think you're regex is wrong, but write tests :)
[17:37:01] <J1m> wrt docs, yes, the experiment of reusing tests as docs failed.
[17:37:04] <pombreda_> actually the expression is .* so it globs spaces, but yes, regex are devilish without tests
[17:37:27] <J1m> buildut needs docs. I'm skeptical that a student could write them (or would want to).
[17:37:44] <J1m> people keep threatening to help with docs, but it never pans out.
[17:38:00] <J1m> I'll probably need to take that on at some point.
[17:38:53] <J1m> I have no idea what you mean by "zope seems to have fewer interest in this after 2008 though"
[17:39:14] <J1m> and yes, I still like doctests for tests.
[17:39:16] <pombreda_> J1m: doc is a punishement .... it cannoy be used as a credible threat :D
[17:39:52] <J1m> I also like using documentation as tests, as long as doc is really doc.
[17:39:53] <pombreda_> J1m: zope as a foundation seems to have not participated in the Google Summer of code after 2008
[17:40:36] <J1m> See for example http://bobo.digicool.com/ and http://packages.python.org/zc.ngi/
[17:40:58] <J1m> ah, gsoc. Yeah, I don't track that.
[17:42:34] <pombreda_> J1m: about doc, the thing with buildout is that doctests are _not_ showing the way one actually _uses_ buildout... instead rather how it works when called from python, which is the least likely to happen in most use case
[17:42:47] <J1m> I know.
[17:42:54] <J1m> documentation is needed.
[17:43:09] <J1m> documentation needs to be designed for the reader, just like a UI.
[17:43:15] <pombreda_> agreed
[17:43:45] <J1m> documentation should also be executable and can server as a subset of the tests, but it has to be designed as documentation.
[17:43:54] <J1m> tests are only a useful by product.
[17:44:27] <J1m> I still like using doctest for tests, even if they don't make good documentation.
[17:44:28] <pombreda_> I will not threaten of writing docs though atm ... but I guess if you would start with a simple 10 liners showing where you want to go pushing docs would be easier
[17:44:56] <pombreda_> J1m: and about doctest there is a badzillions of recipes that use the same approach you did and only have doctests as docs :P
[17:45:05] <J1m> yes
[17:45:06] <pombreda_> I like doctests too
[17:45:08] <J1m> I know
[17:45:55] <J1m> There are lots of projects that have neither docs or tests. doctests are better than nothing. :)
[17:46:14] <J1m> bit real documentation is better.
[17:46:26] <J1m> but
[17:46:51] <J1m> especially for something as powerful and thus complex as buildout.
[17:47:52] <J1m> There's a rather simple transformation that could be applied to the existing doctest that would make them much more readable and useful, even though the organization would still be wrong.
[17:48:12] <pombreda_> J1m: indeed ... the other projects may not have teh reach of it too... that said the only think that could come to mind for higher level docs as tests was fitnesse and may be roboframework nowadays though I have not used the later
[17:48:27] <J1m> The transformation being to convert them to use manuel.
[17:49:18] <J1m> then config files would be shown directly (without python "write" calls and system commands could be shown more naturally.
[17:49:44] <J1m> This could almost be done mechanically.
[17:50:04] <J1m> I need to update some of the tests to show the way and see if volunteers could do the others.
[17:51:01] <J1m> The configparser tests use manuel and they look much better than they would otherwise.
[17:54:33] <pombreda_> J1m: manuel is awesome! I though you had made a typo and meant manual :D
[17:54:43] <pombreda_> J1m: It the fit feel to it
[17:54:56] <pombreda_> *it has the fit/fitnesse fit to it
[17:56:04] <J1m> Yup.
[18:01:15] <pombreda_> neatly rst-based but it does not use docutils?
[18:04:05] <pombreda_> excellent .. bbiam... tme for chow