Skip to content

Commit

Permalink
Switch to pyproject.toml package setup (#306)
Browse files Browse the repository at this point in the history
* Switch to pyproject.toml package setup

* Add keywords to pyproject.toml

* Add flake8 exclude paths

* Update dependencies to match new minimum versions

* Fix setuptools_scm problem displaying version number in conda list

* Minimum version constraint for optional cupy dependency

* Link to contributors page on github

* Fix typo, readme file is RST format

* Update pyproject.toml

Co-authored-by: jakirkham <[email protected]>

* Update pyproject.toml

Co-authored-by: jakirkham <[email protected]>

* Update pyproject.toml

Co-authored-by: jakirkham <[email protected]>

* Update pyproject.toml

Co-authored-by: jakirkham <[email protected]>

* Update pyproject.toml

Co-authored-by: jakirkham <[email protected]>

* Update pyproject.toml

Co-authored-by: jakirkham <[email protected]>

* Update pyproject.toml

Co-authored-by: jakirkham <[email protected]>

* Use 'python -m build', instead of 'python setup.py sdist bdist_wheel'

* Add python3.12 classifier for PyPI

* Replace versioneer with setuptools-scm (simpler to maintain, better long term support)

* Install python build tool with pip, conda-forge versions are out-of-date

* Add pytest-timeout dependency to environment files (otherwise pytest timeout mark will not be recognised)

* Update contributing guide, drop setup.py and use pip install instead

* Try to fix readthedocs getting the  dask-image version string

* Update installation guide to use pip, not setup.py

* Update dependency versions in pyproject.toml

* Install dask-image with pip, not setup.py, for GPU CI tests

* Update some parts of the Makefule for GPU CI tests (removing setup.py)

* ReadTheDocs must install dask_image package

* Add twine to dependencies, update Makefile away from setup.py

---------

Co-authored-by: jakirkham <[email protected]>
Co-authored-by: Marvin Albert <[email protected]>
  • Loading branch information
3 people authored May 15, 2024
1 parent 243fb0a commit 56e307f
Show file tree
Hide file tree
Showing 22 changed files with 120 additions and 3,097 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ omit =
*/eggs/*
*/.eggs/*
*tests/*
*/versioneer.py
*/_version.py
*/_vendor/*
*/dispatch/*
4 changes: 2 additions & 2 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# setuptools-scm dynamically generated version
dask_image/_version.py

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
7 changes: 4 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ Ready to contribute? Here's how to set up `dask-image` for local development.
2. Clone your fork locally::

$ git clone [email protected]:your_name_here/dask-image.git
$ cd dask-image

3. Install your local copy into an environment. Assuming you have conda installed, this is how you set up your fork for local development (on Windows drop `source`). Replace `"<some version>"` with the Python version used for testing.::

$ conda create -n dask-image-env python="<some version>"
$ source activate dask-image-env
$ python setup.py develop
$ python -m pip install -e .

4. Create a branch for local development::

Expand All @@ -100,7 +101,7 @@ Ready to contribute? Here's how to set up `dask-image` for local development.
5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions::

$ flake8 dask_image tests
$ python setup.py test or py.test
$ pytest

To get flake8, just conda install it into your environment.

Expand Down Expand Up @@ -164,7 +165,7 @@ Finally, install the development version of dask-image::

.. code-block:: console
$ pip install -e .
$ pip install -e ".[test]""
For local testing, please run ``pytest`` in the test environment::

Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ recursive-exclude * *.py[co]

recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif

include versioneer.py
include dask_image/_version.py
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ lint: ## check style with flake8
flake8 dask_image tests

test: ## run tests quickly with the default Python
python setup.py test
python -m pip install ".[test]"
pytest

test-all: ## run tests on every Python version with tox
tox

coverage: ## check code coverage quickly with the default Python
coverage run --source dask_image setup.py test
coverage run -m pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html
Expand All @@ -71,13 +72,13 @@ docs: ## generate Sphinx HTML documentation, including API docs
$(BROWSER) docs/_build/html/index.html

release: clean ## package and upload a release
python setup.py sdist upload
python setup.py bdist_wheel upload
python -m build
ls -l dist
twine upload dist/*

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
python -m build
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install
python -m pip install .
5 changes: 4 additions & 1 deletion continuous_integration/environment-3.10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ channels:
dependencies:
- python=3.10.*
- pip==23.0.1
- wheel==0.38.4
- coverage==7.2.1
- flake8==6.0.0
- pytest==7.2.2
- pytest-cov==4.0.0
- pytest-flake8==1.1.1
- pytest-timeout >=2.3.1
- dask==2024.4.1
- numpy==1.24.2
- scipy==1.10.1
- scikit-image==0.19.3
- pims==0.6.1
- slicerator==1.1.0
- pandas==2.0.0
- twine==5.0.0
- pip:
- build==1.2.1
5 changes: 4 additions & 1 deletion continuous_integration/environment-3.11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ channels:
dependencies:
- python=3.11.*
- pip==23.0.1
- wheel==0.38.4
- coverage==7.2.1
- flake8==6.0.0
- pytest==7.2.2
- pytest-cov==4.0.0
- pytest-flake8==1.1.1
- pytest-timeout >=2.3.1
- dask==2024.4.1
- numpy==1.24.2
- scipy==1.10.1
- scikit-image==0.19.3
- pims==0.6.1
- slicerator==1.1.0
- pandas==2.0.0
- twine==5.0.0
- pip:
- build==1.2.1
5 changes: 4 additions & 1 deletion continuous_integration/environment-3.12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ channels:
dependencies:
- python=3.12.*
- pip==24.0
- wheel==0.43.0
- coverage==7.5.1
- flake8==7.0.0
- pytest==8.2.0
- pytest-cov==5.0.0
- pytest-flake8==1.1.1
- pytest-timeout >=2.3.1
- dask==2024.4.1
- numpy==1.26.4
- scipy==1.13.0
- scikit-image==0.22.0
- pims==0.6.1
- slicerator==1.1.0
- pandas==2.2.2
- twine==5.0.0
- pip:
- build==1.2.1
5 changes: 4 additions & 1 deletion continuous_integration/environment-3.9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ channels:
dependencies:
- python=3.9.*
- pip==24.0
- wheel==0.43.0
- coverage==7.5.1
- flake8==7.0.0
- pytest==8.2.0
- pytest-cov==5.0.0
- pytest-flake8==1.1.1
- pytest-timeout >=2.3.1
- dask==2024.4.1
- numpy==1.26.4
- scipy==1.13.0
- scikit-image==0.22.0
- pims==0.6.1
- slicerator==1.1.0
- pandas==2.2.2
- twine==5.0.0
- pip:
- build==1.2.1
3 changes: 2 additions & 1 deletion continuous_integration/environment-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ channels:
dependencies:
- python=3.9.*
- pip==22.3
- wheel==0.37.1
- jinja2<3.1
- dask==2024.4.1
- numpy==1.23.4
Expand All @@ -16,6 +15,8 @@ dependencies:
- slicerator==1.1.0
- pandas==2.0.0
- pip:
- build==1.2.1
- .. # install dask_image from this repository source
# FIXME: This workaround is required until we have sphinx>=5, as enabled by
# dask-sphinx-theme no longer pinning sphinx-book-theme==0.2.0. This is
# tracked in https://github.com/dask/dask-sphinx-theme/issues/68.
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/gpuci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ rapids-logger "Install cupy"
python -m pip install cupy-cuda112 -f https://pip.cupy.dev/pre

rapids-logger "Install dask-image"
python setup.py install
python -m pip install .

rapids-logger "Check Python versions"
python --version
Expand Down
8 changes: 0 additions & 8 deletions dask_image/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
# -*- coding: utf-8 -*-
from ._version import get_versions

__version__ = get_versions()['version']
del get_versions

from . import _version
__version__ = _version.get_versions()['version']
Loading

0 comments on commit 56e307f

Please sign in to comment.