Skip to content
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

Switch to setuptools_scm #331

Merged
merged 8 commits into from
Jan 18, 2025
Merged
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
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Run tests"
on: [push, pull_request]
on: [pull_request, workflow_call]
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -13,12 +13,14 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: Install project
run: pip install .
- 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
# stricter tests for mission critical code
flake8 --count pgzero pgzrun.py test
flake8 --count src test

- name: Install xvfb and pulseaudio
run: |
Expand All @@ -27,7 +29,7 @@ jobs:
run: |
export XDG_RUNTIME_DIR="$RUNNER_TEMP"
pulseaudio -D --start
xvfb-run --auto-servernum python setup.py test
xvfb-run --auto-servernum pytest
- name: Cleanup xvfb pidx
uses: bcomnes/cleanup-xvfb@v1
- uses: actions/upload-artifact@master
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ examples_dev
/venv*/
/notebooks
/test/failed-image
__pycache__
src/pgzero/_version.py
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/PyCQA/flake8
rev: "4.0.1"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.9.2"
hooks:
- id: flake8
- id: ruff
exclude: "^(doc|examples)/"
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

25 changes: 25 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[project]
name = "pgzero"
description = "A zero-boilerplate 2D games framework"
readme = "README.rst"
requires-python = ">=3.6"
dependencies = [
"pygame>=2.1",
"numpy",
"pyfxr",
]
dynamic = ["version"]

[project.urls]
Documentation = "https://pygame-zero.readthedocs.io/"
Source = "https://github.com/lordmauve/pgzero"

[project.scripts]
pgzrun = "pgzero.runner:main"

[build-system]
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/pgzero/_version.py"
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

43 changes: 0 additions & 43 deletions setup.py

This file was deleted.

4 changes: 3 additions & 1 deletion pgzero/__init__.py → src/pgzero/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

"""

__version__ = '1.3.dev0'
from ._version import __version__

__all__ = ['__version__']
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion pgzero/loaders.py → src/pgzero/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ def _load(self, path):
try:
return pygame.mixer.Sound(path)
except pygame.error as err:
if not err.args[0].startswith('Unable to open file'):
if not err.args[0].startswith((
'Unable to open file',
'Unknown WAVE format tag',
'MPEG formats not supported',
)):
raise
from .soundfmt import identify
try:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pgzero/screen.py → src/pgzero/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def rect(self, rect, color, width=1):
c = make_color(color)

hw = width / 2
l, t, w, h = rect
l, t, w, h = rect # noqa: E741
l1, l2 = round(l - hw), round(l + hw)
r1, r2 = round(l + w - hw), round(l + w + hw)
t1, t2 = round(t - hw), round(t + hw)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file modified test/expected-image/circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected-image/filled_polygon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected-image/wrapped_gradient_text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ envlist = py36, py37, py38, py39, py310, flake8
[testenv:flake8]
basepython=python
deps=flake8
commands=flake8 pgzero pgzrun.py test examples
commands=flake8 src test examples

[testenv]
passenv=
Expand All @@ -17,4 +17,7 @@ commands =
py.test --cov=pgzero --basetemp={envtmpdir}

[flake8]
builtins = Actor,Rect,ZRect,animate,clock,exit,images,keyboard,keymods,keys,mouse,music,screen,sounds,storage,tone
max-line-length = 88
builtins =
Actor, Rect, ZRect, animate, clock, exit, images, keyboard, keymods,
keys, mouse, music, screen, sounds, storage, tone
Loading