Skip to content

Commit

Permalink
doc: Use uv to manage Python
Browse files Browse the repository at this point in the history
uv seems to be the lesat hassle;
it will also handle installing Python if needed.
  • Loading branch information
abhinav committed Aug 26, 2024
1 parent c138535 commit e82c349
Show file tree
Hide file tree
Showing 8 changed files with 619 additions and 844 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true

env:
UV_VERSION: 0.3.3

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -26,19 +29,10 @@ jobs:
with:
go-version: 1.23

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pipenv
cache-dependency-path: doc/Pipfile.lock

- name: Install pipenv
run: pip install pipenv==2024.0.1

- name: Install Python dependencies
run: pipenv install --deploy
working-directory: doc
# This will handle installing Python and Python dependencies.
- name: Install uv
run: |
curl -LsSf "https://astral.sh/uv/${UV_VERSION}/install.sh" | sh
- name: Build
run: make build
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ The following tools are needed to work on this project:
- [Changie](https://changie.dev/):
We use Changie to manage the changelog.
You'll need this if you make user-facing changes.
- [pipenv](https://pipenv.pypa.io/en/latest/):
We use pipenv to manage Python dependencies for documentation generation.
- [uv](https://docs.astral.sh/uv/):
We use uv to manage Python dependencies for documentation generation.
You'll need this to preview changes to the doc/ directory.

## Making contributions
Expand All @@ -31,7 +31,7 @@ with the following notes:
```

- If you edit documentation in doc/,
install `pipenv` and run `make serve` to preview changes.
install `uv` and run `make serve` to preview changes.
- All commits must include meaningful commit messages.
- Test new features and bug fixes.
If it does not have a test, the bug is not fixed.
Expand Down
1 change: 1 addition & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/_site
/.cache
/bin
__pycache__
21 changes: 6 additions & 15 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,32 @@ MAKEFILE_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
export GOBIN = $(MAKEFILE_DIR)/bin
export PATH := $(GOBIN):$(PATH)

GS = bin/gs
FREEZE = bin/freeze

# Non-test Go files.
GO_SRC_FILES = $(shell find .. \
-path '*/.*' -prune -o \
'(' -type f -a -name '*.go' -a -not -name '*_test.go' ')' -print)

TOOLS = bin/pikchr bin/freeze
TOOLS = bin/pikchr bin/freeze bin/gs

CC ?= gcc

.PHONY: build
build: install generate
pipenv run mkdocs build
uv run mkdocs build

.PHONY: serve
serve: install generate
pipenv run mkdocs serve
uv run mkdocs serve

.PHONY: install
install: .cache/.install $(TOOLS)
install: $(TOOLS)

.PHONY: generate
generate: $(GS)
$(GS) dumpmd \
generate: bin/gs
bin/gs dumpmd \
--ref includes/cli-reference.md \
--shorthands includes/cli-shorthands.md

# Marker file for having run 'pipenv install'.
.cache/.install: Pipfile.lock
pipenv install
mkdir -p .cache
touch .cache/.install

bin/pikchr: cmd/pikchr/pikchr.c
mkdir -p $(dir $@)
gcc -DPIKCHR_SHELL -o $@ $< -lm
Expand Down
14 changes: 0 additions & 14 deletions doc/Pipfile

This file was deleted.

799 changes: 0 additions & 799 deletions doc/Pipfile.lock

This file was deleted.

11 changes: 11 additions & 0 deletions doc/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[tool.uv]
dev-dependencies = [
"mkdocs-material[imaging]>=9.5.33",
"markdown-exec[ansi]>=1.9.3",
"mkdocs-redirects>=1.2.1",
"mkdocs>=1.6.0",
"cairosvg>=2.7.1",
"pillow>=10.4.0",
]
[tool.uv.workspace]
members = []
591 changes: 591 additions & 0 deletions doc/uv.lock

Large diffs are not rendered by default.

0 comments on commit e82c349

Please sign in to comment.