Skip to content

feat: Replace slap with tire #51

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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
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
37 changes: 13 additions & 24 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Documentation
name: Docs

on:
push:
Expand All @@ -8,33 +8,22 @@ on:
branches: ["develop"]

jobs:
docs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: NiklasRosenstein/slap@gha/install/v1
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.25"
- run: slap run --no-venv-check docs:build
- uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_site

docs-publish:
needs: [docs]
- uses: jdx/mise-action@v2
- run: mise run build-docs
publish:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
needs: build
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with: { name: docs, path: docs/site }
- uses: JamesIves/[email protected]
- uses: jdx/mise-action@v2
- run: mise run build-docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
{
branch: gh-pages,
folder: docs/site,
ssh-key: "${{ secrets.DEPLOY_KEY }}",
}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_site
40 changes: 31 additions & 9 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,27 @@ on:
pull_request:
branches: ["develop"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2
- run: tire check
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2
- run: tire lint
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -84,18 +102,22 @@ jobs:
]
steps:
- uses: actions/checkout@v4
- uses: NiklasRosenstein/slap@gha/install/v1
- name: Install uv
uses: astral-sh/setup-uv@v5
- uses: jdx/mise-action@v2
- uses: astral-sh/setup-uv@v6
with:
version: "0.5.25"
- uses: actions/setup-python@v5
with: { python-version: "${{ matrix.python-version }}" }
- run: slap test
python-version: "${{ matrix.python-version }}"
- run: tire test
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2
- run: tire fmt --check

publish:
runs-on: ubuntu-latest
needs: test
needs: [check, lint, test, fmt]
environment: release
permissions:
id-token: write
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ __pycache__/
poetry.lock
.dmypy.json
.python-version
.tire
9 changes: 5 additions & 4 deletions docs/mksync-hook.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os
import typing as t
from pathlib import Path

from mkdocs.config.defaults import MkDocsConfig
from mkdocs.structure.pages import Page
from mksync import mksync_file
from mkdocs.config.defaults import MkDocsConfig # type: ignore
from mkdocs.structure.pages import Page # type: ignore
from mksync import mksync_file # type: ignore


def on_page_read_source(page: Page, config: MkDocsConfig) -> str:
Expand All @@ -14,4 +15,4 @@ def on_page_read_source(page: Page, config: MkDocsConfig) -> str:
result = mksync_file(path)
finally:
os.chdir(cwd)
return result.content
return t.cast(str, result.content)
14 changes: 7 additions & 7 deletions docs/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[project]
name = "docs"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"mkdocs>=1.6.1",
"mkdocs-material>=9.5.50",
"mkdocstrings[python]>=0.27.0",
"mksync>=0.1.4",
"mkdocs",
"mkdocs-material",
"mkdocstrings[python]",
"mksync",
"pymdown-extensions",
]
[tool.uv]
dev-dependencies = []
364 changes: 210 additions & 154 deletions docs/uv.lock

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tools]
"cargo:tire" = "0.1.3"
python = "3.8"
uv = "latest"

[tasks.build-docs]
dir = "docs"
run = "uv run mkdocs build"
34 changes: 2 additions & 32 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,5 @@ dev-dependencies = [
"types-dataclasses>=0.6.5,<1.0.0",
]

[tool.slap]
typed = true

[tool.slap.test]
mypy = "uv run dmypy run src/"
pytest = "uv run pytest src/ -vv --doctest-modules"
ruff = "uv run ruff check . && uv run ruff format --check ."

[tool.slap.run]
"docs:build" = "cd docs && uv run mkdocs build --site-dir _site"
"docs:dev" = "cd docs && uv run mkdocs serve"
fmt = "uv run ruff format . && uv run ruff check --fix-only ."

[tool.mypy]
explicit_package_bases = true
mypy_path = ["src"]
namespace_packages = true
pretty = true
python_version = "3.8"
show_error_codes = true
show_error_context = true
strict = true
warn_no_return = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_ignores = false

[tool.ruff]
line-length = 120

[tool.ruff.lint]
extend-select = ["I"]
[tool.pytest.ini_options]
addopts = "--ignore=docs/mksync-hook.py --ignore=scripts/dump_type_vars.py"
6 changes: 3 additions & 3 deletions scripts/github_actions_get_python_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
versions = [x for x in versions if "-" not in x]

# Map orderable keys to string values.
versions = {tuple(map(int, x.split("."))): x for x in versions}
versions_map = {tuple(map(int, x.split("."))): x for x in versions}

# Minimum Python 3.8.0.
versions = {k: v for k, v in versions.items() if k >= (3, 8, 0)}
versions_map = {k: v for k, v in versions_map.items() if k >= (3, 8, 0)}

versions = [it[1] for it in sorted(versions.items(), key=lambda it: it[0])]
versions = [it[1] for it in sorted(versions_map.items(), key=lambda it: it[0])]

versions += ["3.x", "pypy-3.8"]

Expand Down
2 changes: 1 addition & 1 deletion src/typeapi/future/astrewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def visit_Name(self, node: ast.Name) -> ast.AST:
return node
return ast.Subscript(
value=ast.Name(id=self.lookup_target, ctx=ast.Load()),
slice=ast.Index(value=ast.Constant(value=node.id)),
slice=ast.Constant(value=node.id),
ctx=node.ctx,
)

Expand Down
Loading
Loading