Skip to content

chore: migrate to uv #69

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 3 commits into from
Apr 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 29 additions & 26 deletions .github/workflows/lektor-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,33 @@ jobs:
lektor-build:
name: Build page
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
poetry install --no-interaction --no-ansi --no-root
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
- name: Build with Lektor
run: |
lektor build
- uses: actions/checkout@v2

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.13"

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
uv run flake8 . --count --exclude .venv --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
uv run flake8 . --count --exclude .venv --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Test with pytest
run: |
uv run pytest

- name: Build with Lektor
run: |
uv run lektor build
56 changes: 29 additions & 27 deletions .github/workflows/lektor-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,33 @@ jobs:
lektor-build:
name: Build page
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
poetry install --no-interaction --no-ansi --no-root
- name: Build with Lektor
run: |
lektor build
- name: Setup SSH Keys and known_hosts and then deploy
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
ssh-keyscan 217.197.86.179 >> ~/.ssh/known_hosts
ssh-keyscan webserver.c-base.org >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.LEKTOR_DEPLOY_PRODUCTION_KEY }}"
lektor deploy
- uses: actions/checkout@v2

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.13"

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Build with Lektor
run: |
uv run lektor build

- name: Setup SSH Keys and known_hosts and then deploy
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
ssh-keyscan 217.197.86.179 >> ~/.ssh/known_hosts
ssh-keyscan webserver.c-base.org >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.LEKTOR_DEPLOY_PRODUCTION_KEY }}"
uv run lektor deploy
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ target/
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
730 changes: 0 additions & 730 deletions poetry.lock

This file was deleted.

29 changes: 16 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
[tool.poetry]
[project]
name = "c-base-org-lektor"
version = "0.1.0"
version = "1.0.0"
description = "A c-base.org based in the lektor static site generator."
authors = ["Uwe Kamper <me@uwekamper.de>"]
authors = [{ name = "Uwe Kamper", email = "uk@c-base.org" }]
requires-python = ">=3.9"
license = "MIT"
dependencies = [
"setuptools >=78.1.0, <79",
"Lektor >=3.3.12, <4",
]

[tool.poetry.dependencies]
python = "^3.9"
setuptools = "^78.1.0"
lektor = "^3.3.7"
# Needed for `uv pip install .` to work without a real Python package
[tool.setuptools]
py-modules = []

[tool.poetry.dev-dependencies]
pytest = "^7.2.1"
flake8 = "^5.0.4"
[dependency-groups]
dev = [
"pytest >=7.2.1, <8",
"flake8 >=5.0.4, <6",
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
4 changes: 2 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ pkgs.mkShell {

packages = [
pkgs.python312
pkgs.poetry
pkgs.uv
pkgs.git
];

shellHook = ''
poetry install --no-root
uv pip install .
source .venv/bin/activate
'';
}
Loading