Skip to content

Commit 2f6e81e

Browse files
chore: migrate to uv (#69)
* chore: migrate to uv * switch to higher version of python lektor and setuptools * fix the build in Github actions (needs --exclude .venv for flake8)
1 parent 8a9daf6 commit 2f6e81e

File tree

8 files changed

+613
-801
lines changed

8 files changed

+613
-801
lines changed

.github/workflows/lektor-build.yml

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,33 @@ jobs:
66
lektor-build:
77
name: Build page
88
runs-on: ubuntu-latest
9-
strategy:
10-
matrix:
11-
python-version: [3.9]
129
steps:
13-
- uses: actions/checkout@v2
14-
- name: Set up Python ${{ matrix.python-version }}
15-
uses: actions/setup-python@v2
16-
with:
17-
python-version: ${{ matrix.python-version }}
18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install poetry
22-
poetry config virtualenvs.create false
23-
poetry install --no-interaction --no-ansi --no-root
24-
- name: Lint with flake8
25-
run: |
26-
# stop the build if there are Python syntax errors or undefined names
27-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
28-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
29-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
30-
- name: Test with pytest
31-
run: |
32-
pytest
33-
- name: Build with Lektor
34-
run: |
35-
lektor build
10+
- uses: actions/checkout@v2
11+
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v5
14+
with:
15+
version: "0.6.13"
16+
17+
- name: "Set up Python"
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version-file: ".python-version"
21+
22+
- name: Install dependencies
23+
run: uv sync --all-extras --dev
24+
25+
- name: Lint with flake8
26+
run: |
27+
# stop the build if there are Python syntax errors or undefined names
28+
uv run flake8 . --count --exclude .venv --select=E9,F63,F7,F82 --show-source --statistics
29+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30+
uv run flake8 . --count --exclude .venv --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31+
32+
- name: Test with pytest
33+
run: |
34+
uv run pytest
35+
36+
- name: Build with Lektor
37+
run: |
38+
uv run lektor build

.github/workflows/lektor-deploy.yml

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,33 @@ jobs:
99
lektor-build:
1010
name: Build page
1111
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
python-version: [3.9]
1512
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install poetry
25-
poetry config virtualenvs.create false
26-
poetry install --no-interaction --no-ansi --no-root
27-
- name: Build with Lektor
28-
run: |
29-
lektor build
30-
- name: Setup SSH Keys and known_hosts and then deploy
31-
env:
32-
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
33-
run: |
34-
mkdir -p ~/.ssh
35-
ssh-keyscan 217.197.86.179 >> ~/.ssh/known_hosts
36-
ssh-keyscan webserver.c-base.org >> ~/.ssh/known_hosts
37-
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
38-
ssh-add - <<< "${{ secrets.LEKTOR_DEPLOY_PRODUCTION_KEY }}"
39-
lektor deploy
13+
- uses: actions/checkout@v2
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v5
17+
with:
18+
version: "0.6.13"
19+
20+
- name: "Set up Python"
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version-file: ".python-version"
24+
25+
- name: Install dependencies
26+
run: uv sync --all-extras --dev
27+
28+
- name: Build with Lektor
29+
run: |
30+
uv run lektor build
31+
32+
- name: Setup SSH Keys and known_hosts and then deploy
33+
env:
34+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
35+
run: |
36+
mkdir -p ~/.ssh
37+
ssh-keyscan 217.197.86.179 >> ~/.ssh/known_hosts
38+
ssh-keyscan webserver.c-base.org >> ~/.ssh/known_hosts
39+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
40+
ssh-add - <<< "${{ secrets.LEKTOR_DEPLOY_PRODUCTION_KEY }}"
41+
uv run lektor deploy

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ target/
7979
profile_default/
8080
ipython_config.py
8181

82-
# pyenv
83-
.python-version
84-
8582
# pipenv
8683
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
8784
# However, in case of collaboration, if having platform-specific dependencies or dependencies

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

poetry.lock

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

pyproject.toml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
[tool.poetry]
1+
[project]
22
name = "c-base-org-lektor"
3-
version = "0.1.0"
3+
version = "1.0.0"
44
description = "A c-base.org based in the lektor static site generator."
5-
authors = ["Uwe Kamper <[email protected]>"]
5+
authors = [{ name = "Uwe Kamper", email = "[email protected]" }]
6+
requires-python = ">=3.9"
67
license = "MIT"
8+
dependencies = [
9+
"setuptools >=78.1.0, <79",
10+
"Lektor >=3.3.12, <4",
11+
]
712

8-
[tool.poetry.dependencies]
9-
python = "^3.9"
10-
setuptools = "^78.1.0"
11-
lektor = "^3.3.7"
13+
# Needed for `uv pip install .` to work without a real Python package
14+
[tool.setuptools]
15+
py-modules = []
1216

13-
[tool.poetry.dev-dependencies]
14-
pytest = "^7.2.1"
15-
flake8 = "^5.0.4"
17+
[dependency-groups]
18+
dev = [
19+
"pytest >=7.2.1, <8",
20+
"flake8 >=5.0.4, <6",
21+
]
1622

17-
[build-system]
18-
requires = ["poetry>=0.12"]
19-
build-backend = "poetry.masonry.api"

shell.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ pkgs.mkShell {
44

55
packages = [
66
pkgs.python312
7-
pkgs.poetry
7+
pkgs.uv
88
pkgs.git
99
];
1010

1111
shellHook = ''
12-
poetry install --no-root
12+
uv pip install .
1313
source .venv/bin/activate
1414
'';
1515
}

0 commit comments

Comments
 (0)