Skip to content

Commit 7bc303a

Browse files
authored
Finish pyproject.toml migration (#382)
* Gather system `import`s and separate from external * Reorder external `import`s * Run `import setuptools` * Use `setuptools` instead of `distutils` * Drop explicit `cythonize` calls As `setuptools` will handle this for us, go ahead and drop the `cythonize` calls. * Use Cython's `build_ext` (if available) * Drop `setup_requires` Since these build requirements are already in `pyproject.toml` and that is the preferred way forward, drop them from `setup.py`. * Move setuptool-scm config to `pyproject.toml` * Move nearly all of `setup.py` to `pyproject.toml` * Add more URLs * Add `.txt` extension to license * Use latest setuptools build backend * Drop extra whitespace * Add release note * Fix lint * Move `pytest` config options to `pyproject.toml` * Move `.coveragerc` into `pyproject.toml` * Standardize on `setuptools-scm` with `-` * Add `setuptools` & `setuptools-scm` to dev reqs * Consolidate requirements * Move `setuptools` after `project` items * Simplify classifiers * Drop doc build as it already happens on RTD This preceeded docs builds on RTD for PRs. Now that RTD does PR builds for docs, this is redundant. So drop it. * Move `msgpack` later and unwrap * Run `flake8` before tests * Bake coverage & doctest flags into pytest config * Drop `coveralls` from dependencies * Fix Codecov release note reference * Use `int16` in doctests for consistent reprs Windows defaults to `int32` so won't display those `dtype`s. Whereas UNIX defaults to `int64` and so won't display those `dtype`s. This creates mismatches between the representations in docstrings between the two platforms. For simplicity just use `int16`, which both platforms will represent the same. This should ensure consistency with doctests. * Add coverage report output type to config too * Push `numcodecs` test path into config * Exclude directories outside of numcodecs * Simplify `flake8` instructions * Delete unused `build.cmd` This was used to configure compilers on Windows in the past. Particularly it was used to configure Python 2.7 Windows builds. However as of Python 3.5 and UCRT on Windows, this is unnecessary. Further Python 2.7 was improved by a one off Windows Python compiler installer. In any event this can safely be dropped. It is not used in this repo and shouldn't be needed outside of it. * Drop upper bound on Python * Drop `requirements_dev.txt` too * Always use Cython's `new_build_ext` This should always be available as `cython` is a build requirement. So simplify to just use Cython and skip `setuptools` here.
1 parent 3b9129f commit 7bc303a

21 files changed

+157
-223
lines changed

.coveragerc

Lines changed: 0 additions & 5 deletions
This file was deleted.

.flake8

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
[flake8]
22
max-line-length = 100
3+
exclude =
4+
.git,
5+
.github,
6+
.pytest_cache,
7+
adhoc,
8+
build,
9+
c-blosc,
10+
dist,
11+
docs,
12+
fixture,
13+
notebooks,
14+
numcodecs.egg-info,

.github/workflows/ci-linux.yaml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,16 @@ jobs:
2424

2525
- name: Install numcodecs
2626
run: |
27-
python -m pip install -U pip -r requirements_test.txt -r requirements.txt
28-
python -m pip install -v -e .
27+
python -m pip install -v -e .[test,msgpack,zfpy]
2928
3029
- name: List installed packages
3130
run: python -m pip list
3231

33-
- name: Run tests
34-
run: pytest -v --cov=numcodecs --cov-report xml --doctest-modules --doctest-glob=*.pyx numcodecs
35-
3632
- name: Flake8
37-
run: flake8 numcodecs
33+
run: flake8
3834

39-
- name: Build Docs
40-
run: |
41-
pip install -r requirements_rtfd.txt
42-
cd docs
43-
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
35+
- name: Run tests
36+
run: pytest -v
4437

4538
- uses: codecov/codecov-action@v3
4639
with:

.github/workflows/ci-osx.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ jobs:
3737
conda create -n env python=${{matrix.python-version}} wheel pip compilers 'clang>=12.0.1'
3838
conda activate env
3939
which pip
40-
pip install -r requirements_test.txt -r requirements.txt
4140
conda env export
4241
4342
- name: Show info about `env` environment
@@ -50,14 +49,13 @@ jobs:
5049
run: |
5150
conda activate env
5251
export CC=clang
53-
python -m pip install -U pip -r requirements_test.txt -r requirements.txt
54-
python -m pip install -v -e .
52+
python -m pip install -v -e .[test,msgpack,zfpy]
5553
5654
- name: Run tests
5755
shell: "bash -l {0}"
5856
run: |
5957
conda activate env
60-
pytest -v --cov=numcodecs --cov-report xml numcodecs
58+
pytest -v
6159
6260
- uses: codecov/codecov-action@v3
6361
with:

.github/workflows/ci-windows.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,20 @@ jobs:
3030
conda create -n env python=${{matrix.python-version}} wheel pip compilers
3131
conda activate env
3232
which pip
33-
pip install -r requirements_test.txt -r requirements.txt
3433
conda env export
3534
3635
- name: Install numcodecs
3736
shell: "bash -l {0}"
3837
run: |
3938
conda activate env
4039
export CC=clang
41-
python -m pip install -U pip -r requirements_test.txt -r requirements.txt
42-
python -m pip install -v -e .
40+
python -m pip install -v -e .[test,msgpack,zfpy]
4341
4442
- name: Run tests
4543
shell: "bash -l {0}"
4644
run: |
4745
conda activate env
48-
pytest -v --cov=numcodecs --cov-report xml numcodecs
46+
pytest -v
4947
5048
- uses: codecov/codecov-action@v3
5149
with:

.pyup.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,3 @@
22
# see https://pyup.io/docs/configuration/ for all available options
33

44
schedule: every month
5-
6-
requirements:
7-
- requirements.txt:
8-
pin: False
9-
update: False
10-
- requirements_test.txt:
11-
pin: False
12-
update: False
13-
- requirements_rtfd.txt:
14-
pin: False
15-
update: False
16-
- requirements_dev.txt:
17-
pin: True
18-
update: all

.readthedocs.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ sphinx:
1313

1414
python:
1515
install:
16-
- requirements: requirements_rtfd.txt
1716
- method: pip
1817
path: .
18+
extra_requirements:
19+
- docs
File renamed without changes.

build.cmd

Lines changed: 0 additions & 47 deletions
This file was deleted.

docs/contributing.rst

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,11 @@ the repository, you can do something like the following::
9999
$ mkdir -p ~/pyenv/numcodecs-dev
100100
$ virtualenv --no-site-packages --python=/usr/bin/python3.9 ~/pyenv/numcodecs-dev
101101
$ source ~/pyenv/numcodecs-dev/bin/activate
102-
$ pip install -r requirements_dev.txt
103-
$ python setup.py build_ext --inplace
102+
$ pip install -e .[docs,test,msgpack,zfpy]
104103

105104
To verify that your development environment is working, you can run the unit tests::
106105

107-
$ pytest -v numcodecs
108-
109-
To install numcodecs globally in editable mode run::
110-
111-
$ python -m pip install -e .
106+
$ pytest -v
112107

113108
Creating a branch
114109
~~~~~~~~~~~~~~~~~
@@ -147,11 +142,7 @@ Running the test suite
147142
NumCodecs includes a suite of unit tests, as well as doctests included in function and class
148143
docstrings. The simplest way to run the unit tests is to invoke::
149144

150-
$ pytest -v numcodecs
151-
152-
To also run the doctests within docstrings, run::
153-
154-
$ pytest -v --doctest-modules numcodecs
145+
$ pytest -v
155146

156147
NumCodecs currently supports Python 6-3.9, so the above command must
157148
succeed before code can be accepted into the main code base.
@@ -167,14 +158,14 @@ All code must conform to the PEP8 standard. Regarding line length, lines up to 1
167158
characters are allowed, although please try to keep under 90 wherever possible.
168159
Conformance can be checked by running::
169160

170-
$ flake8 --max-line-length=100 numcodecs
161+
$ flake8
171162

172163
Test coverage
173164
~~~~~~~~~~~~~
174165

175166
NumCodecs maintains 100% test coverage under the latest Python stable release (currently
176167
Python 3.9). Both unit tests and docstring doctests are included when computing
177-
coverage. Running ``pytest -v --cov=numcodecs`` will automatically run the test suite with coverage
168+
coverage. Running ``pytest -v`` will automatically run the test suite with coverage
178169
and produce a coverage report. This should be 100% before code can be accepted into the
179170
main code base.
180171

0 commit comments

Comments
 (0)