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
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: Install project
run: pip install .
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
- name: Sync dependencies
run: uv sync
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names in the entire repo
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
.venv/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .git,.venv
# stricter tests for mission critical code
flake8 --count src test
.venv/bin/flake8 --count src test
- name: Run tests
run: pytest
run: .venv/bin/pytest
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
Expand Down
17 changes: 13 additions & 4 deletions doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,18 @@ version:
Development installation
------------------------

It's possible to create a locally-editable install using pip. From the root directory of the checked out source, run::
It's possible to create a locally-editable install using ``uv``. From the root directory of the checked out source, run::

pip3 install --editable .
uv sync --group dev

The installed version will now reflect any local changes you make.

When adding or upgrading dependencies, regenerate ``uv.lock`` with::

uv lock

and commit the updated lock file.

Alternatively, if you don't want to install it at all, it may be run with:

python3 -m pgzero <name of pgzero script>
Expand All @@ -98,9 +104,12 @@ For example:
How to run tests
----------------

The tests can be run with
The tests require an X server and Pulseaudio to be available. On most Linux
systems you can run them with::

python3 setup.py test
export XDG_RUNTIME_DIR=/tmp
pulseaudio -D --start
xvfb-run --auto-servernum pytest


.. _translating:
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ dependencies = [
]
dynamic = ["version"]


[dependency-groups]
dev = [
"tox",
"pytest",
"pytest-cov",
"flake8",
"pre-commit",
]

[project.urls]
Documentation = "https://pygame-zero.readthedocs.io/"
Source = "https://github.com/lordmauve/pgzero"
Expand Down
6 changes: 0 additions & 6 deletions requirements-dev.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

19 changes: 10 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
envlist = py36, py37, py38, py39, py310, flake8

[testenv:flake8]
basepython=python
deps=flake8
commands=flake8 src test examples
basepython = python
skip_install = true
commands_pre = uv sync --group dev
allowlist_externals = uv
commands = flake8 src test examples

[testenv]
passenv=
passenv =
DISPLAY # allow connecting to X
XDG_RUNTIME_DIR # Allow connecting to pulseaudio etc.
deps =
-r{toxinidir}/requirements-dev.txt
commands =
pip install -U pip
py.test --cov=pgzero --basetemp={envtmpdir}
skip_install = true
commands_pre = uv sync --group dev
allowlist_externals = uv
commands = pytest --cov=pgzero --basetemp={envtmpdir}

[flake8]
max-line-length = 88
Expand Down
2,273 changes: 2,273 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

Loading