From cabf9cf04e9915f0fd09e77e018ee47644417a85 Mon Sep 17 00:00:00 2001 From: CJ Steiner Date: Tue, 11 Mar 2025 15:40:55 -0500 Subject: [PATCH] consolidate requirements and setup into pyproject toml - use uv for builds --- .github/workflows/deploy.yml | 6 +++--- Makefile | 19 +++++++------------ pyproject.toml | 19 +++++++++++++++++++ requirements-dev.txt | 5 ----- sections/cli.md | 2 +- sections/install.md | 2 +- setup.cfg | 2 -- 7 files changed, 31 insertions(+), 24 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements-dev.txt delete mode 100644 setup.cfg diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 47422e09..59b4c434 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,11 +12,11 @@ jobs: pr: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 with: python-version: 3.x - - run: pip install virtualenv + enable-cache: true - run: make - run: make push env: diff --git a/Makefile b/Makefile index 81533eda..d25f5cc8 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,14 @@ all: install-hooks build/main_bs5.css index.html hooks.html .PHONY: install-hooks -install-hooks: venv - venv/bin/pre-commit install +install-hooks: + uv run pre-commit install build/main_bs5.css: node_modules build scss/main_bs5.scss scss/_variables.scss node_modules/.bin/sass --style=compressed --load-path=. scss/main_bs5.scss build/main_bs5.css -index.html hooks.html: venv base.mako index.mako hooks.mako make_templates.py template_lib.py sections/*.md - venv/bin/python make_templates.py - -venv: requirements-dev.txt Makefile - rm -rf venv - virtualenv venv -ppython3 - venv/bin/pip install -r requirements-dev.txt +index.html hooks.html: base.mako index.mako hooks.mako make_templates.py template_lib.py sections/*.md + uv run python make_templates.py node_modules: package.json ( \ @@ -22,13 +17,13 @@ node_modules: package.json touch $@ \ ) || touch $@ --reference $^ --date '1 day ago' -push: venv - venv/bin/markdown-to-presentation push \ +push: + uv run markdown-to-presentation push \ .nojekyll README.md CNAME \ build assets *.html *.png *.svg favicon.ico clean: - rm -rf venv build node_modules *.html + rm -rf build node_modules *.html build: mkdir -p build diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..364746f0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[project] +name = "pre-commit.com" +version = "0.1.0" +description = "This powers https://pre-commit.com" +readme = "README.md" +requires-python = ">=3.7" +dependencies = [] + +[dependency-groups] +dev = [ + "mako>=1.2.4", + "markdown-code-blocks>=3.0.0", + "markdown-to-presentation>=0.0.12", + "pre-commit>=1.21.0", + "pygments-pre-commit>=1.4.0", +] + +[tool.mypy] +disallow_untyped_defs = true diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 05abc0ec..00000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,5 +0,0 @@ -mako -markdown-code-blocks>=3.0.0 -markdown-to-presentation>=0.0.12 -pre-commit>=1.21.0 -pygments-pre-commit>=1.4.0 diff --git a/sections/cli.md b/sections/cli.md index a644a0ae..fd52d1e2 100644 --- a/sections/cli.md +++ b/sections/cli.md @@ -29,7 +29,7 @@ Here are some sample invocations using this `.pre-commit-config.yaml`: ```yaml repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.1.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade diff --git a/sections/install.md b/sections/install.md index 3d6d4d85..8782979b 100644 --- a/sections/install.md +++ b/sections/install.md @@ -46,7 +46,7 @@ pre-commit --version ```yaml repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v5.0.0 hooks: - id: check-yaml - id: end-of-file-fixer diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 82aa7eb9..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[mypy] -disallow_untyped_defs = True