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

move build configuration into pyproject.toml #6847

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# flake8 does not support pyproject.toml (https://github.com/PyCQA/flake8/issues/234)

[flake8]
select = F, W, E, C
# We should set max line length lower eventually
max-line-length = 130
exclude =
jwst/extern,
docs,
jwst/associations,
jwst/fits_generator,
.tox,
.eggs,
build
per-file-ignores =
jwst/ramp_fitting/tests/compare_cr_navg_files.py:E
jwst/ramp_fitting/tests/compare_crs.py:E
jwst/ramp_fitting/tests/compare_cr_files.py:E
jwst/ramp_fitting/tests/create_cube.py:E
jwst/ramp_fitting/tests/mc_3d.py:E
ignore = E231,E241,W503,W504
; E231, # Missing whitespace after ',', ';', or ':'
; E241, # Multiple spaces after ','
; W503, # Line break occurred before a binary operator
; W504, # Line break occurred after a binary operator
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ outlier_detection

- Replace uses of ``datetime.utcnow`` (deprecated in python 3.12) [#8051]

- Moved build configuration from ``setup.cfg`` to ``pyproject.toml`` to support PEP621 [#6847]

imprint
-------

Expand Down Expand Up @@ -812,7 +814,6 @@ resample_spec
- Update ``resample_spec`` to be skipped for NIRSpec fixed slit MultiSlitModel
rateints input, because that mode is not allowed. [#7516]


1.10.0 (2023-04-03)
===================

Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ successfully (i.e, produces a working .html file). This happens on the CI when
open a pull request, but it is a good idea to build the documentation yourself locally
as well. Before you do this, you will need to make sure you have the correct dependencies
installed in your current environment. All of these optional dependencies are specified
in `setup.cfg` and include things like the correct version of sphinx, as well as the
in `pyproject.toml` and include things like the correct version of sphinx, as well as the
necessary sphinx themes that the project uses. These do not install automatically
when you install `jwst` unless directly specified. To do this, while in the top level
directory of `jwst` on your my_feature branch:
Expand Down Expand Up @@ -266,7 +266,7 @@ for running tests.

>> pip install -e ".[test]"

This will install the optional 'test' dependencies specified in `setup.cfg` that
This will install the optional 'test' dependencies specified in `pyproject.toml` that
don't install by default. The package `pytest` is one of these and is what's used
to run the tests. `pytest` searches through all the directories in your repository
(underneath the directory from which it was invoked command line) and looks for any
Expand Down Expand Up @@ -324,14 +324,14 @@ in your environment, you can check their versions by doing:

>> conda list
When opening up two dependent pull requests in `jwst` and one of its dependency packages,
unit tests will not pass on the CI because the setup.cfg file in `jwst` points to the
unit tests will not pass on the CI because the `pyproject.toml` file in `jwst` points to the
last released version of `stcal`, and stcal points to the last version of `jwst`, so the
issue becomes circular. What you will need to do is modify the setup.cfg files in both
issue becomes circular. What you will need to do is modify the `pyproject.toml` files in both
packages to point to the other to demonstrate that CI tests pass (and make a comment
noting this in your PR), and then change it back before the PR is merge so that changes
to setup.cfg are not merged into master/main. In your `jwst` branch, to point to your
to `pyproject.toml` are not merged into master/main. In your `jwst` branch, to point to your
branch in the dependent package (in this example `stcal`), change the required `stcal`
version in setup.cfg to:
version in `pyproject.toml` to:

>> stcal @ git+https://github.com/<your_username>/stcal.git@<your_branch>

Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include README.md
include CHANGES.rst
include setup.cfg
include LICENSE
include pyproject.toml

Expand Down
19 changes: 12 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
import importlib
import sys
import os
from pathlib import Path

if sys.version_info < (3, 11):
import tomli as tomllib
else:
import tomllib
from packaging.version import Version
from configparser import ConfigParser

Expand Down Expand Up @@ -67,9 +73,6 @@ def setup(app):
sys.path.insert(0, os.path.abspath('exts/'))

# -- General configuration ------------------------------------------------
conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')])
setup_cfg = dict(conf.items('metadata'))

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.3'

Expand Down Expand Up @@ -160,16 +163,18 @@ def check_sphinx_version(expected_version):


# General information about the project
project = setup_cfg['name']
author = setup_cfg['author']
copyright = '{0}, {1}'.format(datetime.datetime.now().year, author)
with open(Path(__file__).parent.parent / "pyproject.toml", "rb") as metadata_file:
metadata = tomllib.load(metadata_file)['project']
project = metadata['name']
author = metadata["authors"][0]["name"]
copyright = f'{datetime.datetime.today().year}, {author}'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
package = importlib.import_module(setup_cfg['name'])
package = importlib.import_module(metadata['name'])
try:
version = package.__version__.split('-', 1)[0]
# The full version, including alpha/beta/rc tags.
Expand Down
6 changes: 3 additions & 3 deletions docs/jwst/user_documentation/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ There is also a `pipeline` module, where the `pipeline` classes, consisting of

**Dependencies**

The `jwst` package has several dependencies (see the `setup.cfg` file in the
top-level directory of `jwst` for a full list). Some notable dependencies
include:
The `jwst` package has several dependencies (see the `pyproject.toml` file
in the top-level directory of `jwst` for a full list). Some notable
dependencies include:

**asdf**

Expand Down
2 changes: 1 addition & 1 deletion jwst/exp_to_source/tests/data/sources/reduce_dataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"text": [
"============================= test session starts ==============================\n",
"platform linux -- Python 3.6.7, pytest-3.9.1, py-1.7.0, pluggy-0.8.0\n",
"rootdir: /internal/1/astropy/jwst, inifile: setup.cfg\n",
"rootdir: /internal/1/astropy/jwst, inifile: pyproject.toml\n",
"plugins: requests-mock-1.5.2, remotedata-0.3.0, openfiles-0.3.0, doctestplus-0.1.3, arraydiff-0.2, ci-watson-0.3\n",
"\n",
"========================= no tests ran in 0.00 seconds =========================\n"
Expand Down
2 changes: 1 addition & 1 deletion jwst/scripts/verify_install_requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def main():
This script is used in a Travis build that doesn't install any test
dependencies from the package. This is to verify that all the modules
are at least importable with only the dependencies listed in
install_requires in setup.py.
``pyproject.toml``.
This is to prevent adding code to the runtime codebase that have
dependencies that are only pulled in via the test dependencies. So for
Expand Down
Loading