Skip to content

Commit

Permalink
Update pyproject.toml & github actions to work with poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
noc0lour committed Nov 26, 2024
1 parent 0f06169 commit 02ea0b5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 15 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@ jobs:
with:
python-version: "3.10"
cache: "pip"
- name: Setup virtual environment
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
python -m venv venv
source venv/bin/activate
pip install pytest pytest-cov
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install --with=dev
- name: Run coverage for mokka
run: |
source venv/bin/activate
pip install '.[torch,tf,dev]'
pytest tests --cov=mokka --cov-report xml
poetry run pytest tests --cov=mokka --cov-report xml
- uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,21 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}

- name: Install dev-tools
run: |
python -m pip install --upgrade pip
pip install ".[torch,tf,dev,remotelog]"
poetry install --with=dev
- name: Rebuild documentation
run: |
docs/make-docs.sh
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,26 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest tox tox-gh-actions
- name: Test with tox
run: tox
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install --with=dev
- name: Run the automated tests (for example)
run: poetry run tox
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jaxtyping = "^0.2.36"
[tool.poetry.group.dev.dependencies]
pre-commit = "*"
pytest = "*"
pytest-coverage = "*"
black = "*"
flake8 = "*"
pylint = "*"
Expand All @@ -46,6 +47,8 @@ python-lsp-black = "*"
sphinx = "*"
sphinx-pyproject = "*"
sphinx_rtd_theme = "*"
tox = "*"
tox-gh-actions = "*"

[tool.poetry.extras]
tf = [
Expand Down

0 comments on commit 02ea0b5

Please sign in to comment.