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

chore(build): migrate to pyproject.toml for packaging #97

Merged
merged 9 commits into from
Apr 23, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ jobs:

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Run CI tests
run: bash test.sh
shell: bash
7 changes: 4 additions & 3 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install setuptools wheel twine build
- name: Check consistency between the package version and release tag
run: |
pip install .
RELEASE_VER=${GITHUB_REF#refs/*/}
PACKAGE_VER="v`python setup.py --version`"
PACKAGE_VER="v`python -c 'import dm_pix; print(dm_pix.__version__)'`"
if [ $RELEASE_VER != $PACKAGE_VER ]
then
echo "package ver. ($PACKAGE_VER) != release ver. ($RELEASE_VER)"; exit 1
Expand All @@ -30,5 +31,5 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

65 changes: 65 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "dm_pix"
dynamic = ["version"]
description = 'PIX is an image processing library in JAX, for JAX.'
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.8"
authors = [
{name = "Google DeepMind", email = "pix-dev@google.com"},
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Image Processing",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"chex>=0.0.6",
SauravMaheshkar marked this conversation as resolved.
Show resolved Hide resolved
]

[project.optional-dependencies]
extras = [
"jax>=0.2.17",
"jaxlib>=0.1.69",
]

test = [
"scipy",
"tensorflow",
"pytest-xdist",
]

docs = [
"sphinx==4.5.0",
"sphinx_rtd_theme==1.0.0",
"sphinxcontrib-katex==0.9.0",
"sphinxcontrib-bibtex==2.4.2",
"sphinx-autodoc-typehints==1.11.1",
"IPython==8.10.0",
"ipykernel==5.3.4",
"pandoc==1.1.0",
"myst_nb==0.13.1",
"docutils==0.16",
"matplotlib==3.5.0",
]

examples = [
"Pillow==10.3.0",
]

[tool.setuptools.packages.find]
include=["dm_pix/py.typed"]
exclude = ["*_test.py", "examples"]
8 changes: 5 additions & 3 deletions readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ sphinx:

python:
install:
- requirements: requirements_docs.txt
- requirements: requirements.txt
- method: setuptools
- method: pip
path: .
- method: pip
path: .
extra_requirements:
- docs
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

11 changes: 0 additions & 11 deletions requirements_docs.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements_examples.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements_tests.txt

This file was deleted.

83 changes: 0 additions & 83 deletions setup.py

This file was deleted.

10 changes: 5 additions & 5 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ python --version

# Install JAX.
SauravMaheshkar marked this conversation as resolved.
Show resolved Hide resolved
python -m pip install --upgrade pip setuptools
python -m pip install -r requirements.txt
python -c 'import jax; print(jax.__version__)'

# Run setup.py, this installs the python dependencies
SauravMaheshkar marked this conversation as resolved.
Show resolved Hide resolved
python -m pip install .

python -c 'import jax; print(jax.__version__)'

# Python test dependencies.
python -m pip install -r requirements_tests.txt
python -m pip install -e ".[test]"

# CPU count on macos or linux
if [ "$(uname)" == "Darwin" ]; then
N_JOBS=$(sysctl -n hw.logicalcpu)
N_JOBS=$(sysctl -n hw.logicalcpu)
SauravMaheshkar marked this conversation as resolved.
Show resolved Hide resolved
else
N_JOBS=$(grep -c ^processor /proc/cpuinfo)
N_JOBS=$(grep -c ^processor /proc/cpuinfo)
SauravMaheshkar marked this conversation as resolved.
Show resolved Hide resolved
fi

# Run tests using pytest.
Expand Down
Loading