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

Convert setup.cfg to pyproject.toml #260

Merged
merged 16 commits into from
Jun 28, 2024

Conversation

namurphy
Copy link
Contributor

@namurphy namurphy commented Jun 24, 2024

This PR makes improvements to XRTpy packaging that I've been meaning to do for a while now. It makes the following changes:

  • Removed setup.cfg and setup.py in favor of pyproject.toml. For more details, check out the page on how to moderize a setup.py based project.
  • Consolidated the requirements in different dependency sets in pyproject.toml. In addition to the dependencies needed for building and installing XRTpy, there are now docs, tests, and dev dependencies.
  • Changed the Nox sessions used for running tests and building docs to install dependencies using those dependency sets.
  • Removed the requirements files in requirements/ since they are redundant and no longer needed for running tests and building docs.
  • Updated the minimum required versions of packages to be more consistent with SPEC 0. This PR drops support for versions of several dependencies older than ∼24 months.

@namurphy namurphy marked this pull request as ready for review June 24, 2024 22:36
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have previously been installing dependencies using the files in requirements/ when running tests and building docs. The problem with this approach is that the requirements were defined in two places, which meant that we might remember to update a dependency in one place but forget to do it in another. We can get by without the requirements files by making use of the dependency sets (e.g., docs and tests) now being defined in pyproject.toml.

pyproject.toml Outdated
Comment on lines 41 to 50
dependencies = [
"astropy >= 5.1",
"cached-property >= 1.5.2",
"matplotlib >= 3.5.0",
"numpy >= 1.24.0",
"requests >= 2.28.0",
"scikit-image >= 0.19.0",
"scipy >= 1.8.0",
"sunpy[map] >= 4.0.0",
]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the dependencies here to be a bit more consistent with SPEC 0 (i.e., having the minimum required versions of dependencies be ∼24 months old).

Comment on lines +53 to +56
dev = [
"nox >= 2022.8.7",
"pre-commit >= 3.6.0",
]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev dependency set includes packages that we need for both tests & docs.

Comment on lines +57 to +61
tests = [
"pytest >= 8.0.0",
"pytest-allclose >= 1.0.0",
"pytest-xdist >= 3.6.1",
]
Copy link
Contributor Author

@namurphy namurphy Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can install xrtpy & packages necessary for running tests with pip install .[dev,tests] (from the top-level directory of the repo).

Similarly, we can do pip install .[dev,docs] for building docs. This is now handled by the Nox sessions.

session.install("-r", "requirements/tests.txt")
session.install(".")
session.install(".[dev,tests]")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes like these allow us to bypass the need for having the requirements files specified in the requirements/ directory. We'll be installing the dependencies for running tests based on the dependency sets in pyproject.toml instead, so dependencies will only need to be included in one place.

description = "For analyzing data from the X-Ray Telescope (XRT) on the Hinode spacecraft."
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this from 3 - Alpha to 3 - Beta since XRTpy has been gaining maturity.

Comment on lines +29 to +31
# SPEC 0 recommends that packages in the scientific pythoniverse support
# versions of Python that have been released in the last ≤36 months
requires-python = ">=3.9"
Copy link
Contributor Author

@namurphy namurphy Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the link to SPEC 0. We could drop Python 3.9 anytime.

@namurphy namurphy merged commit d7d18c3 into HinodeXRT:main Jun 28, 2024
7 of 8 checks passed
@namurphy namurphy deleted the setup-cfg-to-pyproject-toml-1 branch June 28, 2024 19:05
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.

1 participant