Skip to content

Conversation

@miikama
Copy link

@miikama miikama commented Sep 14, 2020

First of all, thanks for the clean wrapper library :)

Previously, the setup.py imported the version of the package directory with from pinnacle import __version__. The issue with this approach is that when setup.py imports from pinnacle package, it ends up trying to also import requests.

When installing in a clean python installation, requests is not available, thus installing the package is not possible without first installing requests manually.

This method of extracting package version (with the drawbacks) is also listed as one of the possible options in https://packaging.python.org/guides/single-sourcing-package-version/#single-sourcing-the-version.

This commit changes the versioning to follow a recent note on the same page, by adding the version in the setup.cfg file instead.

Only more recent versions of setuptools support this (versions after 46.4 which has been released this spring). With older versions of setuptools, the installation of pinnacle package will fail if requests is not installed, as it has been failing up to this point.

Even older versions of setuptools (tested with setuptools 39.0, which is the default on ubuntu 18.04) are able to correctly set the package version in PKG-INFOduring installation even when it is only specified in the pinnacle.__init__.py file and not in the setup.pyat all.

In short, I see no drawbacks, only benefits :).

Previously, the setup.py imported the version of the package
directory with `from pinnacle import __version__`. The issue with
this is that when setup.py imports from pinnacle package, it
ends up trying to also import 'requests'.

When installing in a clean python installation, requests is not
available, thus installing the package is not possible without
first installing requests manually.

This method of extracting package version (with the drawbacks) is
also listed as one of the possible options in
https://packaging.python.org/guides/single-sourcing-package-version/#single-sourcing-the-version

This commit changes the versioning to follow a recent note on
the same page, by adding the version in the setup.cfg file instead.

Only more recent versions of setuptools support this (versions after
46.4 which has been released this spring). With older versions
of setuptools, the installation fails if requests is not installed,
as it has been failing up to this point.

Even older versions of setuptools (tested with 39.0 default on ubuntu 18.04)
are able to extract the package version from the package even though
it is not specified in setup.py and store it in PKG-INFO during package
installation. Thus, I see no drawbacks, only benefits :).
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

Successfully merging this pull request may close these issues.

2 participants