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

Partially work around pending deprecation of pkg_resources #12368

Merged
merged 8 commits into from
Mar 6, 2023

Conversation

adrianeboyd
Copy link
Contributor

@adrianeboyd adrianeboyd commented Mar 6, 2023

Description

  • Replace pkg_resources with importlib_metadata for spacy info
  • Move pkg_resources imports for requirements check into individual methods and catch the deprecation warning in the test suite

Types of change

?

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

* Replace `pkg_resources` with `importlib_metadata` for `spacy info
--url`
* Remove requirements check from `spacy project` given the lack of
alternatives
@adrianeboyd adrianeboyd marked this pull request as draft March 6, 2023 10:59
@adrianeboyd
Copy link
Contributor Author

adrianeboyd commented Mar 6, 2023

This is primarily to test the changes to spacy info, which are easier than the project requirements check.

Some of the project requirements check options:

  • drop requirements check entirely
  • vendor pkg_resources
  • implement our own limited version checks that more or less do the same thing as the current checks

@rmitsch
Copy link
Contributor

rmitsch commented Mar 6, 2023

implement our own limited version checks that more or less do the same thing as the current checks

I think that's the cleanest option, but I'm not sure how much of an effort that would be. Disabling the requirements check as in this PR is fine for now IMO, I suggest to do the actual fixing of the package checks in a separate PR.

@adrianeboyd
Copy link
Contributor Author

I think this is the best workaround until we can decide what to do about the requirements check. I don't know when this could potentially be removed from setuptools entirely.

People can import spacy without deprecation warnings.

Most people running spacy project run won't notice deprecation warnings.

@adrianeboyd adrianeboyd changed the title Handle deprecation of pkg_resources Partially work around pending deprecation of pkg_resources Mar 6, 2023
@adrianeboyd adrianeboyd added the feat / cli Feature: Command-line interface label Mar 6, 2023
@adrianeboyd adrianeboyd marked this pull request as ready for review March 6, 2023 13:07
.github/azure-steps.yml Show resolved Hide resolved
@svlandeg svlandeg merged commit 0bbc620 into explosion:master Mar 6, 2023
@rmitsch rmitsch mentioned this pull request Mar 6, 2023
3 tasks
adrianeboyd added a commit to adrianeboyd/spaCy that referenced this pull request Mar 9, 2023
…#12368)

* Handle deprecation of pkg_resources

* Replace `pkg_resources` with `importlib_metadata` for `spacy info
--url`
* Remove requirements check from `spacy project` given the lack of
alternatives

* Fix installed model URL method and CI test

* Fix types/handling, simplify catch-all return

* Move imports instead of disabling requirements check

* Format

* Reenable test with ignored deprecation warning

* Fix except

* Fix return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / cli Feature: Command-line interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants