From 2df313bec00174ddca440adbf34031db11400711 Mon Sep 17 00:00:00 2001 From: MilesCranmer Date: Fri, 29 Nov 2024 20:36:21 +0000 Subject: [PATCH] deps: create optional deps under `dev` --- .github/workflows/CI.yml | 18 +++---------- .github/workflows/CI_Windows.yml | 3 +-- .github/workflows/CI_large_nightly.yml | 3 +-- .github/workflows/CI_mac.yml | 7 +----- pyproject.toml | 35 ++++++++++++++------------ 5 files changed, 25 insertions(+), 41 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a454345ae..9d1428541 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -58,26 +58,18 @@ jobs: - name: "Install PySR" run: | python -m pip install --upgrade pip - pip install . + pip install '.[dev]' python -c 'import pysr' - name: "Assert Julia version" if: ${{ matrix.julia-version != '1'}} run: python3 -c "from pysr import jl; assert jl.VERSION.major == jl.seval('v\"${{ matrix.julia-version }}\"').major; assert jl.VERSION.minor == jl.seval('v\"${{ matrix.julia-version }}\"').minor" - - name: "Install test dependencies" - run: pip install coverage coveralls pytest nbval - name: "Set up coverage for subprocesses" run: echo 'import coverage; coverage.process_startup()' > "${{ github.workspace }}/sitecustomize.py" - name: "Run tests" run: coverage run -m pysr test main,cli,startup - - name: "Install JAX" - run: pip install jax jaxlib # (optional import) - if: ${{ matrix.test-id == 'main' }} - name: "Run JAX tests" run: coverage run --append -m pysr test jax if: ${{ matrix.test-id == 'main' }} - - name: "Install Torch" - run: pip install torch # (optional import) - if: ${{ matrix.test-id == 'main' }} - name: "Run Torch tests" run: coverage run --append -m pysr test torch if: ${{ matrix.test-id == 'main' }} @@ -105,7 +97,7 @@ jobs: - name: "Install PySR" run: | python -m pip install --upgrade pip - pip install . + pip install '.[dev]' - name: "Run development test" run: PYSR_TEST_JULIA_VERSION=${{ matrix.julia-version }} PYSR_TEST_PYTHON_VERSION=${{ matrix.python-version }} python -m pysr test dev @@ -189,11 +181,7 @@ jobs: - name: "Install PySR and all dependencies" run: | python -m pip install --upgrade pip - pip install . - pip install mypy - - name: "Install additional dependencies" - run: python -m pip install jax jaxlib torch - if: ${{ matrix.python-version != '3.9' }} + pip install '.[dev]' - name: "Run mypy" run: python -m mypy --install-types --non-interactive pysr if: ${{ matrix.python-version != '3.9' }} diff --git a/.github/workflows/CI_Windows.yml b/.github/workflows/CI_Windows.yml index f66644342..a62b7af6e 100644 --- a/.github/workflows/CI_Windows.yml +++ b/.github/workflows/CI_Windows.yml @@ -46,8 +46,7 @@ jobs: - name: "Install PySR" run: | python -m pip install --upgrade pip - pip install pytest nbval "numpy<2.0.0" - pip install . + pip install '.[dev]' python -c 'import pysr' - name: "Run tests" run: | diff --git a/.github/workflows/CI_large_nightly.yml b/.github/workflows/CI_large_nightly.yml index af00eb8c4..369d4bf47 100644 --- a/.github/workflows/CI_large_nightly.yml +++ b/.github/workflows/CI_large_nightly.yml @@ -40,8 +40,7 @@ jobs: - name: "Install PySR" run: | python -m pip install --upgrade pip - pip install pytest nbval - pip install . + pip install '.[dev]' python -c 'import pysr' - name: "Assert Julia version" if: ${{ matrix.julia-version != '1'}} diff --git a/.github/workflows/CI_mac.yml b/.github/workflows/CI_mac.yml index fab20425c..68a940ee3 100644 --- a/.github/workflows/CI_mac.yml +++ b/.github/workflows/CI_mac.yml @@ -46,17 +46,12 @@ jobs: - name: "Install PySR" run: | python -m pip install --upgrade pip - pip install pytest nbval - pip install . + pip install '.[dev]' python -c 'import pysr' - name: "Run tests" run: | python -m pysr test main,cli,startup - - name: "Install JAX" - run: pip install jax jaxlib # (optional import) - name: "Run JAX tests" run: python -m pysr test jax - - name: "Install Torch" - run: pip install torch # (optional import) - name: "Run Torch tests" run: python -m pysr test torch diff --git a/pyproject.toml b/pyproject.toml index 724e5c0e6..42518283a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,25 @@ dependencies = [ "typing-extensions>=4.0.0,<5.0.0", ] +[project.optional-dependencies] +dev = [ + "beartype>=0.19,<0.20", + "coverage>=7,<8", + "coveralls>=4,<5", + "ipykernel>=6,<7", + "ipython>=8,<9", + "jax[cpu]>=0.4,<0.5", + "jupyter>=1,<2", + "mypy>=1,<2", + "nbval>=0.11,<0.12", + "pandas-stubs", + "pre-commit>=3.7,<5", + "pytest>=8,<9", + "torch>=2,<3", + "types-openpyxl", + "types-pytz", +] + [tool.setuptools] packages = ["pysr", "pysr._cli", "pysr.test"] include-package-data = false @@ -38,19 +57,3 @@ dependencies = {file = "requirements.txt"} [tool.isort] profile = "black" - -[tool.rye] -dev-dependencies = [ - "pre-commit>=3.7.0", - "ipython>=8.23.0", - "ipykernel>=6.29.4", - "mypy>=1.10.0", - "jax[cpu]>=0.4.26", - "torch>=2.3.0", - "pandas-stubs>=2.2.1.240316", - "types-pytz>=2024.1.0.20240417", - "types-openpyxl>=3.1.0.20240428", - "coverage>=7.5.3", - "pytest>=8.3.3", - "nbval>=0.11.0", -]