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

Make setuptools dependency optional #507

Conversation

edwardpeek-crown-public
Copy link

Fallback assignment of model_utils.__version__ = None if pkg_resources can not be imported due to setuptools not being installed

Problem

Fixes #506

Solution

Wrap pkg_resource import in a try block as done in other projects like pytz to make dependency optional.

Commandments

  • Write PEP8 compliant code.
  • Cover it with tests.
  • Update CHANGES.rst file to describe the changes, and quote according issue with GH-<issue_number>.
  • Pay attention to backward compatibility, or if it breaks it, explain why.
  • Update documentation (if relevant).

Fallback assignment of `model_utils.__version__ = None` if `pkg_resources` can not be imported due to `setuptools` not being installed
@codecov
Copy link

codecov bot commented Nov 9, 2021

Codecov Report

Merging #507 (f4f2704) into master (903f640) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #507   +/-   ##
=======================================
  Coverage   95.15%   95.15%           
=======================================
  Files           6        6           
  Lines         825      825           
=======================================
  Hits          785      785           
  Misses         40       40           
Impacted Files Coverage Δ
model_utils/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 903f640...f4f2704. Read the comment docs.

@foarsitter
Copy link
Contributor

#545 replaced pkg_resource with importlib

@foarsitter foarsitter closed this Jun 16, 2023
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.

Undeclared runtime dependency on setuptools/pkg-resources
3 participants