Skip to content

Commit

Permalink
chore: Template upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Oct 11, 2024
1 parent 6c7da38 commit 8edcb95
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 141 deletions.
4 changes: 2 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 1.4.0
_commit: 1.4.8
_src_path: gh:pawamoy/copier-uv
author_email: [email protected]
author_fullname: Timothée Mazzucotelli
Expand All @@ -13,7 +13,7 @@ insiders_email: [email protected]
insiders_repository_name: griffe-warnings-deprecated
project_description: Griffe extension for `@warnings.deprecated` (PEP 702).
project_name: griffe-warnings-deprecated
public_release: false
public_release: true
python_package_command_line_name: ''
python_package_distribution_name: griffe-warnings-deprecated
python_package_import_name: griffe_warnings_deprecated
Expand Down
29 changes: 18 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ jobs:
- name: Fetch all tags
run: git fetch --depth=1 --tags

- name: Set up Python
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: Install uv
run: pip install uv
- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: pyproject.toml

- name: Install dependencies
run: make setup
Expand Down Expand Up @@ -63,11 +66,11 @@ jobs:
echo 'jobs=[
{"os": "macos-latest"},
{"os": "windows-latest"},
{"python-version": "3.9"},
{"python-version": "3.10"},
{"python-version": "3.11"},
{"python-version": "3.12"},
{"python-version": "3.13"}
{"python-version": "3.13"},
{"python-version": "3.14"}
]' | tr -d '[:space:]' >> $GITHUB_OUTPUT
else
echo 'jobs=[
Expand All @@ -86,31 +89,35 @@ jobs:
- macos-latest
- windows-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
resolution:
- highest
- lowest-direct
exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.python-version == '3.13' }}
continue-on-error: ${{ matrix.python-version == '3.14' }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install uv
run: pip install uv
- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
cache-suffix: py${{ matrix.python-version }}

- name: Install dependencies
env:
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,30 @@ jobs:
- name: Fetch all tags
run: git fetch --depth=1 --tags
- name: Setup Python
uses: actions/setup-python@v4
- name: Install build
if: github.repository_owner == 'pawamoy-insiders'
run: python -m pip install build
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup uv
uses: astral-sh/setup-uv@v3
- name: Build dists
if: github.repository_owner == 'pawamoy-insiders'
run: python -m build
run: uv tool run --from build pyproject-build
- name: Upload dists artifact
uses: actions/upload-artifact@v4
if: github.repository_owner == 'pawamoy-insiders'
with:
name: griffe-warnings-deprecated-insiders
path: ./dist/*
- name: Install git-changelog
if: github.repository_owner != 'pawamoy-insiders'
run: pip install git-changelog
- name: Prepare release notes
if: github.repository_owner != 'pawamoy-insiders'
run: git-changelog --release-notes > release-notes.md
run: uv tool run git-changelog --release-notes > release-notes.md
- name: Create release with assets
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: github.repository_owner == 'pawamoy-insiders'
with:
files: ./dist/*
- name: Create release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: github.repository_owner != 'pawamoy-insiders'
with:
body_path: release-notes.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/.pdm-build/
/htmlcov/
/site/
uv.lock

# cache
.cache/
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ make setup
> You can install it with:
>
> ```bash
> python3 -m pip install --user pipx
> pipx install uv
> curl -LsSf https://astral.sh/uv/install.sh | sh
> ```
>
> Now you can try running `make setup` again,
> or simply `uv install`.
> or simply `uv sync`.
You now have the dependencies installed.
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# griffe-warnings-deprecated

[![ci](https://github.com/mkdocstrings/griffe-warnings-deprecated/workflows/ci/badge.svg)](https://github.com/mkdocstrings/griffe-warnings-deprecated/actions?query=workflow%3Aci)
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://mkdocstrings.github.io/griffe-warnings-deprecated/)
[![pypi version](https://img.shields.io/pypi/v/griffe-warnings-deprecated.svg)](https://pypi.org/project/griffe-warnings-deprecated/)
[![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/mkdocstrings/griffe-warnings-deprecated)
[![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#griffe-warnings-deprecated:gitter.im)

Expand All @@ -9,9 +11,9 @@ Griffe extension for `@warnings.deprecated`

## Installation

This project is available to sponsors only, through my Insiders program.
See Insiders [explanation](https://mkdocstrings.github.io/griffe-warnings-deprecated/insiders/)
and [installation instructions](https://mkdocstrings.github.io/griffe-warnings-deprecated/insiders/installation/).
```bash
pip install griffe-warnings-deprecated
```

## Usage

Expand Down
2 changes: 1 addition & 1 deletion config/ruff.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target-version = "py38"
target-version = "py39"
line-length = 120

[lint]
Expand Down
32 changes: 0 additions & 32 deletions devdeps.txt

This file was deleted.

11 changes: 7 additions & 4 deletions duties.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
from contextlib import contextmanager
from importlib.metadata import version as pkgversion
from pathlib import Path
from typing import TYPE_CHECKING, Iterator
from typing import TYPE_CHECKING

from duty import duty, tools

if TYPE_CHECKING:
from collections.abc import Iterator

from duty.context import Context


Expand Down Expand Up @@ -53,8 +55,8 @@ def changelog(ctx: Context, bump: str = "") -> None:
ctx.run(tools.git_changelog(bump=bump or None), title="Updating changelog")


@duty(pre=["check_quality", "check_types", "check_docs", "check_dependencies", "check-api"])
def check(ctx: Context) -> None: # noqa: ARG001
@duty(pre=["check-quality", "check-types", "check-docs", "check-api"])
def check(ctx: Context) -> None:
"""Check it all!"""


Expand Down Expand Up @@ -121,12 +123,13 @@ def docs_deploy(ctx: Context) -> None:
with material_insiders() as insiders:
if not insiders:
ctx.run(lambda: False, title="Not deploying docs without Material for MkDocs Insiders!")
origin = ctx.run("git config --get remote.origin.url", silent=True)
origin = ctx.run("git config --get remote.origin.url", silent=True, allow_overrides=False)
if "pawamoy-insiders/griffe-warnings-deprecated" in origin:
ctx.run(
"git remote add upstream [email protected]:mkdocstrings/griffe-warnings-deprecated",
silent=True,
nofail=True,
allow_overrides=False,
)
ctx.run(
tools.mkdocs.gh_deploy(remote_name="upstream", force=True),
Expand Down
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ plugins:
show_symbol_type_toc: true
signature_crossrefs: true
summary: true
- git-committers:
- git-revision-date-localized:
enabled: !ENV [DEPLOY, false]
repository: mkdocstrings/griffe-warnings-deprecated
enable_creation_date: true
type: timeago
- minify:
minify_html: !ENV [DEPLOY, false]
- group:
Expand Down
42 changes: 39 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "Griffe extension for `@warnings.deprecated` (PEP 702)."
authors = [{name = "Timothée Mazzucotelli", email = "[email protected]"}]
license = {text = "ISC"}
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
keywords = []
dynamic = ["version"]
classifiers = [
Expand All @@ -17,12 +17,12 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Documentation",
"Topic :: Software Development",
"Topic :: Utilities",
Expand Down Expand Up @@ -55,7 +55,6 @@ source-includes = [
"scripts",
"share",
"tests",
"devdeps.txt",
"duties.py",
"mkdocs.yml",
"*.md",
Expand All @@ -66,3 +65,40 @@ source-includes = [
data = [
{path = "share/**/*", relative-to = "."},
]

[tool.uv]
dev-dependencies = [
# dev
"editables>=0.5",

# maintenance
"build>=1.2",
"git-changelog>=2.5",
"twine>=5.1",

# ci
"duty>=1.4",
"ruff>=0.4",
"pytest>=8.2",
"pytest-cov>=5.0",
"pytest-randomly>=3.15",
"pytest-xdist>=3.6",
"mypy>=1.10",
"types-markdown>=3.6",
"types-pyyaml>=6.0",

# docs
"black>=24.4",
"markdown-callouts>=0.4",
"markdown-exec>=1.8",
"mkdocs>=1.6",
"mkdocs-coverage>=1.0",
"mkdocs-gen-files>=0.5",
"mkdocs-git-revision-date-localized-plugin>=1.2",
"mkdocs-literate-nav>=0.6",
"mkdocs-material>=9.5",
"mkdocs-minify-plugin>=0.8",
"mkdocstrings[python]>=0.25",
# YORE: EOL 3.10: Remove line.
"tomli>=2.0; python_version < '3.11'",
]
12 changes: 6 additions & 6 deletions scripts/gen_credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
import os
import sys
from collections import defaultdict
from collections.abc import Iterable
from importlib.metadata import distributions
from itertools import chain
from pathlib import Path
from textwrap import dedent
from typing import Dict, Iterable, Union
from typing import Union

from jinja2 import StrictUndefined
from jinja2.sandbox import SandboxedEnvironment
from packaging.requirements import Requirement

# TODO: Remove once support for Python 3.10 is dropped.
# YORE: EOL 3.10: Replace block with line 2.
if sys.version_info >= (3, 11):
import tomllib
else:
Expand All @@ -26,11 +27,10 @@
pyproject = tomllib.load(pyproject_file)
project = pyproject["project"]
project_name = project["name"]
with project_dir.joinpath("devdeps.txt").open() as devdeps_file:
devdeps = [line.strip() for line in devdeps_file if line.strip() and not line.strip().startswith(("-e", "#"))]
devdeps = [dep for dep in pyproject["tool"]["uv"]["dev-dependencies"] if not dep.startswith("-e")]

PackageMetadata = Dict[str, Union[str, Iterable[str]]]
Metadata = Dict[str, PackageMetadata]
PackageMetadata = dict[str, Union[str, Iterable[str]]]
Metadata = dict[str, PackageMetadata]


def _merge_fields(metadata: dict) -> PackageMetadata:
Expand Down
5 changes: 4 additions & 1 deletion scripts/insiders.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
from datetime import date, datetime, timedelta
from itertools import chain
from pathlib import Path
from typing import Iterable, cast
from typing import TYPE_CHECKING, cast
from urllib.error import HTTPError
from urllib.parse import urljoin
from urllib.request import urlopen

import yaml

if TYPE_CHECKING:
from collections.abc import Iterable

logger = logging.getLogger(f"mkdocs.logs.{__name__}")


Expand Down
Loading

0 comments on commit 8edcb95

Please sign in to comment.