-
Notifications
You must be signed in to change notification settings - Fork 6
Upgrade tooling to use uv and pyproject.toml
#74
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ site-generated/ | |
| output/ | ||
| pelican.auto.py | ||
| .DS_Store | ||
| .venv | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| exclude: ^node_modules/ | ||
| repos: | ||
| - repo: local | ||
| hooks: | ||
| - id: ruff | ||
| name: Ruff Linter | ||
| entry: ruff check --fix | ||
| language: system | ||
| types: [python] | ||
|
|
||
| - id: ruff-format | ||
| name: Ruff Formatter | ||
| entry: ruff format --force-exclude | ||
| language: system | ||
| types: [python] | ||
|
|
||
| - id: pyright | ||
| name: Pyright Type Check | ||
| entry: pyright | ||
| language: system | ||
| require_serial: true | ||
| types: [python] | ||
| exclude: ^tests/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,21 @@ | ||
| PYTHON ?= python3 | ||
| PIP := $(PYTHON) -m pip | ||
| PRECOMMIT ?= pre-commit | ||
|
|
||
| .PHONY: install i check c checkinstall ci checkupdate cu help | ||
| .PHONY: check check-light sync sync-all update-deps | ||
| .DEFAULT_GOAL := help | ||
|
|
||
| install i: ## Install Python dependencies from requirements.txt | ||
| $(PIP) install -r requirements.txt | ||
| check: ## Run all pre-commit checks. | ||
| git add -A | ||
| uv run pre-commit run --all-files | ||
|
|
||
| check c: ## Run pre-commit checks on all files | ||
| $(PRECOMMIT) run --all-files | ||
| check-light: ## Run the light set of pre-commit checks. | ||
| git add -A | ||
| uv run pre-commit run --all-files --config .pre-commit-light.yaml | ||
|
|
||
| checkinstall ci: ## Install pre-commit hooks | ||
| $(PRECOMMIT) install | ||
| sync: ## Sync non-development dependencies using uv. | ||
| uv sync --no-dev | ||
|
|
||
| checkupdate cu: ## Update pre-commit hooks to the latest version | ||
| $(PRECOMMIT) autoupdate | ||
| sync-all: ## Sync all dependencies (including development) using uv. | ||
| uv sync --all-groups | ||
|
|
||
| help: ## Display this help message | ||
| @echo "Usage: make <target>" | ||
| @echo | ||
| @echo "Available targets:" | ||
| @grep -E '^[a-z]+ [a-z]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
| update-deps: ## Update pre-commit hooks and dependency locks. | ||
| pre-commit autoupdate || : | ||
| uv lock --upgrade | ||
| uv sync --all-groups |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,71 +1,80 @@ | ||
|
|
||
| import datetime | ||
|
|
||
| # Basic information about the site. | ||
| SITENAME = 'ASF Tooling Website' | ||
| SITEDESC = 'The official website of the ASF Tooling Team' | ||
| SITEDOMAIN = 'tooling.apache.org' | ||
| SITEURL = 'https://tooling.apache.org' | ||
| SITELOGO = 'https://tooling.apache.org//extras/favicon.ico' | ||
| SITEREPOSITORY = 'https://github.com/apache/tooling-docs/blob/main/content/' | ||
| SITENAME = "ASF Tooling Website" | ||
| SITEDESC = "The official website of the ASF Tooling Team" | ||
| SITEDOMAIN = "tooling.apache.org" | ||
| SITEURL = "https://tooling.apache.org" | ||
| SITELOGO = "https://tooling.apache.org//extras/favicon.ico" | ||
| SITEREPOSITORY = "https://github.com/apache/tooling-docs/blob/main/content/" | ||
| CURRENTYEAR = datetime.date.today().year | ||
| TRADEMARKS = 'Apache and the Apache feather logo are trademarks of The Apache Software Foundation.' | ||
| TIMEZONE = 'UTC' | ||
| TRADEMARKS = "Apache and the Apache feather logo are trademarks of The Apache Software Foundation." | ||
| TIMEZONE = "UTC" | ||
| # Theme includes templates and possibly static files | ||
| THEME = 'content/theme' | ||
| THEME = "content/theme" | ||
| # Specify location of plugins, and which to use | ||
| PLUGIN_PATHS = [ 'plugins', ] | ||
| PLUGIN_PATHS = [ | ||
| "plugins", | ||
| ] | ||
| # If the website uses any *.ezmd files, include the 'gfm' and 'asfreader' plugins (in that order) | ||
| PLUGINS = [ 'toc', 'spu', 'gfm', 'asfgenid', 'asfrun', ] | ||
| PLUGINS = [ | ||
| "toc", | ||
| "spu", | ||
| "gfm", | ||
| "asfgenid", | ||
| "asfrun", | ||
| ] | ||
| # All content is located at '.' (aka content/ ) | ||
| PAGE_PATHS = [ 'pages' ] | ||
| STATIC_PATHS = [ '.', ] | ||
| PAGE_PATHS = ["pages"] | ||
| STATIC_PATHS = [ | ||
| ".", | ||
| ] | ||
| # Where to place/link generated pages | ||
|
|
||
| PATH_METADATA = 'pages/(?P<path_no_ext>.*)\\..*' | ||
| PATH_METADATA = "pages/(?P<path_no_ext>.*)\\..*" | ||
|
|
||
| PAGE_SAVE_AS = '{path_no_ext}.html' | ||
| PAGE_SAVE_AS = "{path_no_ext}.html" | ||
| # Don't try to translate | ||
| PAGE_TRANSLATION_ID = None | ||
| # Disable unused Pelican features | ||
| # N.B. These features are currently unsupported, see https://github.com/apache/infrastructure-pelican/issues/49 | ||
| FEED_ALL_ATOM = None | ||
| INDEX_SAVE_AS = '' | ||
| TAGS_SAVE_AS = '' | ||
| CATEGORIES_SAVE_AS = '' | ||
| AUTHORS_SAVE_AS = '' | ||
| ARCHIVES_SAVE_AS = '' | ||
| INDEX_SAVE_AS = "" | ||
| TAGS_SAVE_AS = "" | ||
| CATEGORIES_SAVE_AS = "" | ||
| AUTHORS_SAVE_AS = "" | ||
| ARCHIVES_SAVE_AS = "" | ||
| # Disable articles by pointing to a (should-be-absent) subdir | ||
| ARTICLE_PATHS = [ 'blog' ] | ||
| ARTICLE_PATHS = ["blog"] | ||
| # needed to create blogs page | ||
| ARTICLE_URL = 'blog/{slug}.html' | ||
| ARTICLE_SAVE_AS = 'blog/{slug}.html' | ||
| ARTICLE_URL = "blog/{slug}.html" | ||
| ARTICLE_SAVE_AS = "blog/{slug}.html" | ||
| # Disable all processing of .html files | ||
| READERS = { 'html': None, } | ||
| READERS = { | ||
| "html": None, | ||
| } | ||
|
|
||
| # Configure the asfgenid plugin | ||
| ASF_GENID = { | ||
| 'unsafe_tags': True, | ||
| 'metadata': False, | ||
| 'elements': False, | ||
| 'permalinks': False, | ||
| 'tables': False, | ||
|
|
||
| 'headings': False, | ||
|
|
||
|
|
||
| 'toc': False, | ||
|
|
||
| 'debug': False, | ||
| "unsafe_tags": True, | ||
| "metadata": False, | ||
| "elements": False, | ||
| "permalinks": False, | ||
| "tables": False, | ||
| "headings": False, | ||
| "toc": False, | ||
| "debug": False, | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| # Configure the asfrun plugin (finalization) | ||
| ASF_POSTRUN = [ '/bin/bash pagefind.sh', ] | ||
| ASF_POSTRUN = [ | ||
| "/bin/bash pagefind.sh", | ||
| ] | ||
|
|
||
|
|
||
| # Configure ignore files | ||
| # File and directory basenames matching any of these patterns will be ignored by the processor. | ||
| IGNORE_FILES = [ 'theme', ] | ||
| IGNORE_FILES = [ | ||
| "theme", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| [project] | ||
| name = "tooling-docs" | ||
| version = "0.0.1" | ||
| description = "Internal meta project for Apache Tooling documentation and development tooling (not published)" | ||
| authors = [ | ||
| { name = "ASF Tooling", email = "dev@tooling.apache.org" } | ||
| ] | ||
| license = "Apache-2.0" | ||
| readme = "README.md" | ||
| requires-python = "~=3.13.0" | ||
| dependencies = [ | ||
| "beautifulsoup4", | ||
| "Markdown", | ||
| "pelican", | ||
| "requests" | ||
| ] | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "pre-commit>=2.20.0", | ||
| "pyright>=1.1.393", | ||
| "ruff>=0.9.4", | ||
| ] | ||
|
|
||
| [tool.ruff] | ||
| line-length = 120 | ||
| extend-exclude = [ | ||
| "node_modules", | ||
| ] | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would (again) strongly suggest
prekinstead ofpre-commit. The user experience and speed are incomparable, it usesuvto install loca virtualenv for example. There are already many serious players using prek https://github.com/j178/prek?tab=readme-ov-file#who-is-using-prek - and more every day.If you anyway want to use
pre-commitI would suggest to usepre-commit-uvto add here https://pypi.org/project/pre-commit-uv/ - this is a project that was developed by tox maintainers that is patching thepre-committo useuvinstead ofpipto install local venvs for pre-commit hooks.A bit of interesting context and examples of dramas in our ecosystem.
Unfortunatey the author of
pre-commit(also author of flake8 and few other code quality tools) considers astral and uv as "bad players" who "stole his ideas" and implemented ruff from scratch replacing many other tools in python ecosystem rather than contribute back to his tools and refused to haveuvas an installation option despite clear benefits (speed, caching, better reuse of installed binaries).So tox maintainers implemented
pre-commit-uvthat patches installation of pre-commit and replacespip installwithuv pip installessentially.Also just to add a little spice - the pre-commit author essentially threatened
prekauthor j178/prek#73 and accused him (again) of stealing his ideas instead of contributing to his project, even if prek essentially was from-grounds-up rewrite in rust. Much more open to ideas of the pre-commit users, that the pre-commit author plainly refused to accept as contribution). for example auto-complete of hook names that is essentials for big users like Airflow.We also have good relationship with prek author and he fixes issue in hours usually when we report them - and you should not be afraid of it's stability.