- The runner:
runner.pydynamically imports every module underultimatepythonand runs any callable namedmainwith zero parameters. Keepmain()functions parameterless, idempotent, and side-effect safe for CI. - Single-file runs are supported: modules are runnable with
python ultimatepython/<category>/<module>.py. Most modules already includeif __name__ == "__main__": main(). - Examples use plain Python stdlib only. Avoid adding new third-party dependencies without updating
requirements.txtandpyproject.toml. - Assertions are used as the primary verification mechanism inside examples (not pytest tests). Preserve their intent and messages when editing.
main()must be parameterless and not raise exceptions when run. Examples:ultimatepython/syntax/function.py,ultimatepython/classes/basic_class.py.- Module structure: docstring, helpers,
main()demonstrating usage via asserts,if __name__ == "__main__": main(). - Avoid long-running or destructive operations. For filesystem interactions, keep them local to ephemeral files and clean up after running.
- Use
ruffandisort(configured inpyproject.toml) for consistency with existing modules.
- New modules go under the appropriate folder—the runner discovers them automatically.
- If a change requires a new dependency, update
requirements.txtandpyproject.toml. - When updating
README.md, consider updating translations or note why they were skipped.
- Run all examples:
python runner.py - Run single example:
python ultimatepython/<category>/<module>.py - Coverage target: 80% (in
pyproject.toml)
- CI expects that running
runner.pyand executing eachmain()will succeed. Avoid adding code that requires network access, long sleeps, or interactive input. - Do not introduce external services or config files; this repo intentionally uses only the Python standard library.
runner.py— discovery and execution (pkgutil.walk_packages +mainlookups)pyproject.toml— formatting, linting, coverage rules