Skip to content

Commit

Permalink
Improve dependencies handling (#59)
Browse files Browse the repository at this point in the history
* minimum pythhon 3.9

* fix requirements

* remove file

* fix macos version in the ci
  • Loading branch information
LeoGrin authored Jan 7, 2025
1 parent 0317cf0 commit ba83e46
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 26 deletions.
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 2
updates:
# Python dependencies
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
groups:
dev-dependencies:
patterns:
- "pre-commit"
- "ruff"
test-dependencies:
patterns:
- "scikit-learn"
- "respx"

# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
87 changes: 76 additions & 11 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,96 @@ jobs:
version: 0.3.3
args: 'format --check'

test:
name: Run unit and integration tests
runs-on: ubuntu-latest
test_compatibility:
name: Test Package Compatibility
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]

include:
- os: ubuntu-latest
python-version: "3.9"
dependency-set: minimum
- os: macos-13 # macos-latest doesn't work with python 3.10
# https://github.com/actions/setup-python/issues/855
python-version: "3.9"
dependency-set: minimum
- os: ubuntu-latest
python-version: "3.11"
dependency-set: maximum
- os: macos-latest
python-version: "3.11"
dependency-set: maximum
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install user's dependencies
run: pip install -r requirements.txt
- name: Install pip-tools
run: python -m pip install pip-tools

- name: Generate requirements file for minimum dependencies
if: matrix.dependency-set == 'minimum'
run: |
python << EOF
import re
with open('requirements.txt', 'r') as f:
reqs = f.readlines()
min_reqs = []
for req in reqs:
req = req.strip()
if not req or req.startswith('#'):
continue
# Extract package name and version range
match = re.match(r'([^>=<\s]+)\s*>=\s*([^,]+),\s*<=\s*([^,]+)', req)
if match:
package, min_ver, _ = match.groups()
min_reqs.append(f"{package}=={min_ver}")
with open('requirements.txt', 'w') as f:
f.write('\n'.join(min_reqs))
EOF
- name: Generate requirements file for maximum dependencies
if: matrix.dependency-set == 'maximum'
run: |
python << EOF
import re
with open('requirements.txt', 'r') as f:
reqs = f.readlines()
max_reqs = []
for req in reqs:
req = req.strip()
if not req or req.startswith('#'):
continue
# Extract package name and version range
match = re.match(r'([^>=<\s]+)\s*>=\s*([^,]+),\s*<=\s*([^,]+)', req)
if match:
package, _, max_ver = match.groups()
max_reqs.append(f"{package}=={max_ver}")
with open('requirements.txt', 'w') as f:
f.write('\n'.join(max_reqs))
EOF
- name: Install test dependencies
run: pip install -r requirements-test.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
pip install -r requirements.txt
- name: Initialize submodules
run: git submodule update --init --recursive

- name: Run Test
- name: Run Tests
run: |
python -m unittest discover -s tabpfn_client/tests -t tabpfn_client/tests
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ build-backend = "hatchling.build"
[project]
name = "tabpfn-client"
version = "0.0.26"
requires-python = ">=3.9"
requires-python = ">=3.9,<3.12"
# doesn't work with 3.12 and 3.13 because cityhash wheels are not available yet
# (see https://github.com/escherba/python-cityhash/issues/88)
# (can be bypassed by installing with conda)
dynamic = ["dependencies", "optional-dependencies"]

classifiers = [
Expand Down Expand Up @@ -39,4 +42,4 @@ dev = ["requirements-dev.txt", "requirements-test.txt"]
exclude = ["tabpfn_client/.tabpfn", "models_diff"]

[tool.hatch.build.targets.sdist]
exclude = ["tabpfn_client/.tabpfn", "models_diff"]
exclude = ["tabpfn_client/.tabpfn", "models_diff"]
5 changes: 2 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
### additional requirements for development


# lint and format checking
pre-commit
ruff == 0.3.3
pre-commit==4.0.1
ruff == 0.3.3
4 changes: 2 additions & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### additional requirements to run tests on CI/CD

scikit-learn
respx
scikit-learn==1.6.0
respx==0.22.0
16 changes: 8 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
httpx==0.27.2
omegaconf>=2.3.0
pandas>=1.3.0
password-strength
scikit-learn>=1.5.2
cityhash
sseclient-py
tqdm
scikit-learn>=1.3.1,<=1.6.0
httpx>=0.25.0,<=0.27.2
omegaconf>=2.1.2,<=2.3.0
pandas>=2.1.2,<=2.2.3
password-strength>=0.0.3.post2,<=0.0.3.post2
cityhash>=0.4.3,<=0.4.7
sseclient-py>=1.8.0,<=1.8.0
tqdm>=4.63.0,<=4.67.1

0 comments on commit ba83e46

Please sign in to comment.