Skip to content
New issue

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

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

Already on GitHub? # to your account

Setuptools as dependency is problematic w/ pip-tools #595

Closed
akx opened this issue Aug 31, 2020 · 2 comments · Fixed by #913
Closed

Setuptools as dependency is problematic w/ pip-tools #595

akx opened this issue Aug 31, 2020 · 2 comments · Fixed by #913
Assignees
Labels
type: cleanup An internal cleanup or hygiene concern.

Comments

@akx
Copy link
Contributor

akx commented Aug 31, 2020

908da75 (#322) added setuptools as a dependency in this package. However, the pip-tools package that's commonly used for pinning dependencies considers setuptools an unsafe dependency to have in a project at all (as discussed in #492), and as such doesn't save it in the pinned requirements file at all.

Since google-auth depends on Setuptools but a version couldn't have been pinned in the requirements, we're seeing

Collecting setuptools>=40.3.0 (from google-auth==1.19.1->our-proprietary-package==0.31.1)
  Downloading https://files.pythonhosted.org/packages/b0/8b/379494d7dbd3854aa7b85b216cb0af54edcb7fce7d086ba3e35522a713cf/setuptools-50.0.0-py3-none-any.whl (783kB)

which wreaks havoc on Ubuntu 16.04 + Python 3.5 machines due to pypa/setuptools#2352 / https://github.com/pypa/setuptools/issues/2350 / pypa/setuptools#2356 ...

The workaround is to add --allow-unsafe or manually pin setuptools, but is the requirement actually necessary in this package? No other package in the 48-line requirements.txt for this particular project would have required a version of setuptools.

Environment details

  • OS: Ubuntu 16.04
  • Python version: 3.5
  • pip version: irrelevant
  • google-auth version: 1.19.1

Steps to reproduce

  1. Install google-auth on an Ubuntu 16.04 machine
  2. It installs setuptools==50.0.0
  3. SystemError: Parent module 'setuptools' not loaded, cannot perform relative import with setuptools 50 pypa/setuptools#2352 and friends
@busunkim96
Copy link
Contributor

Hi @akx,

It looks like the pin was added to avoid an issue related to namespaces not being handled correctly in older versions of setuptools.

#322

Gotcha.

Grep'ing https://setuptools.readthedocs.io/en/latest/history.html for "namespace" shows 40.3.0 solved a problem with pkg_resource-style namespaces (pypa/setuptools#1321).

That said, 40.3.0 was released Sept 16, 2018 which is fairly recent...

If that's too new, 38.2.2 from Nov 27, 2017 fixed another bug (pypa/setuptools#1214 solved by pypa/setuptools#1215).

Thoughts?

Discussion in https://stackoverflow.com/questions/58843905/what-is-the-proper-way-to-decide-whether-to-allow-unsafe-package-versions-in-pip/58864335#58864335 suggests that this restriction will eventually be removed, but it doesn't look like there is any active discussion at the moment.

I think it might be alright to remove the pin - it has been nearly two years 40.3.0 was released at this point so folks are more likely to have it.

Paging @crwilcox, @tseaver, @plamut, @software-dov for thoughts.

@busunkim96 busunkim96 added the type: cleanup An internal cleanup or hygiene concern. label Aug 31, 2020
@busunkim96 busunkim96 self-assigned this Aug 31, 2020
@akx
Copy link
Contributor Author

akx commented Aug 31, 2020

Hey @busunkim96, thanks for the response. :)

Considering the issue in #322 was only a warning, and even so only manifested when using https://github.com/pantsbuild/pex (which, as far as I know and have used it, is used for application packaging, not library packaging), I think (well, with hindsight being 20:20 and all) the real fix would be for the pex-built project to require a newer setuptools, not this library.

That said, though, I wonder if pkg_resources (from setuptools) is required at all anymore here:

~/b/google-auth-library-python (master) $ git grep pkg_res
docs/conf.py:import pkg_resources
docs/conf.py:version = pkg_resources.get_distribution("google-auth").version
google/__init__.py:    import pkg_resources
google/__init__.py:    pkg_resources.declare_namespace(__name__)
google/auth/crypt/_cryptography_rsa.py:import pkg_resources
google/auth/crypt/_cryptography_rsa.py:    release = pkg_resources.get_distribution("cryptography").parsed_version
google/auth/crypt/_cryptography_rsa.py:    if release < pkg_resources.parse_version("1.4.0"):
google/auth/crypt/_cryptography_rsa.py:except pkg_resources.DistributionNotFound:  # pragma: NO COVER
google/auth/crypt/es256.py:import pkg_resources
google/auth/crypt/es256.py:    release = pkg_resources.get_distribution("cryptography").parsed_version
google/auth/crypt/es256.py:    if release < pkg_resources.parse_version("1.4.0"):
google/auth/crypt/es256.py:except pkg_resources.DistributionNotFound:  # pragma: NO COVER

It seems to be used for two things in library code:

akx added a commit to akx/google-auth-library-python that referenced this issue Aug 31, 2020
gcf-merge-on-green bot pushed a commit that referenced this issue Oct 8, 2020
Refs #595 (comment) 

I see no point in checking whether someone is running a version of https://github.com/pyca/cryptography/ from 2014 that doesn't even compile against modern versions of OpenSSL anymore.
busunkim96 added a commit that referenced this issue Oct 22, 2020
* refactor: split 'with_quota_project' into separate base class (#561)

Co-authored-by: Tres Seaver <tseaver@palladion.com>

* fix: dummy commit to trigger a auto release (#597)

* chore: release 1.21.1 (#599)

* chore: updated CHANGELOG.md [ci skip]

* chore: updated setup.cfg [ci skip]

* chore: updated setup.py

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* fix: migrate signBlob to iamcredentials.googleapis.com (#600)

Migrate signBlob from iam.googleapis.com to iamcredentials.googleapis.com.

This API is deprecated and will be shutdown in one year.

This is used google.auth.iam.Signer.
Added a system_test to sanity check the implementation.

* chore: release 1.21.2 (#601)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* fix: fix expiry for `to_json()` (#589)

* This patch for </issues/501> includes the following fixes:

- The access token is always set to `None`, so the fix involves using (the access) `token` from the saved JSON credentials file.
- For refresh needs, `expiry` also needs to be saved via `to_json()`.
    - DUMP: As `expiry` is a `datetime.datetime` object, serialize to `datetime.isoformat()` in the same [`oauth2client` format](https://github.com/googleapis/oauth2client/blob/master/oauth2client/client.py#L55) for consistency.
    - LOAD: Add code to restore `expiry` back to `datetime.datetime` object when imported.
    - LOAD: If `expiry` was unsaved, automatically set it as expired so refresh takes place.
- Minor `scopes` updates
    - DUMP: Add property for `scopes` so `to_json()` can grab it
    - LOAD: `scopes` may be saved as a string instead of a JSON array (Python list), so ensure it is Sequence[str] when imported.

* chore: add default CODEOWNERS (#609)

* chore: release 1.21.3 (#607)

* feat: add asyncio based auth flow (#612)

* feat: asyncio http request logic and asynchronous credentials logic  (#572)

Co-authored-by: Anirudh Baddepudi <43104821+anibadde@users.noreply.github.com>

* chore: release 1.22.0 (#615)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* fix: move aiohttp to extra as it is currently internal surface (#619)

Fix #618. Removes aiohttp from required dependencies to lessen dependency tree for google-auth.

This will need to be looked at again as more folks use aiohttp and once the surfaces goes to public visibility.

* chore: release 1.22.1 (#620)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* fix: remove checks for ancient versions of Cryptography (#596)

Refs #595 (comment) 

I see no point in checking whether someone is running a version of https://github.com/pyca/cryptography/ from 2014 that doesn't even compile against modern versions of OpenSSL anymore.

* chore: sync to master

Syncs to master.
Fixes broken unit tests in Python 3.6 and 3.7.
Aligns test_identity_pool.py with test_aws.py.

Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Co-authored-by: Tres Seaver <tseaver@palladion.com>
Co-authored-by: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: wesley chun <wescpy@gmail.com>
Co-authored-by: Christopher Wilcox <crwilcox@google.com>
Co-authored-by: Anirudh Baddepudi <43104821+anibadde@users.noreply.github.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
gcf-merge-on-green bot pushed a commit that referenced this issue Oct 29, 2020
🤖 I have created a release \*beep\* \*boop\* 
---
## [1.23.0](https://github.com/googleapis/google-auth-library-python/compare/v1.22.1...v1.23.0) (2020-10-29)


### Features

* Add custom scopes for access tokens from the metadata service ([#633](https://github.com/googleapis/google-auth-library-python/issues/633)) ([0323cf3](https://github.com/googleapis/google-auth-library-python/commit/0323cf390b16e8483660ac88775e8ea4e7f7702d))


### Bug Fixes

* **deps:** Revert "fix: pin 'aoihttp < 3.7.0dev' ([#634](https://github.com/googleapis/google-auth-library-python/issues/634))" ([#632](https://github.com/googleapis/google-auth-library-python/issues/632)) ([#640](https://github.com/googleapis/google-auth-library-python/issues/640)) ([b790e65](https://github.com/googleapis/google-auth-library-python/commit/b790e6535cc37591b23866027a426cde312e07c1))
* pin 'aoihttp < 3.7.0dev' ([#634](https://github.com/googleapis/google-auth-library-python/issues/634)) ([05f9524](https://github.com/googleapis/google-auth-library-python/commit/05f95246fab928fe2f445781117eeac8088497fb))
* remove checks for ancient versions of Cryptography ([#596](https://github.com/googleapis/google-auth-library-python/issues/596)) ([6407258](https://github.com/googleapis/google-auth-library-python/commit/6407258956ec42e3b722418cb7f366e5ae9272ec)), closes [/github.com//issues/595#issuecomment-683903062](https://github.com/googleapis//github.com/googleapis/google-auth-library-python/issues/595/issues/issuecomment-683903062)
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
gcf-merge-on-green bot pushed a commit to googleapis/python-bigquery-storage that referenced this issue Oct 30, 2020
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [google-auth](https://github.com/googleapis/google-auth-library-python) | minor | `==1.22.1` -> `==1.23.0` |

---

### Release Notes

<details>
<summary>googleapis/google-auth-library-python</summary>

### [`v1.23.0`](https://github.com/googleapis/google-auth-library-python/blob/master/CHANGELOG.md#&#8203;1230-httpswwwgithubcomgoogleapisgoogle-auth-library-pythoncomparev1221v1230-2020-10-29)

[Compare Source](https://github.com/googleapis/google-auth-library-python/compare/v1.22.1...v1.23.0)

##### Features

-   Add custom scopes for access tokens from the metadata service ([#&#8203;633](https://github.com/googleapis/google-auth-library-python/issues/633)) ([0323cf3](https://github.com/googleapis/google-auth-library-python/commit/0323cf390b16e8483660ac88775e8ea4e7f7702d))

##### Bug Fixes

-   **deps:** Revert "fix: pin 'aoihttp &lt; 3.7.0dev' ([#&#8203;634](https://github.com/googleapis/google-auth-library-python/issues/634))" ([#&#8203;632](https://github.com/googleapis/google-auth-library-python/issues/632)) ([#&#8203;640](https://github.com/googleapis/google-auth-library-python/issues/640)) ([b790e65](https://github.com/googleapis/google-auth-library-python/commit/b790e6535cc37591b23866027a426cde312e07c1))
-   pin 'aoihttp &lt; 3.7.0dev' ([#&#8203;634](https://github.com/googleapis/google-auth-library-python/issues/634)) ([05f9524](https://github.com/googleapis/google-auth-library-python/commit/05f95246fab928fe2f445781117eeac8088497fb))
-   remove checks for ancient versions of Cryptography ([#&#8203;596](https://github.com/googleapis/google-auth-library-python/issues/596)) ([6407258](https://github.com/googleapis/google-auth-library-python/commit/6407258956ec42e3b722418cb7f366e5ae9272ec)), closes [/github.com/googleapis/google-auth-library-python/issues/595#issuecomment-683903062](https://github.com/googleapis//github.com/googleapis/google-auth-library-python/issues/595/issues/issuecomment-683903062)

##### [1.22.1](https://github.com/googleapis/google-auth-library-python/compare/v1.22.0...v1.22.1) (2020-10-05)

##### Bug Fixes

-   move aiohttp to extra as it is currently internal surface ([#&#8203;619](https://github.com/googleapis/google-auth-library-python/issues/619)) ([a924011](https://github.com/googleapis/google-auth-library-python/commit/a9240111e7af29338624d98ee10aed31462f4d19)), closes [#&#8203;618](https://github.com/googleapis/google-auth-library-python/issues/618)

</details>

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-bigquery-storage).
tseaver added a commit that referenced this issue Nov 8, 2021
tseaver added a commit that referenced this issue Nov 9, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants