Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/refresh-baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0

- name: Install Python deps (with baseline-rebuild extra)
run: uv sync --frozen --extra baseline-rebuild
run: uv sync --frozen --no-install-project --extra baseline-rebuild

- name: Pre-pull dbserver image
run: docker pull iplweb/bpp_dbserver:psql-16.13 || true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
# full INSTALLED_APPS. No DB connection needed — it reads
# src/baseline-sql/baseline.meta.json and counts migration files.
# --frozen is intentional: uv.lock is the single source of truth.
run: uv sync --frozen
run: uv sync --frozen --no-install-project

- name: Check baseline freshness
# Fail loudly if migrations have outpaced the baseline pg_dump by
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ endif
all: prepare-developer-machine release ## UWAGA: pełna konfiguracja + release (uruchamia release!)

prepare-developer-machine-macos: ## Zainstaluj zależności systemowe na macOS (brew + uv sync)
uv sync --frozen --all-extras
uv sync --frozen --no-install-project --all-extras
brew install cairo pango gdk-pixbuf libffi gobject-introspection gtk+3
sudo ln -sf /opt/homebrew/opt/glib/lib/libgobject-2.0.0.dylib /usr/local/lib/gobject-2.0
sudo ln -sf /opt/homebrew/opt/pango/lib/libpango-1.0.dylib /usr/local/lib/pango-1.0
Expand All @@ -71,7 +71,7 @@ prepare-developer-machine-linux: ## Zainstaluj zależności systemowe na Linuksi
sudo apt install -y yarnpkg python3-dev libpq-dev \
libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libffi-dev \
libgirepository1.0-dev libgtk-3-dev
uv sync --frozen --all-extras
uv sync --frozen --no-install-project --all-extras

prepare-developer-machine: ## Zainstaluj zależności systemowe (auto-detekcja macOS/Linux)
ifeq ($(OS),Darwin)
Expand Down Expand Up @@ -251,7 +251,7 @@ coveralls-upload: ## Wyślij raport pokrycia do Coveralls
uv run coveralls

uv-sync: ## uv sync --all-extras (synchronizacja zależności Pythona)
uv sync --all-extras
uv sync --no-install-project --all-extras

tests: clean-pycache clean-coverage uv-sync tests-without-playwright tests-only-playwright combine-coverage js-tests coveralls-upload ## Pełny test suite (coverage + JS + Coveralls)

Expand Down
35 changes: 30 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ dev = [
"testcontainers[postgres]>=4.14.2"
]

[project.scripts]
"bpp-manage.py" = "django_bpp.manage_command:entry_point"

[project.entry-points."pytest11"]
testcontainers_bpp = "testcontainers_bpp.plugin"
# [project.scripts] i [project.entry-points] usuniete - BPP nie jest
# instalowany jako package (uv sync --no-install-project wszedzie).
# Plugin testcontainers_bpp ladowany przez `-p testcontainers_bpp.plugin`
# w pytest.ini addopts. Skrypt `bpp-manage.py` byl dead code (Makefile/
# Dockerfile uzywaja `python src/manage.py` bezposrednio).

[tool.setuptools.packages.find]
where = ["src"]
Expand Down Expand Up @@ -221,6 +221,31 @@ push = false
[tool.uv]
environments = ["python_version >= '3.10' and python_version < '3.15' and platform_python_implementation != 'PyPy'"]

# Polityka: KAZDA NOWA zewnetrzna zaleznosc powinna miec prebuilt wheel dla
# naszej macierzy (Linux x86_64 + macOS arm64, Python 3.10-3.14). Sdist
# wykonuje `setup.py` podczas instalacji - klasyczny wektor supply-chain
# (zlosliwy kod uruchomiony przez `uv sync`). Praktyka #1 z lirantal/
# pypi-security-best-practices.
#
# Pre-existing exceptions (sdist-only, accepted risk - audit kwiecien 2026):
# crispy-forms-foundation, cssmin, django-autocomplete-light, django-columns,
# django-static-sitemaps, django-tabular-permissions, langdetect, pylatexenc,
# pyoai, python-ldap, wsgiutils. Wymiana na wheel-publishing alternatywy
# tracked w follow-up. Patrz docs/SECURITY_PRACTICES.md.
#
# Egzekwowanie: brak hard-gate (`uv` nie ma czystego "wheel-only with
# exceptions" trybu - albo no-build globalnie, albo nic). Polegamy na:
# 1. PR review (PULL_REQUEST_TEMPLATE.md ma checkbox dla nowych dep)
# 2. Trivy CVE scan w docker-bake build (Faza 2 build-docker-images.yml)
# 3. uv-secure CVE scan w dependency-audit.yml workflow
#
# Workspace package (bpp-iplweb) NIE jest instalowany - `uv sync` wszedzie
# uzywa --no-install-project. Pytest plugin testcontainers_bpp ladowany
# przez `-p testcontainers_bpp.plugin` w pytest.ini addopts.
#
# Gdy nowa dep nie ma wheel: znajdz alternatywe LUB zglos wheel u
# maintainera. NIE dodawaj do listy wyjatkow bez review.

# Jawne zadeklarowanie indeksu PyPI jako jedynego, domyslnego zrodla
# pakietow. Chroni przed dependency confusion: gdyby kiedys pojawil sie
# prywatny indeks, ten wpis musi pozostac jawnie default = true a nowy
Expand Down
7 changes: 7 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ env =
DJANGO_ALLOW_ASYNC_UNSAFE=1

addopts =
# Plugin testcontainers_bpp.plugin musi byc wczytany PRZED conftest.py
# zeby zdazyl wstrzyknac DJANGO_BPP_DB_PORT/etc do os.environ przed
# zaladowaniem Django settings (conftest robi `from django.apps import
# apps`). `-p` to robi - flaga laduje plugin via pytest startup,
# zastepuje zlikwidowany [project.entry-points."pytest11"] wpis z
# pyproject.toml (wymagal editable install workspace roota).
-p testcontainers_bpp.plugin
--ignore=dist --ignore=build --ignore=node_modules --ignore=src/django_bpp/staticroot/ --ignore=src/ewaluacja2021/tests/
--reuse-db
#--cov=src/
Expand Down
1 change: 1 addition & 0 deletions src/bpp/newsfragments/+uv-binary-only.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BPP nie jest już instalowany jako Python package — wszystkie ``uv sync`` używają ``--no-install-project``. Usunięto ``[project.scripts]`` (``bpp-manage.py`` był dead code) i ``[project.entry-points."pytest11"]`` (workspace install nie jest potrzebny). Plugin ``testcontainers_bpp`` ładowany teraz przez ``-p testcontainers_bpp.plugin`` w ``pytest.ini`` addopts. Udokumentowano politykę wheel-only z 11 pre-existing sdist-only deps jako accepted exceptions w ``pyproject.toml`` ``[tool.uv]`` komentarzu.
Loading