-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace setup.py packaging by Poetry #5266
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
614ba1d
Configure pyproject.toml
snejus 90263a9
Use poetry in workflows
snejus e30ee3f
Update workflows
snejus 7bbd215
Update all docs with Poetry
snejus 1aad6e0
release.py: introduce pyproject.toml
snejus 347911c
Introduce Poe the Poet task runner and define tasks.
snejus bfd9753
Remove tox
snejus 4a8e6e9
Update workflows
snejus 5ccc69d
Lint only changed files
snejus 4494acd
Simplify logic ci.yaml
Serene-Arc 6b2ec01
Search for changed doc and python files separately
Serene-Arc b57c0dd
Rename action
Serene-Arc 4f566f1
Only format correct directories
Serene-Arc 35533b3
Add poethepoet to dependencies for devs
Serene-Arc 4d5b821
Use poetry prefix
Serene-Arc f3c9f03
Use poetry action instead of pipx
Serene-Arc 6d7a6df
Simplify workflow
Serene-Arc b00a83c
Partially revert "Simplify logic ci.yaml"
snejus 627c069
Revert "Only format correct directories"
snejus f3df90c
Revert "Add poethepoet to dependencies for devs"
snejus fee65ba
Revert "Use poetry prefix"
snejus 17ec590
Revert "Simplify workflow"
snejus 6763722
Revert "Use poetry action instead of pipx"
snejus 4752fb0
Do not use fetch-depth: 2 to get changed-files, and fix small typo
snejus 6d3b76d
Update dependencies
snejus a4ed6ab
Document the changes
snejus 50cf70e
Check all python files for formatting issues
snejus c2a13ee
Format docs/conf.py
snejus 0507f6f
Fix sphinx docs linting
snejus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
{ | ||
"problemMatcher": [ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "sphinx", | ||
"pattern": [ | ||
{ | ||
"owner": "sphinx", | ||
"pattern": [ | ||
{ | ||
"regexp": "^Warning, treated as error:$" | ||
}, | ||
{ | ||
"regexp": "^(.*?):(\\d+):(.*)$", | ||
"file": 1, | ||
"line": 2, | ||
"message": 3 | ||
} | ||
] | ||
"regexp": "^([^:]+):(\\d+): (WARNING: )?(.+)$", | ||
"file": 1, | ||
"line": 2, | ||
"message": 4 | ||
} | ||
] | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,56 @@ | ||
name: ci | ||
name: Test | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
env: | ||
PY_COLORS: 1 | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.platform }} | ||
name: Run tests | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [ubuntu-latest, windows-latest] | ||
python-version: ["3.8", "3.9", "3.x"] | ||
|
||
python-version: ["3.8", "3.9"] | ||
runs-on: ${{ matrix.platform }} | ||
env: | ||
PY_COLORS: 1 | ||
|
||
IS_MAIN_PYTHON: ${{ matrix.python-version == '3.8' && matrix.platform == 'ubuntu-latest' }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
- uses: actions/checkout@v4 | ||
- name: Install Python tools | ||
uses: BrandonLWhite/[email protected] | ||
- name: Setup Python with poetry caching | ||
# poetry cache requires poetry to already be installed, weirdly | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: poetry | ||
|
||
- name: Install base dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox sphinx | ||
|
||
- name: Install optional dependencies | ||
if: matrix.platform != 'windows-latest' | ||
- name: Install PyGobject dependencies on Ubuntu | ||
if: matrix.platform == 'ubuntu-latest' | ||
run: | | ||
sudo apt update | ||
sudo apt install ffmpeg # For replaygain | ||
|
||
- name: Test older Python versions with tox | ||
if: matrix.python-version != '3.x' | ||
run: | | ||
tox -e py-test | ||
sudo apt install ffmpeg gobject-introspection libgirepository1.0-dev | ||
poetry install --extras replaygain | ||
|
||
- name: Upload code coverage | ||
if: matrix.python-version == '3.8' && matrix.platform == 'ubuntu-latest' | ||
run: | | ||
pip install codecov || true | ||
codecov || true | ||
|
||
- name: Test latest Python version with tox and mypy | ||
if: matrix.python-version == '3.x' | ||
# continue-on-error is not ideal since it doesn't give a visible | ||
# warning, but there doesn't seem to be anything better: | ||
# https://github.com/actions/toolkit/issues/399 | ||
continue-on-error: true | ||
run: | | ||
tox -vv -e py-mypy | ||
- name: Install Python dependencies | ||
run: poetry install --only=main,test | ||
|
||
test-docs: | ||
runs-on: ubuntu-latest | ||
- if: ${{ ! env.IS_MAIN_PYTHON }} | ||
name: Test without coverage | ||
run: poe test --no-cov | ||
|
||
env: | ||
PY_COLORS: 1 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v2 | ||
- if: ${{ env.IS_MAIN_PYTHON }} | ||
name: Test with coverage | ||
uses: liskin/gh-problem-matcher-wrap@v3 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install base dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox sphinx | ||
|
||
- name: Add problem matcher | ||
run: echo "::add-matcher::.github/sphinx-problem-matcher.json" | ||
|
||
- name: Build and check docs using tox | ||
run: tox -e docs | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
linters: pytest | ||
run: poe test | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install base dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox sphinx | ||
|
||
- name: Add problem matcher | ||
run: echo "::add-matcher::.github/flake8-problem-matcher.json" | ||
|
||
- name: Lint with flake8 | ||
run: tox -e py-lint | ||
- if: ${{ env.IS_MAIN_PYTHON }} | ||
name: Upload code coverage | ||
continue-on-error: true | ||
run: poetry run codecov |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,34 +2,29 @@ name: integration tests | |
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * SUN' # run every Sunday at midnight | ||
- cron: "0 0 * * SUN" # run every Sunday at midnight | ||
jobs: | ||
test_integration: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
PY_COLORS: 1 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up latest Python version | ||
uses: actions/setup-python@v2 | ||
- uses: actions/checkout@v4 | ||
- name: Install Python tools | ||
uses: BrandonLWhite/[email protected] | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9-dev | ||
python-version: 3.8 | ||
cache: poetry | ||
|
||
- name: Install base dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox sphinx | ||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Test with tox | ||
run: | | ||
tox -e int | ||
- name: Test | ||
env: | ||
INTEGRATION_TEST: 1 | ||
run: poe test | ||
|
||
- name: Check external links in docs | ||
run: | | ||
tox -e links | ||
run: poe check-docs-links | ||
|
||
- name: Notify on failure | ||
if: ${{ failure() }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
name: Lint check | ||
run-name: Lint code | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
PYTHON_VERSION: 3.8 | ||
|
||
jobs: | ||
changed-files: | ||
runs-on: ubuntu-latest | ||
name: Get changed files | ||
outputs: | ||
any_docs_changed: ${{ steps.changed-doc-files.outputs.any_changed }} | ||
any_python_changed: ${{ steps.changed-python-files.outputs.any_changed }} | ||
changed_doc_files: ${{ steps.changed-doc-files.outputs.all_changed_files }} | ||
changed_python_files: ${{ steps.changed-python-files.outputs.all_changed_files }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Get changed docs files | ||
id: changed-doc-files | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files: | | ||
docs/** | ||
- name: Get changed python files | ||
id: changed-python-files | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files: | | ||
**.py | ||
|
||
format: | ||
if: needs.changed-files.outputs.any_python_changed == 'true' | ||
runs-on: ubuntu-latest | ||
name: Check formatting | ||
needs: changed-files | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python tools | ||
uses: BrandonLWhite/[email protected] | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: poetry | ||
|
||
- name: Install dependencies | ||
run: poetry install --only=format | ||
|
||
- name: Check code formatting | ||
# the job output will contain colored diffs with what needs adjusting | ||
run: poe check-format | ||
|
||
lint: | ||
if: needs.changed-files.outputs.any_python_changed == 'true' | ||
runs-on: ubuntu-latest | ||
name: Check linting | ||
needs: changed-files | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python tools | ||
uses: BrandonLWhite/[email protected] | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: poetry | ||
|
||
- name: Install dependencies | ||
run: poetry install --only=lint | ||
|
||
- name: Lint code | ||
uses: liskin/gh-problem-matcher-wrap@v3 | ||
with: | ||
linters: flake8 | ||
run: poe lint ${{ needs.changed-files.outputs.changed_python_files }} | ||
|
||
mypy: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏼 nice |
||
if: needs.changed-files.outputs.any_python_changed == 'true' | ||
runs-on: ubuntu-latest | ||
name: Check types with mypy | ||
needs: changed-files | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python tools | ||
uses: BrandonLWhite/[email protected] | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: poetry | ||
|
||
- name: Install dependencies | ||
run: poetry install --only=typing | ||
|
||
- name: Type check code | ||
uses: liskin/gh-problem-matcher-wrap@v3 | ||
continue-on-error: true | ||
with: | ||
linters: mypy | ||
run: poe check-types --show-column-numbers --no-error-summary ${{ needs.changed-files.outputs.changed_python_files }} | ||
|
||
docs: | ||
if: needs.changed-files.outputs.any_docs_changed == 'true' | ||
runs-on: ubuntu-latest | ||
name: Check docs | ||
needs: changed-files | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python tools | ||
uses: BrandonLWhite/[email protected] | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: poetry | ||
|
||
- name: Install dependencies | ||
run: poetry install --only=docs | ||
|
||
- name: Add Sphinx problem matcher | ||
run: echo "::add-matcher::.github/sphinx-problem-matcher.json" | ||
|
||
- name: Build docs | ||
run: | | ||
poe docs |& tee /tmp/output | ||
# fail the job if there are issues | ||
grep -q " WARNING:" /tmp/output && exit 1 || exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,7 @@ target/ | |
.env | ||
|
||
# virtualenv | ||
env/ | ||
venv/ | ||
.venv/ | ||
ENV/ | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well caught! Completely forgot that the docs are written in a different language 😅