(Note: historically zope.schema always used three version components:
4.1.0, not 4.1.)
Somebody with interest and PyPI access has to check it out and run
fullrelease (from zest.releaser). Ideally, after running the test suite
to make sure it passes. For all supported Python versions, if possible.
Which are, ideally, enumerated in setup.py as Trove classifiers.
For packages that have C extension modules there are probably extra
steps needed to produce Windows binary eggs. I don't know those
steps (winbot is involved somehow), so I avoid making releases of
packages that have C extension modules. How do I check if a package
has C extension modules? I go to PyPI and look if there are Windows
binary eggs available for download for the current version.
zope.schema doesn't, so I'm just including this for general
reference purposes.
> And is there anything I can do to help speed it up?
Yes: you can bring it up on the mailing list, like you've done here. ;)
Also, thank you for the convenient diff. I'll review it.
Also, would you like to have PyPI access to zope.schema, so that you can
do the release yourself? If so, tell us your PyPI username.
> Even just an alpha/beta release would be very helpful.
I think uploading alpha/beta releases to PyPI is frowned upon, because
tools tend to download them blindly, as if they were final releases.
> svn --non-interactive diff http://svn.zope.org/repos/main/zope.schema/tags/4.0.1 http://svn.zope.org/repos/main/zope.schema/trunk
> Index: CHANGES.txt
> ===================================================================
> --- CHANGES.txt (.../tags/4.0.1) (revision 124658)
> +++ CHANGES.txt (.../trunk) (revision 124658)
> @@ -2,6 +2,18 @@
> CHANGES
> =======
>
> +4.1 (unreleased)
This should be 4.1.0.
> +------------------
> +
> +- Add TreeVocabulary for nested tree-like vocabularies.
> +
> +- Fix broken Object field validation where the schema contains a Choice with
> + ICountextSourceBinder source. In this case the vocabulary was not iterable
> + because the field was not bound and the source binder dien't return the
Spelling: dien't.
> + real vocabulary. Added simple test for IContextSourceBinder validation. But a
> + test with an Object field with a schema using a Choice with
> + IContextSourceBinder is still missing.
> +
> 4.0.1 (2011-11-14)
> ------------------
>
> Index: setup.py
> ===================================================================
> --- setup.py (.../tags/4.0.1) (revision 124658)
> +++ setup.py (.../trunk) (revision 124658)
> @@ -19,6 +19,7 @@
> """Setup for zope.schema package
> """
> import os
> +import sys
> from setuptools import setup, find_packages
>
> def read(*rnames):
> @@ -60,8 +61,18 @@
> suite.addTest(mod.test_suite())
> return suite
>
> +REQUIRES = [
> + 'setuptools',
> + 'zope.interface >= 3.6.0',
> + 'zope.event',
> + 'six',
> + ]
> +
> +if sys.version_info < (2 , 7):
No space before the comma.
> + REQUIRES += ['ordereddict'],
Trailing comma warning! I do not think this does what you want it to
do:
>>> REQUIRES = [
... 'setuptools',
... 'zope.interface >= 3.6.0',
... 'zope.event',
... 'six',
... ]
>>> REQUIRES += ['ordereddict'],
>>> REQUIRES
['setuptools', 'zope.interface >= 3.6.0', 'zope.event', 'six', ['ordereddict']]
I don't know if setuptools can handle this correctly, but it feels wrong
anyway. Please fix.
> +
> setup(name='zope.schema',
> - version = '4.0.1',
> + version = '4.1dev',
This should be '4.1.0dev'.
> url='http://pypi.python.org/pypi/zope.schema',
> license='ZPL 2.1',
> description='zope.interface extension for defining data schemas',
> @@ -81,11 +92,8 @@
> namespace_packages=['zope',],
> extras_require={'test': ['zope.testing'],
> 'docs': ['z3c.recipe.sphinxdoc']},
> - install_requires=['setuptools',
> - 'zope.interface >= 3.6.0',
> - 'zope.event',
> - 'six',
> - ],
> + install_requires=REQUIRES,
> +
The blank line (and trailing whitespace) do not seem to be useful here.
> classifiers=[
> "Development Status :: 5 - Production/Stable",
> "Intended Audience :: Developers",
> Index: src/zope/schema/fields.txt
> ===================================================================
> --- src/zope/schema/fields.txt (.../tags/4.0.1) (revision 124658)
> +++ src/zope/schema/fields.txt (.../trunk) (revision 124658)
> @@ -116,6 +116,9 @@
> The vocabulary interface is simple enough that writing a custom vocabulary is
> not too difficult itself.
>
> +See for example zope.schema.vocabulary.TreeVocabulary for another
> +IBaseVocabulary supporting vocabulary that provides a nested, tree-like structure.
This line is 82 characters long. Please wrap. (76 chars is a good choice for
wrapping.)
> +
> Choices and Collections
> -----------------------
>
> @@ -156,3 +159,4 @@
>
> This level of indirection may be unnecessary for some applications, and can be
> disabled with simple ZCML changes within `zope.app`.
> +
> Index: src/zope/schema/vocabulary.py
> ===================================================================
> --- src/zope/schema/vocabulary.py (.../tags/4.0.1) (revision 124658)
> +++ src/zope/schema/vocabulary.py (.../trunk) (revision 124658)
> @@ -13,14 +13,19 @@
> ##############################################################################
> """Vocabulary support for schema.
> """
> +try:
> + from collections import OrderedDict
> +except:
Should be 'except ImportError:'.
> + from ordereddict import OrderedDict
> +
> from zope.interface.declarations import directlyProvides, implementer
> from zope.schema.interfaces import ValidationError
...
> +@implementer(ITreeVocabulary)
> +class TreeVocabulary(object):
> + """ Vocabulary that relies on a tree (i.e nested) structure.
> + """
> + # The default implementation uses a dict to create the tree structure. This
> + # can however be overridden in a subclass by any other IEnumerableMapping
> + # compliant object type. Python 2.7's OrderableDict for example.
Python 2.7 doesn't have an OrderableDict, does it? Typo?
> + terms_factory = OrderedDict
...
> Index: src/zope/schema/tests/test_vocabulary.py
> ===================================================================
> --- src/zope/schema/tests/test_vocabulary.py (.../tags/4.0.1) (revision 124658)
> +++ src/zope/schema/tests/test_vocabulary.py (.../trunk) (revision 124658)
> @@ -15,9 +15,15 @@
> """
> import unittest
>
> +try:
> + from collections import OrderedDict
> +except:
Should be 'except ImportError:'.
> + from ordereddict import OrderedDict
> +
> from zope.interface.verify import verifyObject
> from zope.interface.exceptions import DoesNotImplement
> from zope.interface import Interface, implementer
> +from zope.interface.common.mapping import IEnumerableMapping
>
> from zope.schema import interfaces
> from zope.schema import vocabulary
...
Marius Gedminas
--
http://pov.lt/ -- Zope 3/BlueBream consulting and development
The point of winbot is to take away all the pain and it does so.
There's no extra steps at all for packages containing C extensions.
Just make sure you create a release with a proper tag - winbot does
the rest.
Hanno
_______________________________________________
Zope-Dev maillist - Zope...@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope )
Oh, that is awesome!
Ok.
> Somebody with interest and PyPI access has to check it out and run
> fullrelease (from zest.releaser). Ideally, after running the test suite
> to make sure it passes. For all supported Python versions, if possible.
> Which are, ideally, enumerated in setup.py as Trove classifiers.
>
> For packages that have C extension modules there are probably extra
> steps needed to produce Windows binary eggs. I don't know those
> steps (winbot is involved somehow), so I avoid making releases of
> packages that have C extension modules. How do I check if a package
> has C extension modules? I go to PyPI and look if there are Windows
> binary eggs available for download for the current version.
> zope.schema doesn't, so I'm just including this for general
> reference purposes.
>
> > And is there anything I can do to help speed it up?
>
> Yes: you can bring it up on the mailing list, like you've done here. ;)
>
> Also, thank you for the convenient diff. I'll review it.
>
> Also, would you like to have PyPI access to zope.schema, so that you can
> do the release yourself? If so, tell us your PyPI username.
Sure, my pypi username is: jcbrand
>
> > Even just an alpha/beta release would be very helpful.
>
> I think uploading alpha/beta releases to PyPI is frowned upon, because
> tools tend to download them blindly, as if they were final releases.
Ok.
>
> > svn --non-interactive diff http://svn.zope.org/repos/main/zope.schema/tags/4.0.1 http://svn.zope.org/repos/main/zope.schema/trunk
> > Index: CHANGES.txt
> > ===================================================================
> > --- CHANGES.txt (.../tags/4.0.1) (revision 124658)
> > +++ CHANGES.txt (.../trunk) (revision 124658)
> > @@ -2,6 +2,18 @@
> > CHANGES
> > =======
> >
> > +4.1 (unreleased)
>
> This should be 4.1.0.
>
> > +------------------
> > +
> > +- Add TreeVocabulary for nested tree-like vocabularies.
> > +
> > +- Fix broken Object field validation where the schema contains a Choice with
> > + ICountextSourceBinder source. In this case the vocabulary was not iterable
> > + because the field was not bound and the source binder dien't return the
>
> Spelling: dien't.
Fixed.
Fixed.
> > + REQUIRES += ['ordereddict'],
>
> Trailing comma warning! I do not think this does what you want it to
> do:
>
> >>> REQUIRES = [
> ... 'setuptools',
> ... 'zope.interface >= 3.6.0',
> ... 'zope.event',
> ... 'six',
> ... ]
> >>> REQUIRES += ['ordereddict'],
> >>> REQUIRES
> ['setuptools', 'zope.interface >= 3.6.0', 'zope.event', 'six', ['ordereddict']]
>
> I don't know if setuptools can handle this correctly, but it feels wrong
> anyway. Please fix.
Strange, it seems to work with the comma, because I used/tested it with
python 2.6.
In any case, I removed it now.
> > +
> > setup(name='zope.schema',
> > - version = '4.0.1',
> > + version = '4.1dev',
>
> This should be '4.1.0dev'.
Done.
> > url='http://pypi.python.org/pypi/zope.schema',
> > license='ZPL 2.1',
> > description='zope.interface extension for defining data schemas',
> > @@ -81,11 +92,8 @@
> > namespace_packages=['zope',],
> > extras_require={'test': ['zope.testing'],
> > 'docs': ['z3c.recipe.sphinxdoc']},
> > - install_requires=['setuptools',
> > - 'zope.interface >= 3.6.0',
> > - 'zope.event',
> > - 'six',
> > - ],
> > + install_requires=REQUIRES,
> > +
>
> The blank line (and trailing whitespace) do not seem to be useful here.
Removed
> > classifiers=[
> > "Development Status :: 5 - Production/Stable",
> > "Intended Audience :: Developers",
> > Index: src/zope/schema/fields.txt
> > ===================================================================
> > --- src/zope/schema/fields.txt (.../tags/4.0.1) (revision 124658)
> > +++ src/zope/schema/fields.txt (.../trunk) (revision 124658)
> > @@ -116,6 +116,9 @@
> > The vocabulary interface is simple enough that writing a custom vocabulary is
> > not too difficult itself.
> >
> > +See for example zope.schema.vocabulary.TreeVocabulary for another
> > +IBaseVocabulary supporting vocabulary that provides a nested, tree-like structure.
>
> This line is 82 characters long. Please wrap. (76 chars is a good choice for
> wrapping.)
Fixed.
> > +
> > Choices and Collections
> > -----------------------
> >
> > @@ -156,3 +159,4 @@
> >
> > This level of indirection may be unnecessary for some applications, and can be
> > disabled with simple ZCML changes within `zope.app`.
> > +
> > Index: src/zope/schema/vocabulary.py
> > ===================================================================
> > --- src/zope/schema/vocabulary.py (.../tags/4.0.1) (revision 124658)
> > +++ src/zope/schema/vocabulary.py (.../trunk) (revision 124658)
> > @@ -13,14 +13,19 @@
> > ##############################################################################
> > """Vocabulary support for schema.
> > """
> > +try:
> > + from collections import OrderedDict
> > +except:
>
> Should be 'except ImportError:'.
Fixed.
> > + from ordereddict import OrderedDict
> > +
> > from zope.interface.declarations import directlyProvides, implementer
> > from zope.schema.interfaces import ValidationError
> ...
> > +@implementer(ITreeVocabulary)
> > +class TreeVocabulary(object):
> > + """ Vocabulary that relies on a tree (i.e nested) structure.
> > + """
> > + # The default implementation uses a dict to create the tree structure. This
> > + # can however be overridden in a subclass by any other IEnumerableMapping
> > + # compliant object type. Python 2.7's OrderableDict for example.
>
> Python 2.7 doesn't have an OrderableDict, does it? Typo?
Yes, typo. Fixed.
> > + terms_factory = OrderedDict
> ...
>
> > Index: src/zope/schema/tests/test_vocabulary.py
> > ===================================================================
> > --- src/zope/schema/tests/test_vocabulary.py (.../tags/4.0.1) (revision 124658)
> > +++ src/zope/schema/tests/test_vocabulary.py (.../trunk) (revision 124658)
> > @@ -15,9 +15,15 @@
> > """
> > import unittest
> >
> > +try:
> > + from collections import OrderedDict
> > +except:
>
> Should be 'except ImportError:'.
Fixed.
> > + from ordereddict import OrderedDict
> > +
> > from zope.interface.verify import verifyObject
> > from zope.interface.exceptions import DoesNotImplement
> > from zope.interface import Interface, implementer
> > +from zope.interface.common.mapping import IEnumerableMapping
> >
> > from zope.schema import interfaces
> > from zope.schema import vocabulary
Thanks for the review.
I've committed my changes and ran the tests with Python 2.6 and 2.7.
I don't have Python 3.x handy but will compile the latest and test with
that as well.
JC
<big snip>
> Thanks for the review.
>
> I've committed my changes and ran the tests with Python 2.6 and 2.7.
> I don't have Python 3.x handy but will compile the latest and test with
> that as well.
Ok, I tested zope.schema in python 3.2.2 and there were some errors in
test_vocabulary.py that I fixed.
They were all related to the KeysView and ValuesView objects (being
returned by keys() and values() on an OrderedDict) not being indexable.
There is however still one more error when testing with Python 3.2.2,
but this is related to the IContextSourceBinder validation changes made
by rogerineichen.
First the error:
> FAIL: test_validate_source
> (zope.schema.tests.test_choice.ContextSourceBinder_ChoiceFieldTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File
> "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/tests/test_choice.py", line 133, in test_validate_source
> choice = Choice(source=s)
> File
> "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/_field.py",
> line 281, in __init__
> IContextSourceBinder.providedBy(vocabulary))
> AssertionError
>
The vocabulary is of type SampleContextSourceBinder from test_choice.py,
which does implement IContextSourceBinder.
> class SampleContextSourceBinder(object):
> implements(IContextSourceBinder)
> def __call__(self, context):
> return SampleVocabulary()
>
Looking at it in pdb:
> (Pdb) p vocabulary
> <zope.schema.tests.test_choice.SampleContextSourceBinder object at
> 0x3236310>
> (Pdb) pp vocabulary.__provides__.__iro__
> (<InterfaceClass zope.interface.Interface>,)
>
Just to double-check, I looked at this vocabulary in Python 2.7:
> (Pdb) vocabulary.__provides__.__iro__
> (<InterfaceClass zope.schema.interfaces.IContextSourceBinder>,
> <InterfaceClass zope.interface.Interface>)
>
There it *does* provide IContextSourceBinder.
Any ideas why this vocabulary doesn't provide it in Python 3?
Regards
You now have PyPI access to zope.schema.
One detail I may have forgotten to mention about the release process:
sometimes setup.py sdist produces an incomplete archive. This happens
every time Subversion changes its working tree format, until somebody
patches setuptools to understand it. I think subversion 1.7 changed the
format again; I don't know if setuptools can handle it yet -- I'm still
on svn 1.6 myself.
So it may be a good idea to run python setup.py sdist and compare the
file list in dists/*.tar.gz with the file list in the current PyPI
archive, before you actually do the release with fullrelease. Actually
zest.releaser's fullrelease has lots of "continue? [y/n]" prompts that
let you do the inspection before the final upload. I just feel better
when I do it by hand, on those rare occasions when I'm not sure about
the state of my setuptools after a distro upgrade. YMMV. And the
chances of breakage are low, and people generally notice it pretty
quickly, and uploading a fixed 4.1.1 is easy (edit MANIFEST.in to make
sure everything is included), so I don't even know why I'm mentioning
all this. For completeness, I guess...
Marius Gedminas
--
If you sat a monkey down in front of a keyboard, the first thing typed would be
a unix command.
-- Bill Lye
Thanks, it's helpful.
setuptools also doesn't play nicely with git. So I've had to edit
MANIFESET.in before. I'll double check manually.
There is however still the Python 3 bug in zope.schema. (See my previous
post).
I'm in awe of your dedication. I myself don't even know how to run the
zope.schema testsuite under Python 3:
$ python3.2 bootstrap.py
File "bootstrap.py", line 63
exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
^
SyntaxError: invalid syntax
Well, ok, I may be exaggerating a bit.
$ virtualenv -p python3.2 py32
$ py32/bin/python setup.py develop
... this takes a long time... I miss my buildout egg cache ...
$ py32/bin/pip install zope.testrunner
$ py32/bin/pip install zope.testing # have to install test extras by hand?
$ py32/bin/zope-testrunner --test-path=src
...
Ran 255 tests with 1 failures and 0 errors in 0.206 seconds.
This smells like a bug in zope.interface, and not in zope.schema:
$ py32/bin/python
Python 3.2.2 (default, Sep 5 2011, 22:09:30)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from zope.interface import Interface, implements
>>> class IFoo(Interface): pass
...
>>> class Foo(object): implements(IFoo)
...
>>> IFoo.implementedBy(Foo)
False
>>> IFoo.providedBy(Foo())
False
In other words I don't think it should block the release of zope.schema.
A variant of this one, perhaps:
https://bugs.launchpad.net/zope.interface/+bug/911851
--
Brian Sutherland
lol. Yeah, it took me a while to figure it out as well.
I instead ran: python setup.py test
That also works.
Yeah, as Brian mentioned:
https://bugs.launchpad.net/zope.interface/+bug/911851
Ok, I'll release tomorrow morning when I'm fresh.
D'oh! :-)
> Yeah, as Brian mentioned:
> https://bugs.launchpad.net/zope.interface/+bug/911851
Given that zope.schema already requires Python 2.6 or newer, I've committed
this fix:
--- src/zope/schema/tests/test_choice.py (revision 124693)
+++ src/zope/schema/tests/test_choice.py (working copy)
@@ -16,7 +16,7 @@
import unittest
from six import u
-from zope.interface import implements
+from zope.interface import implementer
from zope.schema import vocabulary
from zope.schema import Choice
from zope.schema.interfaces import ConstraintNotSatisfied
@@ -114,8 +114,8 @@ class Vocabulary_ChoiceFieldTests(unitte
self.assertRaises(ValueError, choice.validate, "value")
+@implementer(IContextSourceBinder)
class SampleContextSourceBinder(object):
- implements(IContextSourceBinder)
def __call__(self, context):
return SampleVocabulary()
Thanks! That fixed the last bug.
I've now released zope.schema 4.1.0.
http://pypi.python.org/pypi/zope.schema/4.1.0
-JC
Oh! Damn. This is after the release.
The error is this:
> ValueError: path 'src/zope/schema/tests/' cannot end with '/'
>
Which seems related to the MANIFEST.in file I added.
I've removed now the trailing slash. Hopefully that'll fix it.
Hi Adam
I guess you saw that Winbot is now happy again:
http://winbot.zope.org/builders/zope.schema_py_265_32/builds/456
This means we need a 4.1.1 release, right?
On Fri, 23 Mar 2012 12:53:51 +0100 you wrote:
> Hi Adam
>
> I guess you saw that Winbot is now happy again:
> http://winbot.zope.org/builders/zope.schema_py_265_32/builds/456
>
> This means we need a 4.1.1 release, right?
yup
--
Best regards,
Adam GROSZER
--
Quote of the day:
God has two dwellings: one in heaven, and the other in a meek and
thankful heart.
- Izaak Walton
Done. http://pypi.python.org/pypi/zope.schema/4.1.1