Skip to content

Commit

Permalink
Improve and streamline Python development
Browse files Browse the repository at this point in the history
  • Loading branch information
tlinhart committed Jun 26, 2024
1 parent dc9d89b commit 00bd386
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,18 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
pip install ruff pytest
(cd python && pip install -r requirements.txt)
run: pip install -r requirements-dev.txt
- name: Check formatting with Ruff
run: ruff format --check .
- name: Lint with Ruff
run: ruff check .
- name: Test with pytest
run: pytest python
run: pytest
publish:
name: Build and publish package
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.x
Expand All @@ -46,11 +41,13 @@ jobs:
python-version: "3.x"
cache: pip
- name: Install dependencies
run: pip install --upgrade build twine
run: pip install -r requirements-dev.txt
- name: Build package
run: python -m build
working-directory: python
- name: Publish package
run: twine upload dist/*
working-directory: python
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ split-on-trailing-comma = false

[tool.ruff.format]
skip-magic-trailing-comma = true

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib"]
4 changes: 0 additions & 4 deletions python/requirements.txt

This file was deleted.

6 changes: 6 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build==1.2.1
pytest==8.2.2
ruff==0.4.10
twine==5.1.1

-e python

0 comments on commit 00bd386

Please sign in to comment.