Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 30 additions & 34 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
with:
files: |
**.py
poetry.lock
uv.lock

- name: Check changed python files
id: changed-python-files
env:
CHANGED_PYTHON_FILES: ${{ steps.raw-changed-python-files.outputs.all_changed_files }}
run: |
if [[ " $CHANGED_PYTHON_FILES " == *" poetry.lock "* ]]; then
# if poetry.lock is changed, we need to check everything
if [[ " $CHANGED_PYTHON_FILES " == *" uv.lock "* ]]; then
# if uv.lock is changed, we need to check everything
CHANGED_PYTHON_FILES="."
fi
echo "all_changed_files=$CHANGED_PYTHON_FILES" >> "$GITHUB_OUTPUT"
Expand All @@ -57,19 +57,19 @@ jobs:
needs: changed-files
steps:
- uses: actions/checkout@v5
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v6
- name: Setup Python with uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
enable-cache: true

- name: Install dependencies
run: poetry install --only=lint
run: uv sync --locked --group lint

- name: Check code formatting
# the job output will contain colored diffs with what needs adjusting
run: poe check-format --output-format=github ${{ needs.changed-files.outputs.changed_python_files }}
run: |
uv run poe check-format --output-format=github ${{ needs.changed-files.outputs.changed_python_files }}

lint:
if: needs.changed-files.outputs.any_python_changed == 'true'
Expand All @@ -78,18 +78,17 @@ jobs:
needs: changed-files
steps:
- uses: actions/checkout@v5
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v6
- name: Setup Python with uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

enable-cache: true
- name: Install dependencies
run: poetry install --only=lint
run: uv sync --locked --group lint

- name: Lint code
run: poe lint --output-format=github ${{ needs.changed-files.outputs.changed_python_files }}
run: |
uv run poe lint --output-format=github ${{ needs.changed-files.outputs.changed_python_files }}

mypy:
if: needs.changed-files.outputs.any_python_changed == 'true'
Expand All @@ -98,21 +97,18 @@ jobs:
needs: changed-files
steps:
- uses: actions/checkout@v5
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v6
- name: Setup Python with uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

enable-cache: true
- name: Install dependencies
run: poetry install --only=lint

run: uv sync --locked --group test
- name: Type check code
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: mypy
run: poe check-types --show-column-numbers --no-error-summary .
run: uv run poe check-types --show-column-numbers --no-error-summary .

docs:
if: needs.changed-files.outputs.any_docs_changed == 'true'
Expand All @@ -121,26 +117,26 @@ jobs:
needs: changed-files
steps:
- uses: actions/checkout@v5
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v6
- name: Setup Python with uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

enable-cache: true
- name: Install dependencies
run: poetry install --extras=docs
run: uv sync --locked --extra docs --group lint

- name: Add Sphinx problem matchers
run: |
echo "::add-matcher::.github/problem-matchers/sphinx-build.json"
echo "::add-matcher::.github/problem-matchers/sphinx-lint.json"

- name: Check docs formatting
run: poe format-docs --check
run: |
uv run poe format-docs --check

- name: Lint docs
run: poe lint-docs

run: |
uv run poe lint-docs
- name: Build docs
run: poe docs -- -e 'SPHINXOPTS=--fail-on-warning --keep-going'
run: |
uv run poe docs -- -e 'SPHINXOPTS=--fail-on-warning --keep-going'
18 changes: 7 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,17 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v5
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- name: Setup Python with poetry caching
# poetry cache requires poetry to already be installed, weirdly
uses: actions/setup-python@v6
- name: Setup Python with uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
cache: poetry
enable-cache: true
- name: Install dependencies with uv
run: uv sync --locked --group test

- name: Test
env:
POETRY_VIRTUALENVS_IN_PROJECT: true
run: |-
poetry install
poe test-with-coverage
run: |
uv run poe test-with-coverage

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/make_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ jobs:
name: Bump version, commit and create tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v5
- uses: actions/checkout@v5
- name: Setup Python with uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

enable-cache: true
- name: Bump project version
run: poetry version "${{ env.NEW_VERSION }}"
run: uv version "${{ env.NEW_VERSION }}"

- uses: EndBug/add-and-commit@v9
id: commit_and_tag
Expand All @@ -40,19 +38,17 @@ jobs:
runs-on: ubuntu-latest
needs: increment-version
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
ref: ${{ env.NEW_TAG }}

- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v5
- name: Setup Python with uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

enable-cache: true
- name: Build a binary wheel and a source tarball
run: poetry build
run: uv build

- name: Store the package
uses: actions/upload-artifact@v4
Expand Down
13 changes: 5 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,23 @@ Please follow these guidelines to ensure a smooth contribution process.

## Setup the Development Environment

We recommend using a virtual environment to manage dependencies. You can use `venv`, `conda`, or any other tool of your choice.

1. Fork/Clone the repository on GitHub

```bash
$ git clone <your-fork-url>
$ cd mediafile
```

2. Set up your development environment
We use `uv` to manage virtual environments. If you don't have it installed, see [here](https://pypi.org/project/uv/).

2. Install dependencies and set up the development environment (using same lockfile as production):
```bash
$ python -m pip install --user pipx
$ pipx install poetry poethepoet
uv sync --frozen --group dev
```

3. Install project dependencies

3. Activate the virtual environment managed by `uv`:
```bash
$ poetry install
source .venv/bin/activate
```

## Before submitting a Pull Request
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ v1.0.0
the codebase with ``ruff``.
- Moved changelog into its own file, ``changelog.rst``. Also added github
workflow for automatic changelog reminders.
- Modernized package and tests setup to use ``poetry``.
- Modernized package and tests setup to use ``uv``.
- Run pyupgrade to align code with Python 3.10+ syntax.
- Added TSO2 tag to ``albumartist_sort``, matching how Picard >= 1.2, iTunes and
Swinsian interpret tags.
Expand Down
Loading