Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
980d7c9
chore: adapt Makefile and docker-compose for docker compose v2 and mo…
lecovi Sep 19, 2026
0dc378b
refactor: upgrade to Python 3.11 and Django 4.2 LTS, fixing translati…
lecovi Sep 19, 2026
176be0c
fix: set DEFAULT_AUTO_FIELD to resolve W042 system check warnings on …
lecovi Sep 19, 2026
1407af2
fix: remove obsolete version from docker-compose and generate missing…
lecovi Sep 19, 2026
4d81f5f
chore: upgrade to Python 3.13 and psycopg v3
lecovi Sep 19, 2026
5643a36
chore: upgrade Python to 3.13, psycopg to v3, and PostgreSQL to 16
lecovi Sep 19, 2026
9f316d7
chore: upgrade PostgreSQL to 17
lecovi Sep 19, 2026
f2c3936
chore: upgrade PostgreSQL to 18
lecovi Sep 19, 2026
65db154
chore: upgrade to Python 3.14 and latest psycopg
lecovi Sep 19, 2026
0be270d
Fix compatibility issues with Python 3.14 and missing dependencies
lecovi Sep 19, 2026
2394533
Migrate from pip and requirements.txt to uv and pyproject.toml
lecovi Sep 20, 2026
5a1c58c
Updating CI from master
lecovi Oct 3, 2026
f77d82c
Adds removing volume for make clean command
lecovi Oct 3, 2026
c84fc9d
Updating deps for Python 3.11 and Postgres 16
lecovi Oct 3, 2026
e8ed2da
Updating CI
lecovi Oct 3, 2026
db9d049
Updating CI
lecovi Oct 3, 2026
e26f689
Merge branch 'feature/python-3.13-modern-psycopg' into feature/uv-dep…
lecovi Oct 3, 2026
95ce60c
Upgrade Django to 6.1.1, integrate uv with lockfile, and clean up req…
lecovi Oct 3, 2026
2abea98
Update GitHub Actions workflow to install dependencies via uv from py…
lecovi Oct 3, 2026
ad5f8f3
Complete issue #302: Improve members report with summary chart, filte…
lecovi Oct 3, 2026
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
6 changes: 3 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python 3.9
- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: 3.14
- name: Bootstrap everything
run: |
docker compose up -d
# Silence exec errors while postgres is mid-restart on initdb; just retry until it's ready.
for i in $(seq 1 60); do docker compose exec -T postgres pg_isready -U postgres >/dev/null 2>&1 && break; sleep 1; done
docker compose exec -T web pip install -r /code/config/requirements-dev.txt
docker compose exec -T web uv pip install --system --no-cache -e /code[dev]
- name: Run tests
run: |
docker compose exec -T web ./manage.py test -v2 --noinput
48 changes: 48 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# AGENTS.md

This file provides core instructions for OpenCode agents working in the `asoc_members` repository (Python Argentina Membership Management System).

## Build, Test, and Development Commands

- **Bootstrap / Setup**: `make bootstrap` (first time or after dependency changes; runs `docker compose up -d` and installs `config/requirements-dev.txt` / dependencies in the container)
- **Run Locally**: `make run` (starts services, runs migrations, and serves on `0.0.0.0:8127`)
- **Run Tests**: `make test` (runs full Django test suite via Docker)
- Focused Test: `make test ARGS="-k members.tests.ReportCompleteTests"`
- **Stop Services**: `make stop`
- **Clean Environment**: `make clean`
- **Django Management & Utilities**:
- Django shell plus: `make shell_plus`
- Docker shell: `make dockershell`
- Create superuser: `make createsuperuser`
- Make migrations: `make migrations`
- Run migrations: `make migrate`
- Load test data: `make load_members_testdata`
- Load providers test data: `make load_providers_test_data`

## Architecture & Codebase Layout

- **Framework**: Django web application running inside Docker (`docker-compose.yml`) with `django-configurations`.
- **Entrypoint**: `website/manage.py`.
- **Core Apps & URL Map**:
- `website/members/`: Main business logic for membership management, payments (MercadoPago integrations, invoicing, quotas, reports).
- Routes (`/`): `/solicitud-alta/`, `/reportes/`, `/reportes/deudas`, `/reportes/completos`, `/reportes/incompletos`, `/reportes/ingcuotas`, `/reportes/ingdinero`, `/reportes/miembros`, `/reportes/miembros/<pk>/`.
- `website/events/`: Management of events, sponsors, expenses, and providers.
- Routes (`/eventos/`): `/eventos/`, `/eventos/eventos/`, `/eventos/eventos/<pk>/configuracion/`, `/eventos/eventos/<pk>/patrocinios/`, `/eventos/eventos/<pk>/gastos/`, etc.
- `website/pyar_auth/`: Authentication views/forms.
- Routes (`/cuentas/`): `/cuentas/login/`, `/cuentas/logout/`, `/cuentas/perfil/`, `/cuentas/clave/`, etc.
- `website/website/`: Django project settings (`settings.py`), URL router (`urls.py`), and WSGI config.
- **Configuration**: Environment variables managed via `.env.dist` / `local_settings.py.example`.
- **Docker Setup**: Application runs inside Docker containers (`docker compose`). Use `make` commands.

## Coding Conventions & Gotchas

- **PEP8 & Style**: PEP8 enforced via `.flake8` (line width limit: 99 columns).
- **Language**:
- Variable names, docstrings, and code comments must be in **English**.
- Docstrings must start with an uppercase letter and end with a period (`"""This is a docstring."""`).
- **URLs** must be written in **Spanish** (for SEO purposes, per issue #163).
- **Database & Migrations**: Every model change requires a corresponding migration (`make migrations`).
- **Tests**: Add unit/integration tests for new features and bug fixes when possible.
- **Versioning & Releases**:
- When preparing a new release for production, tag the commit in git (e.g. `git tag -a vX.Y.Z -m "Release vX.Y.Z"`).
- Update the `image` tag in `docker-compose.yml` (e.g. `image: asoc_members:vX.Y.Z`) to keep the Docker image version in sync with the git tag.
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
FROM python:3.9
FROM python:3.14-slim
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /code:$PYTHONPATH

RUN mkdir /code
RUN mkdir /config

# Install dependencies
RUN apt-get update && apt-get install -y inkscape && apt-get clean
COPY /config/requirements.txt /config/
RUN pip install --no-cache-dir -r /config/requirements.txt
RUN apt-get update && apt-get install -y inkscape wget wget unzip zlib1g-dev libjpeg-dev libpq-dev gcc && apt-get clean

# Install uv and dependencies
COPY --from=ghcr.io/astral-sh/uv:0.5.29 /uv /uv* /bin/
WORKDIR /code
COPY pyproject.toml uv.lock /code/
RUN uv sync --system --frozen --no-dev || uv pip install --system --no-cache -e .[dev]

# Copy code
WORKDIR /code
Expand All @@ -21,6 +25,6 @@ WORKDIR /code/website
# for more info: https://github.com/PyAr/asoc_members/issues/133 )
RUN sed -i 's/CipherString = DEFAULT@SECLEVEL=2/CipherString = DEFAULT@SECLEVEL=1/' /etc/ssl/openssl.cnf

# Bring pyafipws branch and install it's dependencies
# Bring pyafipws branch and install its dependencies
RUN wget https://github.com/PyAr/pyafipws/archive/main.zip && unzip main.zip && mv pyafipws-main pyafipws
RUN pip install --no-cache-dir -r /code/website/pyafipws/requirements.txt
RUN uv pip install --system --no-cache -r /code/website/pyafipws/requirements.txt
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,37 @@ help:
@echo "load_members_testdata -- populate the DB with members"
@echo "load_providers_test_data -- populate the DB with providers"

RUN=docker-compose exec web
RUN=docker compose exec web
MANAGE=${RUN} ./manage.py

# rarely used: only first time project is cloned, or when infrastructure dependencies change
bootstrap:
docker-compose up -d
${RUN} pip install -r /code/config/requirements-dev.txt
docker compose up -d
${RUN} uv pip install --system -e /code[dev]

# run all the tests; to avoid migrations everytime and run only some of them, do for example:
# make test ARGS="-k members.tests.ReportCompleteTests"
test:
docker-compose start
docker compose start
${MANAGE} test -v2 --noinput $(ARGS)

# normally used to run the service locally
run:
docker-compose start
docker compose start
${MANAGE} migrate
${MANAGE} runserver 0.0.0.0:8127

# normally used to turn the services off
stop:
docker-compose stop
docker compose stop

# rarely used: only when we want to stop and remove everything created by bootstrapping
clean:
docker-compose stop
docker-compose down --rmi local
docker compose stop
docker compose down --rmi local -v

ps:
docker-compose ps
docker compose ps

createsuperuser:
${MANAGE} createsuperuser
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ Example to install in Debian/Ubuntu:
sudo apt install python3 docker docker-compose


## Development
## Managing Dependencies with uv

This project uses `uv` and `pyproject.toml` for dependency management instead of `pip` and `requirements.txt`.

- **Adding a new dependency:** Add it to the `dependencies` list in `pyproject.toml`.
- **Adding a development dependency:** Add it to the `[dependency-groups]` `dev` section in `pyproject.toml`.
- **Updating dependencies:** Run `uv pip compile` or install the updated package version inside the container via `uv`.

These are the normal commands used for development:

Expand Down
6 changes: 0 additions & 6 deletions config/requirements-dev.txt

This file was deleted.

18 changes: 0 additions & 18 deletions config/requirements.txt

This file was deleted.

9 changes: 3 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
version: '2'

volumes:
pgdata:

services:
postgres:
# Pinned: postgres 18+ changed its expected data dir layout and refuses to
# start against a volume mounted directly at /var/lib/postgresql/data.
image: postgres:16
image: postgres:18
restart: always
environment:
- POSTGRES_DB=memberships
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=secret
volumes:
- pgdata:/var/lib/postgresql/data/
- pgdata:/var/lib/postgresql/data/data/

web:
build: .
image: asoc_members:latest
ports:
- "8127:8127"
volumes:
Expand Down
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[build-system]
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "asoc_members"
version = "0.1.0"
description = "Memberships management for the Python Argentina's ONG"
readme = "README.md"
requires-python = ">=3.12"
authors = [
{ name = "Asociación Civil Python Argentina", email = "presidencia@ac.python.org.ar" }
]
classifiers = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
]
dependencies = [
"httplib2>=0.22.0",
"certg==4.2",
"certifi>=2020.4.5.1",
"oauth2client==4.1.3",
"django-configurations==2.5.1",
"django-crispy-forms==2.1",
"crispy-bootstrap4==2024.1",
"logassert==4",
"factory_boy==3.2.0",
"flake8==3.7.7",
"pytz==2024.1",
"diff-match-patch==20230430",
"django-extensions==3.2.3",
"django-reversion-compare==0.16.0",
"django-storages[azure]==1.14.6",
"django==6.1.1",
"google-api-python-client==2.149.0",
"gunicorn==23.0.0",
"mercadopago==3.1.1",
"oauth2client==4.1.3",
"Pillow==10.4.0",
"psycopg[binary]>=3.2.10",
"python-stdnum==1.20",
"rapidtables==0.1.12",
"sentry-sdk==2.16.0",
]

[project.optional-dependencies]
dev = [
"ipdb==0.13.9",
"ipython==8.10.0",
"logassert==4",
"factory_boy==3.2.0",
"flake8==3.7.7",
]
Loading
Loading