Skip to content

Commit 9e9b399

Browse files
committed
Adding uv
1 parent 9008110 commit 9e9b399

File tree

8 files changed

+2554
-57
lines changed

8 files changed

+2554
-57
lines changed

.github/workflows/django.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,22 @@ jobs:
5555
cache-name: cache-pip-packages
5656
with:
5757
path: ~/.cache/pip
58-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/requirements/dev.txt') }}
58+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}
5959
restore-keys: |
6060
${{ runner.os }}-build-${{ env.cache-name }}-
6161
${{ runner.os }}-build-
6262
${{ runner.os }}-
6363
- name: Install Dependencies
64+
env:
65+
UV_PROJECT_ENVIRONMENT: "/home/runner/.local"
6466
run: |
6567
sudo apt update
6668
sudo apt install -y gdal-bin
6769
sudo apt install libsqlite3-mod-spatialite
6870
npm install
69-
pip install -r requirements/dev.txt
70-
pip install coveralls
71+
pip install uv
72+
uv sync --all-groups
73+
uv add coveralls
7174
- name: Run Tests
7275
env:
7376
PGPASSWORD: postgres
@@ -81,12 +84,30 @@ jobs:
8184
- name: Run Frontend Tests
8285
run: |
8386
npm test
87+
- name: Check Coverage File
88+
run: |
89+
echo "Checking if .coverage file exists..."
90+
if [ -f .coverage ]; then
91+
echo "✓ .coverage file exists"
92+
echo "File size: $(du -h .coverage | cut -f1)"
93+
echo "File type: $(file .coverage)"
94+
echo "First 100 bytes:"
95+
head -c 100 .coverage | hexdump -C
96+
echo ""
97+
echo "Testing coverage data..."
98+
.venv/bin/coverage report --skip-covered --skip-empty || echo "Coverage report failed"
99+
else
100+
echo "✗ .coverage file NOT found!"
101+
echo "Current directory: $(pwd)"
102+
echo "Looking for coverage files..."
103+
find . -name ".coverage*" -type f 2>/dev/null || echo "No coverage files found"
104+
exit 1
105+
fi
84106
- name: Coveralls Python
85-
uses: coverallsapp/github-action@v2
86-
with:
87-
flag-name: python
88-
parallel: true
89-
file: .coverage
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
run: |
110+
.venv/bin/coveralls --service=github --parallel --flag-name=python
90111
- name: Coveralls JS
91112
uses: coverallsapp/github-action@v2
92113
with:

CHANGELOG.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
This project (not yet) adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Fixed
11+
12+
- Images remain in the upload section through validation
13+
14+
### Changed
15+
16+
- Using uv as python package manager now
17+
818
## mB-v2509.1
919

1020
### Changed
@@ -373,9 +383,3 @@ count as labels)
373383
- actions: only create actions for phases and projects if the project is not
374384
a draft (!1437)
375385
- reformat CHANGELOG.md
376-
377-
## Unreleased
378-
379-
### Fixed
380-
381-
- Images remain in the upload section through validation

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
all: help
22

3-
VIRTUAL_ENV ?= venv
3+
VIRTUAL_ENV ?= .venv
44
SOURCE_DIRS = adhocracy4 tests
55
NODE_BIN = node_modules/.bin
66
ARGUMENTS=$(filter-out $(firstword $(MAKECMDGOALS)), $(MAKECMDGOALS))
@@ -30,9 +30,12 @@ help:
3030
.PHONY: install
3131
install:
3232
npm install
33-
if [ ! -f $(VIRTUAL_ENV)/bin/python3 ]; then python3 -m venv $(VIRTUAL_ENV); fi
34-
$(VIRTUAL_ENV)/bin/pip install -r requirements/dev.txt
35-
33+
@if [ ! -f $(VIRTUAL_ENV)/bin/pip ]; then python3 -m venv $(VIRTUAL_ENV); fi
34+
@if ! command -v uv --version; then \
35+
$(VIRTUAL_ENV)/bin/pip install pipx; \
36+
$(VIRTUAL_ENV)/bin/pipx install uv; \
37+
fi
38+
uv sync --all-groups
3639
.PHONY: clean
3740
clean:
3841
if [ -f package-lock.json ]; then rm package-lock.json; fi

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,26 @@ To try it out yourself, best start with [a+][https://github.com/liqd/adhocracy-p
2424
git clone https://github.com/liqd/adhocracy4.git
2525
cd adhocracy4
2626
make install
27+
# make install adds an installation of uv in a global virtual env via pipx
28+
# Uv install the packages to .venv
2729

28-
## Start virtual environment
30+
## Use Make
31+
make test
32+
make help
33+
34+
## Development
35+
To add a new Library use uv
2936
```
30-
source venv/bin/activate
37+
uv add module
3138
```
32-
## Check if tests work
39+
this automaticly updates pyproject.toml and uv.lock
40+
41+
## Virtual Enviroment
42+
if you want to do something inside the venv manually use
3343
```
34-
make test
44+
uv run python manage.py ...
3545
```
46+
(which invokes .venev/bin/python manage.py ... )
3647

3748

3849

pyproject.toml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies = [
2525
"django-allauth",
2626
"django-autoslug",
2727
"django-background-tasks",
28-
"django-ckeditor-5",
28+
"django-ckeditor-5 @ https://github.com/liqd/django-ckeditor-5/releases/download/v0.2.11-liqd/django_ckeditor_5-0.2.11-py3-none-any.whl",
2929
"django-enumfield",
3030
"django-filter",
3131
"django-multiselectfield",
@@ -44,6 +44,21 @@ dependencies = [
4444
]
4545
dynamic = ["version"]
4646

47+
[dependency-groups]
48+
dev = [
49+
"black",
50+
"factory-boy",
51+
"Faker",
52+
"flake8",
53+
"freezegun",
54+
"isort",
55+
"psycopg[binary]",
56+
"pytest",
57+
"pytest-cov",
58+
"pytest-django",
59+
"pytest-factoryboy",
60+
]
61+
4762
[project.urls]
4863
"Homepage" = "https://github.com/liqd/adhocracy4"
4964
"Bug Tracker" = "https://github.com/liqd/adhocracy4/issues"
@@ -55,7 +70,7 @@ include = ["adhocracy4"]
5570

5671
[tool.isort]
5772
profile = "black"
58-
skip = ["node_modules", "venv"]
73+
skip = ["node_modules", "venv", ".venv"]
5974
skip_glob = ["*/migrations/*.py"]
6075
known_first_party = ["adhocracy4", "tests"]
6176
force_single_line = true

requirements/base.txt

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

requirements/dev.txt

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

0 commit comments

Comments
 (0)