Skip to content

Commit 6b002db

Browse files
authored
Merge pull request #169 from pradyunsg/updates
Update dependencies and other installation improvements
2 parents 123b61b + 0f3b295 commit 6b002db

8 files changed

+59
-105
lines changed

.github/workflows/ci.yaml

+5-28
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,15 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15-
- uses: actions/setup-python@v5
16-
- uses: pre-commit/[email protected]
15+
- uses: astral-sh/setup-uv@v5
16+
- run: uvx pre-commit run --all-files --show-diff-on-failure
1717

1818
build:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v3
22-
- uses: actions/setup-python@v4
23-
with:
24-
python-version: "3.10"
25-
26-
# pip caching
27-
- name: Locate pip's cache
28-
id: pip-cache
29-
run: echo "::set-output name=dir::$(pip cache dir)"
30-
31-
- name: Persist cache across runs
32-
uses: actions/cache@v4
33-
with:
34-
path: ${{ steps.pip-cache.outputs.dir }}
35-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
36-
restore-keys: |
37-
${{ runner.os }}-pip-
38-
39-
# Install runtime dependencies
40-
- name: Upgrade pip
41-
run: pip install --upgrade pip
42-
- name: Install nox
43-
run: pip install nox
44-
45-
- name: Render entire site
46-
run: nox -s publish
21+
- uses: actions/checkout@v4
22+
- uses: astral-sh/setup-uv@v5
23+
- run: uvx nox --default-venv-backend uv -s publish
4724

4825
# Publish!
4926
- name: Deploy to GitHub Pages

.pre-commit-config.yaml

+26-31
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,29 @@
11
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.9.10
4+
hooks:
5+
- id: ruff
6+
- id: ruff-format
27

3-
- repo: https://github.com/psf/black
4-
rev: 23.1.0
5-
hooks:
6-
- id: black
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v5.0.0
10+
hooks:
11+
- id: check-builtin-literals
12+
- id: check-added-large-files
13+
- id: check-case-conflict
14+
- id: check-toml
15+
- id: check-yaml
16+
- id: debug-statements
17+
- id: end-of-file-fixer
18+
- id: forbid-new-submodules
19+
- id: trailing-whitespace
720

8-
- repo: https://github.com/timothycrosley/isort
9-
rev: 5.12.0
10-
hooks:
11-
- id: isort
12-
13-
- repo: https://github.com/pre-commit/pre-commit-hooks
14-
rev: 'v4.4.0'
15-
hooks:
16-
- id: check-builtin-literals
17-
- id: check-added-large-files
18-
- id: check-case-conflict
19-
- id: check-toml
20-
- id: check-yaml
21-
- id: debug-statements
22-
- id: end-of-file-fixer
23-
- id: forbid-new-submodules
24-
- id: trailing-whitespace
25-
26-
- repo: local
27-
hooks:
28-
- id: sort-json
29-
name: Sort theme.json
30-
language: python
31-
pass_filenames: false
32-
types: []
33-
always_run: true
34-
entry: python tools/sort-json.py
21+
- repo: local
22+
hooks:
23+
- id: sort-json
24+
name: Sort theme.json
25+
language: python
26+
pass_filenames: false
27+
types: []
28+
always_run: true
29+
entry: python tools/sort-json.py

noxfile.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import shutil
2-
import subprocess
3-
import sys
4-
51
import nox
62

73

84
@nox.session
95
def update(session):
106
session.install("pip-tools")
11-
session.run("pip-compile")
7+
session.run("pip-compile", "requirements.in", "--upgrade")
128

139

1410
@nox.session(name="list", reuse_venv=True)

requirements.txt

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
#
2-
# This file is autogenerated by pip-compile with python 3.10
3-
# To update, run:
2+
# This file is autogenerated by pip-compile with Python 3.13
3+
# by the following command:
44
#
5-
# pip-compile
5+
# pip-compile requirements.in
66
#
7-
colorama==0.4.4
8-
# via rich
9-
commonmark==0.9.1
10-
# via rich
11-
greenlet==1.1.2
7+
greenlet==3.1.1
128
# via playwright
13-
jinja2==2.11.3
9+
jinja2==3.1.6
1410
# via -r requirements.in
15-
markupsafe==1.1.1
11+
markdown-it-py==3.0.0
12+
# via rich
13+
markupsafe==3.0.2
1614
# via jinja2
17-
pillow==10.2.0
15+
mdurl==0.1.2
16+
# via markdown-it-py
17+
pillow==11.1.0
1818
# via -r requirements.in
19-
playwright==1.17.0
19+
playwright==1.50.0
2020
# via -r requirements.in
21-
pyee==8.1.0
21+
pyee==12.1.1
2222
# via playwright
23-
pygments==2.15.0
23+
pygments==2.19.1
2424
# via rich
25-
rich==10.1.0
25+
rich==13.9.4
2626
# via -r requirements.in
27-
typing-extensions==3.7.4.3
28-
# via rich
29-
websockets==10.1
30-
# via playwright
27+
typing-extensions==4.12.2
28+
# via pyee

src/generate_sample_sites.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from pathlib import Path
66

77
import rich.progress
8+
import rich.traceback
89
from jinja2 import Template
910

1011
from .constants import BUILD, DESTINATION, TEMPLATES
@@ -76,7 +77,7 @@ async def generate_site(
7677
]
7778
raise Exception("\n".join(message))
7879
except Exception as e:
79-
progress.log(f"Fail: [red]{theme.name}[reset]\n\t{e}")
80+
progress.log(f"Fail: [red]{theme.name}[reset]", rich.traceback.Traceback())
8081
destination_path.mkdir(parents=True, exist_ok=True)
8182
(destination_path / "index.html").write_text(get_error_page(theme, e))
8283
else:

src/generate_screenshots.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"""Script to generate the screenshots for all the themes."""
22

33
import asyncio
4-
import contextlib
54
import functools
65
import io
7-
import textwrap
86
from typing import Dict, Tuple
97

108
import rich

src/isolation.py

+7-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
"""Manage isolated virtual environments for each build.
2-
"""
1+
"""Manage isolated virtual environments for each build."""
32

43
import asyncio
5-
import os
6-
import shutil
7-
import subprocess
84
import sys
95

106
from .constants import BUILD
@@ -28,9 +24,10 @@ async def create(self, *, delete=False):
2824
return
2925

3026
process = await asyncio.create_subprocess_exec(
31-
sys.executable,
32-
"-m",
27+
"uv",
3328
"venv",
29+
"--python",
30+
sys.executable,
3431
str(self.path),
3532
stdout=asyncio.subprocess.DEVNULL,
3633
stderr=asyncio.subprocess.DEVNULL,
@@ -40,19 +37,13 @@ async def create(self, *, delete=False):
4037
raise RuntimeError("Could not create virtual environment.")
4138

4239
async def install(self, *args, **kwargs):
43-
returncode, _ = await self.run("pip", "install", *args, **kwargs)
40+
returncode, _ = await self.run("uv", "pip", "install", *args, **kwargs)
4441
if returncode:
4542
raise RuntimeError(f"Could not install: {' '.join(args)}")
4643

47-
async def run(self, *args, external=False, env={}):
48-
assert args
49-
50-
locations = [str(path.resolve()) for path in self.bin_paths]
51-
executable_path = shutil.which(args[0], path=os.pathsep.join(locations))
52-
44+
async def run(self, *args, env=None):
5345
process = await asyncio.create_subprocess_exec(
54-
executable_path,
55-
*args[1:],
46+
*args,
5647
env=env,
5748
stdout=asyncio.subprocess.PIPE,
5849
stderr=asyncio.subprocess.PIPE,

src/templates/conf.template.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import textwrap
2-
31
from docutils import nodes
4-
from docutils.parsers.rst import Directive, directives
2+
from docutils.parsers.rst import Directive
53
from docutils.statemachine import StringList
64

75
# -- Common stuff -------------------------------------------------------------

0 commit comments

Comments
 (0)