Skip to content

Commit

Permalink
Update project dependencies and installation instructions (#691)
Browse files Browse the repository at this point in the history
* Migrate to pyproject.toml dependency management

Update project configuration to use pyproject.toml for managing dependencies, removing separate requirements files. Changes include:
- Move dependencies directly into pyproject.toml
- Add dev dependency group
- Update installation instructions in CONTRIBUTING.md and README.md
- Update GitHub workflows to use `pip install .[dev]`
- Remove requirements.txt and requirements-dev.txt files

* Add pip caching to GitHub workflows

Update check-examples.yml and tests.yml to enable pip package caching during Python setup, which can improve workflow performance and reduce dependency download times
  • Loading branch information
hsahovic authored Feb 6, 2025
1 parent 9c1d31d commit 5403ede
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 41 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/check-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,20 @@ jobs:
- name: Checkout repository code
uses: actions/checkout@v4

# Setup Python (faster than using Python container)
# Setup Python with caching
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'

- name: Install Python Kernel
run: |
pip install ipykernel
python -m ipykernel install --user --name python3
- name: Install dev dependencies
run: pip install -r requirements-dev.txt

- name: Install dependencies
run: pip install -r requirements.txt
run: pip install .[dev]

- name: Build package
run: |
Expand Down Expand Up @@ -101,4 +99,4 @@ jobs:
exit 1
fi
rm examples/temp.ipynb
done
done
5 changes: 1 addition & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ jobs:
with:
python-version: "3.10"

- name: Install dev dependencies
run: pip install -r requirements-dev.txt

- name: Install dependencies
run: pip install -r requirements.txt
run: pip install .[dev]

- name: Download Pandoc
run: |
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ jobs:
- name: Checkout repository code
uses: actions/checkout@v4

# Setup Python (faster than using Python container)
# Setup Python with caching
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}

- name: Install dev dependencies
run: pip install -r requirements-dev.txt
cache: 'pip'

- name: Install dependencies
run: pip install -r requirements.txt
run: pip install .[dev]

- name: Run tests
run: PYTHONPATH=src pytest -x --cov=src/poke_env unit_tests/
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ First, you should use a python virtual environment. Which flavor of virtual envi

This project supports multiple versions of python 3, starting from version 3.9. You can use any supported version for development, but bear in mind that your work will be tested on all supported versions.

Once you have created your virtual environment, install dependencies with `pip install -r requirements.txt` and `pip install -r requirements-dev.txt`. You can now setup pre-commits by running `pre-commit install` - the pre-commit configuration on the repo by defaults assumes Python 3.10.5, but you can modify it locally to your liking.
Once you have created your virtual environment, install dependencies with `pip install .` and `pip install .[dev]`. You can now setup pre-commits by running `pre-commit install` - the pre-commit configuration on the repo by defaults assumes Python 3.10.5, but you can modify it locally to your liking.

## Locally testing your commits

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ git clone https://github.com/hsahovic/poke-env.git
Dependencies and development dependencies can then be installed with:

```
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install .[dev]
```

## Acknowledgements
Expand Down
29 changes: 28 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,34 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dynamic = ["dependencies"]
dependencies = [
"gymnasium>=1.0.0",
"numpy>=2.0.2",
"orjson>=3.10.15",
"pettingzoo>=1.24.3",
"requests>=2.32.3",
"tabulate>=0.9.0",
"websockets==14.2",
]

[project.optional-dependencies]
dev = [
"black==25.1.0",
"flake8>=7.1.1",
"isort==6.0.0",
"mypy>=1.15.0",
"nbsphinx>=0.9.6",
"pre-commit>=4.1.0",
"pytest>=8.3.4",
"pytest-asyncio>=0.25.3",
"pytest-cov>=6.0.0",
"pytest-timeout>=2.3.1",
"sphinx>=7.4.7",
"sphinx-rtd-theme>=3.0.2",
"twine>=6.1.0",
"types-requests>=2.32.0.20241016",
"wheel>=0.45.1",
]

[project.urls]
Documentation = "https://poke-env.readthedocs.io/en/stable/"
Expand Down
15 changes: 0 additions & 15 deletions requirements-dev.txt

This file was deleted.

7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

0 comments on commit 5403ede

Please sign in to comment.