diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b3dc654 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +name: Tests and Linting + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + name: "Test (${{ matrix.python-version }})" + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install uv + uses: astral-sh/setup-uv@v5 + + - name: Install dependencies + run: uv sync + + - name: Run tests + run: uv run pytest + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install uv + uses: astral-sh/setup-uv@v5 + + - name: Install dependencies + run: uv sync + + - name: Run lint checks + run: uv run ruff check + - name: Run formatting + run: uv run ruff format --check + + pyright: + name: Pyright + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install uv + uses: astral-sh/setup-uv@v5 + + - name: Install dependencies + run: uv sync + + - name: Run pyright + run: uv run pyright diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index bc8260c..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: CI - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.12 - uses: actions/setup-python@v4 - with: - python-version: "3.12" - - uses: astral-sh/setup-uv@v1 - with: - version: "latest" - - name: Install dependencies - run: uv sync - - name: pytest - run: uv run pytest - - name: lint - run: uv run ruff check - - name: format - run: uv run ruff format --check diff --git a/pyproject.toml b/pyproject.toml index 8815dec..76e5f15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,9 +4,11 @@ version = "0.4.0" description = "Generate pixel graphics for the Tidbyt" authors = [{ name = "Tom MacWright", email = "tom@macwright.com" }] classifiers = [ - "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] readme = "README.md" requires-python = ">=3.12" @@ -32,6 +34,7 @@ dev = [ "ruff>=0.8.2", "pytest>=8.3.4", "pre-commit>=4.1.0", + "pyright>=1.1.393", "syrupy>=4.8.1", ] examples = ["flask>=3.1.0", "gunicorn>=23.0.0", "pytz>=2024.2"] diff --git a/uv.lock b/uv.lock index 5927f37..772e975 100644 --- a/uv.lock +++ b/uv.lock @@ -109,6 +109,7 @@ dev = [ { name = "flask" }, { name = "gunicorn" }, { name = "pre-commit" }, + { name = "pyright" }, { name = "pytest" }, { name = "pytz" }, { name = "ruff" }, @@ -131,6 +132,7 @@ dev = [ { name = "flask", specifier = ">=3.1.0" }, { name = "gunicorn", specifier = ">=23.0.0" }, { name = "pre-commit", specifier = ">=4.1.0" }, + { name = "pyright", specifier = ">=1.1.393" }, { name = "pytest", specifier = ">=8.3.4" }, { name = "pytz", specifier = ">=2024.2" }, { name = "ruff", specifier = ">=0.8.2" }, @@ -300,6 +302,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/43/b3/df14c580d82b9627d173ceea305ba898dca135feb360b6d84019d0803d3b/pre_commit-4.1.0-py2.py3-none-any.whl", hash = "sha256:d29e7cb346295bcc1cc75fc3e92e343495e3ea0196c9ec6ba53f49f10ab6ae7b", size = 220560 }, ] +[[package]] +name = "pyright" +version = "1.1.393" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "nodeenv" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f4/c1/aede6c74e664ab103673e4f1b7fd3d058fef32276be5c43572f4067d4a8e/pyright-1.1.393.tar.gz", hash = "sha256:aeeb7ff4e0364775ef416a80111613f91a05c8e01e58ecfefc370ca0db7aed9c", size = 3790430 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/92/47/f0dd0f8afce13d92e406421ecac6df0990daee84335fc36717678577d3e0/pyright-1.1.393-py3-none-any.whl", hash = "sha256:8320629bb7a44ca90944ba599390162bf59307f3d9fb6e27da3b7011b8c17ae5", size = 5646057 }, +] + [[package]] name = "pytest" version = "8.3.4" @@ -387,6 +402,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/80/47/5e8f44ec0f287b08e8c1f3fc63fe1fbe182f07bf606eec903d7827b95e51/syrupy-4.8.1-py3-none-any.whl", hash = "sha256:274f97cbaf44175f5e478a2f3a53559d31f41c66c6bf28131695f94ac893ea00", size = 50326 }, ] +[[package]] +name = "typing-extensions" +version = "4.12.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/df/db/f35a00659bc03fec321ba8bce9420de607a1d37f8342eee1863174c69557/typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8", size = 85321 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/26/9f/ad63fc0248c5379346306f8668cda6e2e2e9c95e01216d2b8ffd9ff037d0/typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d", size = 37438 }, +] + [[package]] name = "virtualenv" version = "20.29.1"