From 57e041eaf83bc2ec7efe29ad9454ec31d9633325 Mon Sep 17 00:00:00 2001 From: Luke Shingles Date: Fri, 3 Jan 2025 16:57:45 +0000 Subject: [PATCH] Make dev dependencies optional --- .github/workflows/benchmark.yml | 2 +- .github/workflows/deploypypi.yml | 1 - .github/workflows/pytest.yml | 40 +++++++++++++-------------- README.md | 2 +- pyproject.toml | 46 +++++++++++++++++++++++++++++--- requirements.txt | 36 ------------------------- 6 files changed, 63 insertions(+), 64 deletions(-) delete mode 100644 requirements.txt diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index b9caa6cd0..9755380c0 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -38,7 +38,7 @@ jobs: - name: Install artistools run: | python3 -m pip install uv - python3 -m uv pip install --compile-bytecode --editable . + python3 -m uv pip install --compile-bytecode --editable .[dev] - name: Cache test data uses: actions/cache@v4 diff --git a/.github/workflows/deploypypi.yml b/.github/workflows/deploypypi.yml index a9d2fc731..58f4670bf 100644 --- a/.github/workflows/deploypypi.yml +++ b/.github/workflows/deploypypi.yml @@ -142,4 +142,3 @@ jobs: with: skip-existing: true verbose: false - #repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 132e78264..c53ac2cb3 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -36,21 +36,18 @@ jobs: - name: Install artistools run: | python3 -m pip install uv - python3 -m uv pip install --system --upgrade pylint mypy - python3 -m uv pip install --compile-bytecode --editable . + python3 -m uv pip install --compile-bytecode --editable .[dev] - name: Run Ruff if: always() uses: astral-sh/ruff-action@v3 with: - version: 0.8.4 - args: "check --exit-non-zero-on-fix --no-fix" + args: "check --exit-non-zero-on-fix --no-fix" - name: Run Ruff Format if: always() uses: astral-sh/ruff-action@v3 with: - version: 0.8.4 args: "format --check" - name: Run pyright @@ -88,7 +85,7 @@ jobs: - name: Install artistools run: | python3 -m pip install uv - python3 -m uv pip install --compile-bytecode --editable . + python3 -m uv pip install --compile-bytecode --editable .[dev] - uses: pre-commit/action@v3.0.1 @@ -166,10 +163,22 @@ jobs: pytest-rust-target-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}- pytest-rust-target-${{ runner.os }}- - - name: Install artistools + - name: Install artistools (no optional deps) run: | python3 -m pip install uv - python3 -m uv pip install --compile-bytecode --editable . + python3 -m uv pip install . + + - name: Check artistools command line tool + run: | + artistools --help + artistools completions + + - name: Download/extract test data + working-directory: tests/data/ + run: source ./setuptestdata.sh + + - name: Install artistools[dev] + run: python3 -m uv pip install --compile-bytecode --editable .[dev] - name: Cache test data uses: actions/cache@v4 @@ -178,22 +187,11 @@ jobs: path: tests/data/*.tar.xz key: testdata20231114 - - name: Download/extract test data - working-directory: tests/data/ - run: source ./setuptestdata.sh - - - name: Check artistools command line tool - run: | - artistools --help - artistools completions - - name: Test with pytest - run: | - pytest --cov=./ --cov-report=xml + run: python3 -m pytest --cov=./ --cov-report=xml - name: Report coverage - run: | - coverage report + run: python3 -m coverage report - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 diff --git a/README.md b/README.md index 936a411f6..1923eb2d5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ artistools can be installed from PyPI using `pip install artistools'. For develo ```sh git clone https://github.com/artis-mcrt/artistools.git cd artistools -python3 -m pip install -e . +python3 -m pip install --editable .[dev] pre-commit install ``` diff --git a/pyproject.toml b/pyproject.toml index 48028a2eb..6246f665d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,10 +28,51 @@ classifiers = [ "Framework :: Matplotlib", "Intended Audience :: Science/Research", ] -dynamic = ["version", "dependencies"] +dynamic = ["version"] requires-python = ">=3.10" license = { text = "MIT" } readme = { file = "README.md", content-type = 'text/markdown' } +dependencies = [ + "argcomplete>=3.5.1", + "astropy>=6.1.4", + "extinction>=0.4.7", + "george>=0.4.3", + "imageio>=2.36.0", + "matplotlib>=3.9.2", + "numexpr>=2.10.1", + "numpy>=2.2.0", + "pandas>=2.2.3", + "plotly>=5.24.1", + "polars>=1.18.0", + "pyarrow>=18.1.0", + "pynonthermal>=2024.7.4", + "pypdf>=5.1.0", + "PyYAML>=6.0.2", + "rich>=13.9.4", + "scipy>=1.14.1", + "tabulate>=0.9", + "tqdm>=4.67.1", + "wheel>=0.44.0", + "zstandard>=0.23.0", +] + +[project.optional-dependencies] +dev = [ + "mypy[faster-cache]>=1.14.1", + "pandas-stubs>=2.2.3.241126", + "pre-commit>=4.0.1", + "pylint>=3.3.3", + "pyright>=1.1.387", + "pytest>=8.3.3", + "pytest-codspeed>=3.0.0", + "pytest-cov>=6.0.0", + "pytest-xdist[psutil]>=3.6.1", + "types-PyYAML>=6.0.12.20240917", + "types-tabulate>=0.9.0.20240106", + "typeguard>=4.4.1", + "ruff>=0.8.6", +] +pyvista = ["pyvista>=0.44.1"] [project.urls] Repository = "https://www.github.com/artis-mcrt/artistools" @@ -346,9 +387,6 @@ exclude = [ "**/target", ] -[tool.setuptools.dynamic] -dependencies = { file = ["requirements.txt"] } - [tool.setuptools_scm] version_file = "_version.py" local_scheme = "no-local-version" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e3a6d1793..000000000 --- a/requirements.txt +++ /dev/null @@ -1,36 +0,0 @@ -argcomplete>=3.5.1 -astropy>=6.1.4 -coverage>=7.6.4 -extinction>=0.4.7 -george>=0.4.3 -imageio>=2.36.0 -matplotlib>=3.9.2 -mypy[faster-cache]>=1.13.0 -numexpr>=2.10.1 -numpy>=2.2.0 -pandas>=2.2.3 -pandas-stubs>=2.2.3.241126 -plotly>=5.24.1 -polars>=1.16.0 -pre-commit>=4.0.1 -pyarrow>=18.1.0 -pynonthermal>=2024.7.4 -pypdf>=5.1.0 -pyright>=1.1.387 -pytest>=8.3.3 -pytest-codspeed>=3.0.0 -pytest-cov>=6.0.0 -pytest-xdist[psutil]>=3.6.1 -pyvista>=0.44.1 -PyYAML>=6.0.2 -rich>=13.9.4 -ruff>=0.8.4 -scipy>=1.14.1 -setuptools_scm[toml]>=8.1.0 -tabulate>=0.9 -tqdm>=4.67.1 -typeguard>=4.4.1 -types-PyYAML>=6.0.12.20240917 -types-tabulate>=0.9.0.20240106 -wheel>=0.44.0 -zstandard>=0.23.0