Skip to content

Commit

Permalink
deps: create optional deps under dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Nov 29, 2024
1 parent 88964b2 commit 2df313b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 41 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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' }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/CI_Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/CI_large_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'}}
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/CI_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 19 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
]

0 comments on commit 2df313b

Please sign in to comment.