Skip to content

Commit 13f0725

Browse files
authored
Upgrade tooling to use uv and pyproject.toml (#74)
Changed the Makefile to use a similar format to the main "tooling-trusted-releases" repo Addd the light pre-commit config. Removed the requirements.txt fixer from the standard pre-commit config. Ran all Makefile targets including `check-light` which ran ruff auto format. Start fresh by running from the root: `make sync-all`
1 parent 82ae8a6 commit 13f0725

File tree

8 files changed

+634
-67
lines changed

8 files changed

+634
-67
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ site-generated/
55
output/
66
pelican.auto.py
77
.DS_Store
8+
.venv

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ repos:
3131
- id: fix-byte-order-marker
3232
- id: forbid-submodules
3333
- id: mixed-line-ending
34-
- id: requirements-txt-fixer
35-
files: ^requirements\.txt$
3634
- id: trailing-whitespace
3735
args: [--markdown-linebreak-ext=md]
3836
exclude: (\.svg$)

.pre-commit-light.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
exclude: ^node_modules/
2+
repos:
3+
- repo: local
4+
hooks:
5+
- id: ruff
6+
name: Ruff Linter
7+
entry: ruff check --fix
8+
language: system
9+
types: [python]
10+
11+
- id: ruff-format
12+
name: Ruff Formatter
13+
entry: ruff format --force-exclude
14+
language: system
15+
types: [python]
16+
17+
- id: pyright
18+
name: Pyright Type Check
19+
entry: pyright
20+
language: system
21+
require_serial: true
22+
types: [python]
23+
exclude: ^tests/

Makefile

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
PYTHON ?= python3
2-
PIP := $(PYTHON) -m pip
3-
PRECOMMIT ?= pre-commit
4-
5-
.PHONY: install i check c checkinstall ci checkupdate cu help
1+
.PHONY: check check-light sync sync-all update-deps
62
.DEFAULT_GOAL := help
73

8-
install i: ## Install Python dependencies from requirements.txt
9-
$(PIP) install -r requirements.txt
4+
check: ## Run all pre-commit checks.
5+
git add -A
6+
uv run pre-commit run --all-files
107

11-
check c: ## Run pre-commit checks on all files
12-
$(PRECOMMIT) run --all-files
8+
check-light: ## Run the light set of pre-commit checks.
9+
git add -A
10+
uv run pre-commit run --all-files --config .pre-commit-light.yaml
1311

14-
checkinstall ci: ## Install pre-commit hooks
15-
$(PRECOMMIT) install
12+
sync: ## Sync non-development dependencies using uv.
13+
uv sync --no-dev
1614

17-
checkupdate cu: ## Update pre-commit hooks to the latest version
18-
$(PRECOMMIT) autoupdate
15+
sync-all: ## Sync all dependencies (including development) using uv.
16+
uv sync --all-groups
1917

20-
help: ## Display this help message
21-
@echo "Usage: make <target>"
22-
@echo
23-
@echo "Available targets:"
24-
@grep -E '^[a-z]+ [a-z]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
18+
update-deps: ## Update pre-commit hooks and dependency locks.
19+
pre-commit autoupdate || :
20+
uv lock --upgrade
21+
uv sync --all-groups

pelicanconf.py

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,80 @@
1-
21
import datetime
2+
33
# Basic information about the site.
4-
SITENAME = 'ASF Tooling Website'
5-
SITEDESC = 'The official website of the ASF Tooling Team'
6-
SITEDOMAIN = 'tooling.apache.org'
7-
SITEURL = 'https://tooling.apache.org'
8-
SITELOGO = 'https://tooling.apache.org//extras/favicon.ico'
9-
SITEREPOSITORY = 'https://github.com/apache/tooling-docs/blob/main/content/'
4+
SITENAME = "ASF Tooling Website"
5+
SITEDESC = "The official website of the ASF Tooling Team"
6+
SITEDOMAIN = "tooling.apache.org"
7+
SITEURL = "https://tooling.apache.org"
8+
SITELOGO = "https://tooling.apache.org//extras/favicon.ico"
9+
SITEREPOSITORY = "https://github.com/apache/tooling-docs/blob/main/content/"
1010
CURRENTYEAR = datetime.date.today().year
11-
TRADEMARKS = 'Apache and the Apache feather logo are trademarks of The Apache Software Foundation.'
12-
TIMEZONE = 'UTC'
11+
TRADEMARKS = "Apache and the Apache feather logo are trademarks of The Apache Software Foundation."
12+
TIMEZONE = "UTC"
1313
# Theme includes templates and possibly static files
14-
THEME = 'content/theme'
14+
THEME = "content/theme"
1515
# Specify location of plugins, and which to use
16-
PLUGIN_PATHS = [ 'plugins', ]
16+
PLUGIN_PATHS = [
17+
"plugins",
18+
]
1719
# If the website uses any *.ezmd files, include the 'gfm' and 'asfreader' plugins (in that order)
18-
PLUGINS = [ 'toc', 'spu', 'gfm', 'asfgenid', 'asfrun', ]
20+
PLUGINS = [
21+
"toc",
22+
"spu",
23+
"gfm",
24+
"asfgenid",
25+
"asfrun",
26+
]
1927
# All content is located at '.' (aka content/ )
20-
PAGE_PATHS = [ 'pages' ]
21-
STATIC_PATHS = [ '.', ]
28+
PAGE_PATHS = ["pages"]
29+
STATIC_PATHS = [
30+
".",
31+
]
2232
# Where to place/link generated pages
2333

24-
PATH_METADATA = 'pages/(?P<path_no_ext>.*)\\..*'
34+
PATH_METADATA = "pages/(?P<path_no_ext>.*)\\..*"
2535

26-
PAGE_SAVE_AS = '{path_no_ext}.html'
36+
PAGE_SAVE_AS = "{path_no_ext}.html"
2737
# Don't try to translate
2838
PAGE_TRANSLATION_ID = None
2939
# Disable unused Pelican features
3040
# N.B. These features are currently unsupported, see https://github.com/apache/infrastructure-pelican/issues/49
3141
FEED_ALL_ATOM = None
32-
INDEX_SAVE_AS = ''
33-
TAGS_SAVE_AS = ''
34-
CATEGORIES_SAVE_AS = ''
35-
AUTHORS_SAVE_AS = ''
36-
ARCHIVES_SAVE_AS = ''
42+
INDEX_SAVE_AS = ""
43+
TAGS_SAVE_AS = ""
44+
CATEGORIES_SAVE_AS = ""
45+
AUTHORS_SAVE_AS = ""
46+
ARCHIVES_SAVE_AS = ""
3747
# Disable articles by pointing to a (should-be-absent) subdir
38-
ARTICLE_PATHS = [ 'blog' ]
48+
ARTICLE_PATHS = ["blog"]
3949
# needed to create blogs page
40-
ARTICLE_URL = 'blog/{slug}.html'
41-
ARTICLE_SAVE_AS = 'blog/{slug}.html'
50+
ARTICLE_URL = "blog/{slug}.html"
51+
ARTICLE_SAVE_AS = "blog/{slug}.html"
4252
# Disable all processing of .html files
43-
READERS = { 'html': None, }
53+
READERS = {
54+
"html": None,
55+
}
4456

4557
# Configure the asfgenid plugin
4658
ASF_GENID = {
47-
'unsafe_tags': True,
48-
'metadata': False,
49-
'elements': False,
50-
'permalinks': False,
51-
'tables': False,
52-
53-
'headings': False,
54-
55-
56-
'toc': False,
57-
58-
'debug': False,
59+
"unsafe_tags": True,
60+
"metadata": False,
61+
"elements": False,
62+
"permalinks": False,
63+
"tables": False,
64+
"headings": False,
65+
"toc": False,
66+
"debug": False,
5967
}
6068

6169

62-
63-
64-
6570
# Configure the asfrun plugin (finalization)
66-
ASF_POSTRUN = [ '/bin/bash pagefind.sh', ]
71+
ASF_POSTRUN = [
72+
"/bin/bash pagefind.sh",
73+
]
6774

6875

6976
# Configure ignore files
7077
# File and directory basenames matching any of these patterns will be ignored by the processor.
71-
IGNORE_FILES = [ 'theme', ]
78+
IGNORE_FILES = [
79+
"theme",
80+
]

pyproject.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[project]
2+
name = "tooling-docs"
3+
version = "0.0.1"
4+
description = "Internal meta project for Apache Tooling documentation and development tooling (not published)"
5+
authors = [
6+
{ name = "ASF Tooling", email = "[email protected]" }
7+
]
8+
license = "Apache-2.0"
9+
readme = "README.md"
10+
requires-python = "~=3.13.0"
11+
dependencies = [
12+
"beautifulsoup4",
13+
"Markdown",
14+
"pelican",
15+
"requests"
16+
]
17+
18+
[dependency-groups]
19+
dev = [
20+
"pre-commit>=2.20.0",
21+
"pyright>=1.1.393",
22+
"ruff>=0.9.4",
23+
]
24+
25+
[tool.ruff]
26+
line-length = 120
27+
extend-exclude = [
28+
"node_modules",
29+
]

requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)