1. Reproducible environment
Objectives
- separate runtime, database, and source code
- initialize a disposable training database
- repeat commands without depending on hidden workstation state
Mental model
A development environment is part of the product. If another person cannot recreate it, a passing test on one laptop is weak evidence.
Guided practice
- Create a dedicated virtual environment or development container.
- Install the server and modules from the same Tryton series.
- Use SQLite for the first exercise and PostgreSQL before validating production behavior.
- Create a database, activate the module, and keep the exact commands in the project README.
Minimal example
python -m venv .venv
. .venv/bin/activate
python -m pip install "trytond~=8.0.0" "trytond_company~=8.0.0"
export TRYTOND_DATABASE_URI=sqlite://
trytond-admin -d training --all
trytond -d training
How to read the example
Replace VERSION with the selected documentation series. The compatible-release constraint keeps the package inside that series. For PostgreSQL, configure TRYTOND_DATABASE_URI explicitly and never commit credentials.
Exercise
Recreate the database from an empty directory, record the server URL, and prove that a second developer can repeat the process.
Run the exercise first with a minimal valid case, then add an invalid case and turn both into repeatable tests.
Verifiable result
The server starts, the database can be selected, and no command depends on a globally installed Tryton package.
Common mistakes
- mixing server and module series
- using production data for exercises
- assuming SQLite proves PostgreSQL migrations
- storing database secrets in Git
Ready-to-advance criteria
- I can explain the concepts without looking at the code.
- Valid and invalid cases have tests.
- I tested with a non-administrative user.
- I know how to upgrade and restore the training database.
Version and references
Series 8.0 requires at least Python 3.10 according to official metadata. The official server declares its project with pyproject.toml; new modules should use modern packaging and verify wheel contents. Do not confuse this historical minimum with the Python version certified by your organization.
This edition pins examples and dependencies to series 8.0. Check the official 8.0 tutorial, server API, and source branch before moving a pattern to production.