-
Notifications
You must be signed in to change notification settings - Fork 19
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
Use importlib instead of deprecated pkg_resources. Reorganize setup #188
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #188 +/- ##
=======================================
Coverage 94.38% 94.38%
=======================================
Files 11 11
Lines 1941 1941
Branches 295 350 +55
=======================================
Hits 1832 1832
Misses 91 91
Partials 18 18 ☔ View full report in Codecov by Sentry. |
@zacharyburnett Should I split this PR into two? This one cannot be merged (tests are failing in Python 3.12) until a new |
I don't think that's necessary; can we wait for the new |
What is the difference between Azure "Publish" vs Actions "Build source and wheel distribution"? Do you really need both? |
tweakwcs/__init__.py
Outdated
# package is not installed | ||
__version__ = 'UNKNOWN' | ||
|
||
from importlib.metadata import version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need importlib at all. Try this:
try:
from ._version import version as __version__
except ImportError:
__version__ = ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also include ModuleNotFoundError
:
try:
from ._version import version as __version__
except (ImportError, ModuleNotFoundError):
__version__ = ''
so that if this is copy-pasted elsewhere it will continue to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No one should blindly copy-paste stuff but point taken and it doesn't hurt.
azure-templates.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you advertise that you support python >= 3.7, then you should test also 3.7 and 3.8. But really 3.7 is already EOL, so I think it is okay to do python_requires='>=3.8'
. Still you should keep the 3.8 job.
setup.py
Outdated
@@ -110,7 +110,7 @@ def get_transforms_data(): | |||
'Topic :: Software Development :: Libraries :: Python Modules', | |||
'Development Status :: 3 - Alpha', | |||
], | |||
python_requires='>=3.5', | |||
python_requires='>=3.7', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python_requires='>=3.7', | |
python_requires='>=3.8', |
According to mathematical induction.... if it works for 3.10 and it works for 3.9, it will work for 3.8. ... I think |
'stsci.stimage', | ||
'stsci.imagestats', | ||
'spherical_geometry>=1.2.20', | ||
'packaging>=19.0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you need this as runtime dependency?
'packaging>=19.0', |
test = [ | ||
"pytest", | ||
"pytest-cov", | ||
"coverage", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need this.
"coverage", |
'numpydoc', | ||
'sphinx', | ||
'sphinx-automodapi', | ||
'sphinx-rtd-theme', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not using this.
'sphinx-rtd-theme', |
'README.rst', | ||
'LICENSE.txt', | ||
'CHANGELOG.rst', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless your code actually parses these files, they are not package data.
'README.rst', | |
'LICENSE.txt', | |
'CHANGELOG.rst', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes they are if I want them to be. One does not need to parse them in the code. They can be parsed with eyes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can include them in MANIFEST without making them actual package data for eye-feasting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK. astropy
adds CITATION: https://github.com/astropy/astropy/blob/164a67784e669b30c859db904668e04b9f6e1bfa/pyproject.toml#L145 No one cares.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CITATION one is some copy-and-paste artifact from astropy maybe? astropy does have a Python API for citation, so it is included there on purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
astropy does have a Python API for citation
I must say: WOW!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.astropy.org/acknowledging.html
import astropy
astropy.__citation__
pyproject.toml
Outdated
'*.fits', | ||
'*.txt', | ||
'*.inc', | ||
'*.cfg', | ||
'*.csv', | ||
'*.yaml', | ||
'*.json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be more specific on these ones. You don't want to bundle accidental data.
That is not a given. For example, you might be locked to an older numpy in Python 3.8, and then some code might not work in that combo if you stop testing it. |
|
Yes, exactly that. New code that is somehow not compatible to the oldest version(s) you claim to support. Even using a new keyword in some popular numpy function and so on counts. Or something as simple as things like f-string. |
JWST Regression tests:
https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1069/