Skip to content

Setting up UV #254

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

Merged
merged 7 commits into from
May 6, 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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.py diff=python
uv.lock linguist-generated=true
24 changes: 8 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,16 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Check lockfile
run: uv lock --check

- name: Install pypa/build
run: python -m pip install build --user
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .
run: uv build --python ${{ matrix.python-version }}
15 changes: 10 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Check lockfile
run: uv lock --check

- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.docs.txt
- run: mkdocs gh-deploy --force
- run: uv install --group docs
- run: uv run mkdocs gh-deploy --force
25 changes: 10 additions & 15 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,21 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Check lockfile
run: uv lock --check

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run mypy
run: mypy automata/**/*.py tests/*.py
run: uv run --python ${{ matrix.python-version }} mypy automata/**/*.py tests/*.py

- name: Run ruff
run: |
ruff check .
ruff format --check .
uv run --python ${{ matrix.python-version }} ruff check .
uv run --python ${{ matrix.python-version }} ruff format --check .
41 changes: 9 additions & 32 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,18 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/checkout@v4

- name: Install Python 3
uses: actions/setup-python@v3
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Check lockfile
run: uv lock --check

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Install dependencies
- name: Build and publish to pypi
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

- name: Install pypa/build
run: python -m pip install build --user

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .

- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
# The pypa/gh-action-pypi-publish action sources attestations from the
# same source, so leaving attestations enabled (the default behavior)
# for both steps will cause the production PyPI step to fail; however,
# disabling attestations on the test PyPI step should allow the
# production PyPI step to succeed
attestations: false

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://upload.pypi.org/legacy/
uv build
uv publish
23 changes: 9 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,21 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Check lockfile
run: uv lock --check

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Test with nose2
run: |
coverage run -m nose2 tests
coverage lcov -o cover/coverage.lcov
uv run --python ${{ matrix.python-version }} coverage run -m nose2 tests
uv run --python ${{ matrix.python-version }} coverage lcov -o cover/coverage.lcov

- name: Run Coveralls
uses: coverallsapp/github-action@master
Expand Down
11 changes: 9 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{
"python.analysis.extraPaths": [".virtualenv"],
"python.analysis.extraPaths": [
".virtualenv"
],
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.rulers": [88],
"editor.rulers": [
88
],
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
}
},
"[yaml][toml]": {
"editor.formatOnSave": true
},
}
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,29 @@ changelog = "https://github.com/caleb531/automata/releases"
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[dependency-groups]
dev = [
"coloraide>=1.8.2",
"coverage==7.4.1",
"mypy==1.8.0",
"mypy-extensions==1.0.0",
"nose2==0.14.1",
"pygraphviz>=1.10",
"ruff==0.11.2",
"types-frozendict==2.0.9",
]

docs = [
"mkdocs==1.6.1",
"mkdocs-material==9.5.50",
"mkdocs-macros-plugin==1.3.7",
"mkdocstrings==0.27.0",
"mkdocstrings-python==1.13.0",
]

[tool.uv]
default-groups = ["dev"]

[tool.mypy]
exclude = ["build"]
disallow_untyped_defs = true
Expand Down
6 changes: 0 additions & 6 deletions requirements.docs.txt

This file was deleted.

20 changes: 0 additions & 20 deletions requirements.txt

This file was deleted.

Loading