incremental icon indicating copy to clipboard operation
incremental copied to clipboard

incremental dev version doesn't work with setuptools

Open rodrigc opened this issue 7 years ago • 8 comments

I tried the following with buildbot in a Python 3 virtual environment:

pip install "git+https://github.com/buildbot/buildbot#subdirectory=pkg"
pip install "git+https://github.com/buildbot/buildbot#subdirectory=master"
pip install "git+https://github.com/buildbot/buildbot#subdirectory=worker"
pip install --upgrade "git+https://github.com/twisted/twisted"

I then ran this command:

buildbot create master

and got this error:

Traceback (most recent call last):
  File "/Users/crodrigues/my_venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 654, in _build_master
    ws.require(__requires__)
  File "/Users/crodrigues/my_venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/crodrigues/my_venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 859, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (Twisted 17.1.0.dev0 (/Users/crodrigues/my_venv/lib/python3.6/site-packages), Requirement.parse('Twisted>=17.1.0'), {'buildbot'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/crodrigues/my_venv/bin/buildbot", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/Users/crodrigues/my_venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3036, in <module>
    @_call_aside
  File "/Users/crodrigues/my_venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3020, in _call_aside
    f(*args, **kwargs)
  File "/Users/crodrigues/my_venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3049, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/Users/crodrigues/my_venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 656, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/Users/crodrigues/my_venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 669, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/Users/crodrigues/my_venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 854, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Twisted>=17.1.0' distribution was not found and is required by buildbot

Downgrading to Twisted 17.1.0 then worked.

It looks like the versioning used by incremental doesn't work too well with setuptools.

It is nice to be able to test a trunk version of Twisted against third party code.

rodrigc avatar Mar 14 '17 05:03 rodrigc

Should we be using .post rather than .dev given the way our release process works?

glyph avatar Mar 14 '17 06:03 glyph

@glyph yeah, I guess a dev comes before a release in setuptools?

hawkowl avatar Mar 14 '17 07:03 hawkowl

@hawkowl I believe the idea is you update to .dev when you're "working on" the next one.

glyph avatar Mar 14 '17 07:03 glyph

I think it would make more sense to increment the micro version (for twisted, perhaps the minor version) and add .dev.

tomprince avatar Mar 14 '17 15:03 tomprince

In https://github.com/twisted/twisted/blob/trunk/src/twisted/_version.py , the version is 17.1.0.dev0

This is wrong, since 17.1.0 has already been released.

According to https://www.python.org/dev/peps/pep-0440/#summary-of-permitted-suffixes-and-relative-ordering _version.py in Twisted should now contain either:

17.1.0.post0 as suggested by @glyph

or

17.2.0.dev0 as suggested by @tomprince

or

*17.1.1.dev0 as suggested by @tomprince

rodrigc avatar Mar 15 '17 04:03 rodrigc

Hmm, incremental throws an exception if you try to use post in _version.py.

  File "setup.py", line 21, in <module>
    setuptools.setup(**_setup["getSetupArgs"]())
  File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/Users/crodrigues/venv-3.6-2/lib/python3.6/site-packages/setuptools/dist.py", line 318, in __init__
    _Distribution.__init__(self, attrs)
  File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 281, in __init__
    self.finalize_options()
  File "/Users/crodrigues/venv-3.6-2/lib/python3.6/site-packages/setuptools/dist.py", line 376, in finalize_options
    ep.load()(self, ep.name, value)
  File "/Users/crodrigues/twisted2/.eggs/incremental-16.10.1-py3.6.egg/incremental/__init__.py", line 539, in _get_version
    exec(f.read(), version_file)
  File "<string>", line 10, in <module>
TypeError: __init__() got an unexpected keyword argument 'post'

rodrigc avatar Mar 16 '17 06:03 rodrigc

@hawkowl https://github.com/twisted/twisted/pull/745 ?

According to PEP 440, the relative ordering of suffixes is:

.devN, aN, bN, rcN, <no suffix>, .postN

rodrigc avatar Mar 16 '17 06:03 rodrigc

Incremental is missing post... I feel like I should add that.

hawkowl avatar Apr 16 '17 06:04 hawkowl

I think that adding postrelease support fixed this, so I'm going to call it closed. In any event, the exact series of commands that rodrigc ran in the description now works correctly.

glyph avatar Oct 04 '22 21:10 glyph