diff --git a/.commitsar.yaml b/.commitsar.yaml deleted file mode 100644 index 95297c4..0000000 --- a/.commitsar.yaml +++ /dev/null @@ -1,6 +0,0 @@ -version: 1 -verbose: true -commits: - strict: true - disabled: false - upstreamBranch: origin/main diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index ba7263a..134d0bb 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,30 +1,45 @@ name: Publish on: + workflow_dispatch: push: tags: - - '*' + - "[2-9].[0-9]+.[0-9]+" + - "[2-9].[0-9]+.[0-9]+-pre[0-9]?" jobs: publish: - name: Publish to PyPI + name: Release to GitHub and PyPI runs-on: ubuntu-latest + permissions: + contents: write + id-token: write steps: - uses: actions/checkout@v4 - with: - fetch-depth: 1 - uses: actions/setup-python@v5 with: python-version: "3.12" + cache: pip + cache-dependency-path: "**/pyproject.toml" - run: pip install hatchling - - name: Build package + - name: Build Package run: hatchling build - - name: Publish distribution package to PyPI + - name: Publish Release Notes + id: release + uses: softprops/action-gh-release@v2 + with: + files: | + ./dist/*.whl + ./dist/*.tar.gz + prerelease: ${{ contains(github.ref, '-pre') }} + generate_release_notes: ${{ !contains(github.ref, '-pre') }} + + - name: Publish Distribution Package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ae4bc9a..a2afce1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,13 @@ default_language_version: python: python3.12 +default_install_hook_types: + - pre-commit + - commit-msg + +default_stages: + - pre-commit + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 @@ -14,12 +21,12 @@ repos: - id: detect-private-key - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.2 + rev: v0.3.2 hooks: - id: ruff-format - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.2 + rev: v0.3.2 hooks: - id: ruff args: ["--fix", "--exit-non-zero-on-fix", "--config", "pyproject.toml"] @@ -32,3 +39,9 @@ repos: additional_dependencies: - types-cachetools - typeguard + + - repo: https://github.com/compilerla/conventional-pre-commit + rev: v3.1.0 + hooks: + - id: conventional-pre-commit + stages: [commit-msg] diff --git a/ludic/web/endpoints.py b/ludic/web/endpoints.py index f5373e2..f6a6d4b 100644 --- a/ludic/web/endpoints.py +++ b/ludic/web/endpoints.py @@ -15,8 +15,7 @@ class AppProtocol(Protocol): - def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: - ... + def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: ... class RoutedProtocol(Protocol): diff --git a/pyproject.toml b/pyproject.toml index 698b694..16d2138 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["hatchling"] +requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" [project] name = "ludic" -version = "0.1.3" +dynamic = ["version"] description = "Lightweight framework for building HTML pages in pure Python." keywords = ["html", "htmx", "async", "web", "templating"] authors = [{ name = "Pavel Dedík", email = "dedikx@gmail.com" }] @@ -39,6 +39,12 @@ test = [ "httpx", ] +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "_version.py" + [tool.ruff] line-length = 88 target-version = "py312"