Imported from labens-ufrn/suggestclasses (
AGENTS.md). Install upstream withnpx skills add labens-ufrn/suggestclasses. Copyright stays with the author.
Guide for Coding Agents
Local environment
-
Use the project virtual environment:
source .venv/bin/activate -
Create local configuration from the tracked template and load it before running Django commands or data scripts:
cp .env.example .env # Edit the values required by the local environment. source .env -
Do not commit
.env. It contains local credentials. Keep secrets only in local environment files or in CI secrets. -
DJANGO_SETTINGS_MODULE=suggestclasses.settingsandPYTHONPATHare set by.env; there is no separatepath.env.
Database and tests
-
The application reads the default database configuration from
DATABASE_NAME,DATABASE_USER,DATABASE_PASSWORD,DATABASE_HOST, andDATABASE_PORT. -
No custom Django test database name is configured. Django uses
test_<DATABASE_NAME>; for example,DATABASE_NAME=scdb_devusestest_scdb_dev. -
To let Django create and remove test databases, grant the database role
CREATEDB:ALTER ROLE sc_user WITH CREATEDB; -
On PostgreSQL 15+, ensure the role can create objects in the
publicschema of the test database. In this environment, the role also neededINHERIT:ALTER ROLE sc_user INHERIT; -
Run tests with:
python manage.py test --keepdb--keepdbpreserves the test database between executions.
CI
- The GitHub Actions workflow copies
.env.exampleto.envand then replaces the database credentials with those of its PostgreSQL service (postgres/postgres). - Keep
.env.examplefree of real credentials and compatible with the variables read bysuggestclasses/settings.py.
Session changes recorded
- Removed the unused
DATABASE_TESTvariable. It was not read by the Django settings, which rely on Django's default test database naming. - Added
.env.exampleat the repository root with placeholders for sensitive values. - Updated the README and CI workflow to use
.env.example. - Removed the obsolete
contrib/directory and allpath.envdocumentation. - Removed the obsolete
contrib/entry fromCONTRIBUTING.mdand the obsoletepath.envrule from.gitignore. - The test database permission issue was reproduced and resolved locally after
granting
CREATEDBandINHERITto the database role. - The test suite still has one unrelated pre-existing failure:
core/tests/test_historico.pyuses removedassertEquals; useassertEqualwhen addressing that test separately.