Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove run-time dependency on pbr #311

Closed
ionelmc opened this issue Aug 8, 2015 · 10 comments
Closed

Remove run-time dependency on pbr #311

ionelmc opened this issue Aug 8, 2015 · 10 comments

Comments

@ionelmc
Copy link

ionelmc commented Aug 8, 2015

Currently pbr is imported here https://github.com/testing-cabal/mock/blob/master/mock/mock.py#L69 but it's not specified as an install-time dependency.

This package should not need pbr - I try to avoid to install pbr as it monkeypatches setuptools and changes sdist output, even for packages that don't use pbr.

@rbtcollins
Copy link
Member

rbtcollins commented Aug 8, 2015 via email

@ionelmc
Copy link
Author

ionelmc commented Aug 8, 2015

Pbr makes no changes to non pbr using packages

Unfortunately not true :-)

pbr defines the distutils.setup_keywords which is used when making the sdist. That in turn imports pbr and it's monkey patches. The sdist has a pbr.json in it and maybe other things, hard to say - pbr is very complex. That's why I want to avoid having pbr around completely.

@ionelmc
Copy link
Author

ionelmc commented Aug 8, 2015

The entrypoint in question: http://git.openstack.org/cgit/openstack-dev/pbr/tree/setup.cfg#n38

Just grep for writing pbr to foobar.egg-info/pbr.json when building sdist for a non-pbr package ...

@rbtcollins
Copy link
Member

I grabbed a random non-pbr package from pypi:

wget https://pypi.python.org/packages/source/p/python_lconf_lexer/python_lconf_lexer-1.1.1.tar.bz2#md5=73c46279b1edf26024a0d0fad1a9a9e0

installed pbr:

$ pip freeze
pbr==1.4.0

Ran setup,py sdist:

$ python setup.py sdist
running sdist
got version from file /tmp/python_lconf_lexer-1.1.1/python_lconf_lexer/_version.py {'version': '1.1.1', 'full': '771e20ea8085fda0ca630d88100196f0d07a5068'}
running check
warning: CmdSdist: standard file not found: should have one of README, README.txt

running egg_info
writing requirements to python_lconf_lexer.egg-info/requires.txt
writing dependency_links to python_lconf_lexer.egg-info/dependency_links.txt
writing entry points to python_lconf_lexer.egg-info/entry_points.txt
writing top-level names to python_lconf_lexer.egg-info/top_level.txt
writing python_lconf_lexer.egg-info/PKG-INFO
reading manifest file 'python_lconf_lexer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '__pycache__' found under directory '*'
writing manifest file 'python_lconf_lexer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '__pycache__' found under directory '*'
writing manifest file 'MANIFEST'
creating python_lconf_lexer-1.1.1
creating python_lconf_lexer-1.1.1/python_lconf_lexer
making hard links in python_lconf_lexer-1.1.1...
hard linking CHANGELOG.rst -> python_lconf_lexer-1.1.1
hard linking LICENSE.rst -> python_lconf_lexer-1.1.1
hard linking MANIFEST.in -> python_lconf_lexer-1.1.1
hard linking README.rst -> python_lconf_lexer-1.1.1
hard linking requirements.txt -> python_lconf_lexer-1.1.1
hard linking setup.cfg -> python_lconf_lexer-1.1.1
hard linking setup.py -> python_lconf_lexer-1.1.1
hard linking versioneer.py -> python_lconf_lexer-1.1.1
hard linking python_lconf_lexer/__init__.py -> python_lconf_lexer-1.1.1/python_lconf_lexer
hard linking python_lconf_lexer/_version.py -> python_lconf_lexer-1.1.1/python_lconf_lexer
hard linking python_lconf_lexer/lexer.py -> python_lconf_lexer-1.1.1/python_lconf_lexer
UPDATING python_lconf_lexer-1.1.1/python_lconf_lexer/_version.py
Creating tar archive
removing 'python_lconf_lexer-1.1.1' (and everything under it)

Unpacked the sdist:

tar xjf python_lconf_lexer-1.1.1.tar.bz2 
(test23)robertc@lifeless-z140:/tmp/python_lconf_lexer-1.1.1/dist$ ls
python_lconf_lexer-1.1.1  python_lconf_lexer-1.1.1.tar.bz2
(test23)robertc@lifeless-z140:/tmp/python_lconf_lexer-1.1.1/dist$ ls python_lconf_lexer-1.1.1
CHANGELOG.rst  LICENSE.rst  MANIFEST.in  PKG-INFO  python_lconf_lexer  README.rst  requirements.txt  setup.cfg  setup.py  versioneer.py

I see no sign of interactions with pbr. The mechanism to activate setuptools plugins (which pbr is) is that you must pass in a keyword argument to trigger them. If you can put together a way to reproduce your example of pbr altering setup of non-pbr-using packages, please file a bug on that at https://bugs.launchpad.net/pbr - we'll take that very seriously. However there doesn't seem to be a bug here, with respect to Mock. If there is one, please reopen this (or comment on it and I'll reopen if github doesn't let you). Thanks.

@ionelmc
Copy link
Author

ionelmc commented Aug 9, 2015

It's not clear to me why mock depends on pbr. In principle it makes no sense for mock to depend on a built-time library. This is why I made this bug report. What's going on here?

@ionelmc
Copy link
Author

ionelmc commented Aug 9, 2015

Here's some output with a package you're more familiar with (the master of pip):

$ virtualenv .ve               
Ignoring indexes: https://pypi.python.org/simple
Collecting pip
Collecting setuptools
Installing collected packages: pip, setuptools
Successfully installed pip-7.1.0 setuptools-18.0.1
$ .ve/bin/pip install pbr                         
/home/ionel/osp/pip/.ve/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Collecting pbr
/home/ionel/osp/pip/.ve/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/home/ionel/osp/pip/.ve/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached pbr-1.4.0-py2.py3-none-any.whl
Installing collected packages: pbr
Successfully installed pbr-1.4.0
$ rm -rf dist build *.egg-info(N) && .ve/bin/python setup.py clean --all sdist                                                                                        
running clean
'build/lib.linux-x86_64-2.7' does not exist -- can't clean it
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-2.7' does not exist -- can't clean it
running sdist
running egg_info
creating pip.egg-info
writing requirements to pip.egg-info/requires.txt
writing pip.egg-info/PKG-INFO
writing top-level names to pip.egg-info/top_level.txt
writing dependency_links to pip.egg-info/dependency_links.txt
writing entry points to pip.egg-info/entry_points.txt
writing pbr to pip.egg-info/pbr.json

Not sure what's going on in that python_lconf_lexer-1.1.1.tar.bz2 you've shown above - it's setup.py is quite convulsed and it doesn't even build on my machine.

@rbtcollins this is not about a "bug" in the traditional sense. I'm questioning here the decision to depend on pbr as it makes no sense to me and it's frankly painful to deal with.

@rbtcollins
Copy link
Member

pbr offers both runtime and build-time facilities. Characterising it as build-time-only would be incorrect.

We use pbr's runtime support to abstract away the details of determining the version string and tuple regardless of whether the code is running from an installed copy, or from a git tree.

IF you've experienced a bug/defect/incorrect behaviour, I'll be happy to figure out how to fix that. Merely using a robust and mature library is not one of those things.

@rbtcollins
Copy link
Member

(The pbr.json thing belongs on the pbr bugtracker)

@rbtcollins
Copy link
Member

I have filed https://bugs.launchpad.net/pbr/+bug/1483067 for you

@ionelmc
Copy link
Author

ionelmc commented Aug 9, 2015

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants