Imported from Aleks-Ya/yaal_examples (
Python+/Python3/AGENTS.md). Install upstream withnpx skills add Aleks-Ya/yaal_examples --skill Python3. Copyright stays with the author.
AGENTS: How to be productive in this codebase
This file is a compact, actionable guide for AI coding agents to get productive quickly.
Key points
- Project layout: top-level
src/contains importable code — the apps (apps.<name>...) and the shared helpers (yaal_helpers.*). Tests usepythonpath = src tests(seepytest.ini). - Python runtime: targets Python 3.12 (project README shows pyenv -> 3.12.12). Use the same to support modern typing syntax.
- Large native / ML deps:
requirements.txtis large and includes packages requiring OS deps (e.g.libkrb5-devfor phoenixdb,cmakefor onnx). See project README lines 5-11.
Quick setup (commands)
- Create and activate env with pyenv (as in
README.md), then:
pip install -U pip -r requirements.txt
pytest # runs tests excluding integration tests (pytest.ini addopts)
pytest -m "integration" # run integration tests
python -m apps.bytes_to_human_str.bytes_to_human_str # example runnable module
Important conventions and patterns
- Imports: modules under
src/are imported using package roots likeapps.<name>.... Tests rely on this (seepytest.ini). - File-relative helpers: use
yaal_helpers.current_path::get_current_dir()andget_file_in_current_dir()when code needs the caller's file directory rather than__file__.- Example: many small utilities in
src/apps/*use Path-based operations and rely on these helpers for tests.
- Example: many small utilities in
- Temp helpers:
yaal_helpers.temp_helper::TempPathprovidestemp_path_absent()anddir_exists()used by tests (seetests/conftest.pyfixturetemp_path_absent). Prefer using these fixtures over creating temp files manually. - Both live in
src/yaal_helpers/and are also installed editable into every environment here (rootpyproject.toml,-e .inrequirements.txt, a[tool.uv.sources]path entry in each uv project), so they import outside pytest too. Seesrc/yaal_helpers/README.md. - Typing / style: code uses modern Python typing (PEP 585 builtin generics like
list[str],dict[...]) and private-name patterns (__double-underscore methods). Target Python 3.12+ when editing.
Testing / debugging notes
- Tests are configured in
pytest.ini: pythonpath=src testsand default addopts excludesintegrationtests. - To debug a failing unit test, run the single test with
pytest -k <expr> -qfrom repository root sosrcis on path via pytest.ini. - Many modules are small, pure-Python utilities; you can run simple modules directly with
python -m apps.<module>.<script>if they include a__main__or simple test harness.
Integration & environment notes
- Some apps interact with system services (e.g.,
src/apps/inactivity_time/has systemd.service/.desktopexamples) — these expect a Linux desktop environment. requirements.txtcontains an extra index URL (line near end) for the privatet-tech-investmentspackage.tests/module/thirdparty/t-tech-investments/pyproject.tomlscopes that same index to just that one package via[[tool.uv.index]]+[tool.uv.sources].
Where to look first (high-value files)
pytest.ini— test import/runtime config and markersrequirements.txt— full dependency list and extra index URLsrc/yaal_helpers/— theyaal-helperspackage (current_path,temp_helper), used by tests and scriptssrc/apps/— the collection of small applications. Pick one (e.g.libre_office_draw_search/) to learn patterns: typed data classes, parser + searcher separation (odg_parser.py+searcher.py).tests/— examples of how modules are exercised; mirrors project conventions.
What not to assume
- There is no centralized packaging or published distribution; many scripts are standalone utilities under
src/apps. - Some packages in requirements are heavy or platform-specific (ML, C-extensions). Prefer running unit tests first without optional heavy deps.
Example actionable tasks for an agent
- Add a unit test: put under
tests/and import modules asfrom apps.<name> import .... - Run tests locally with
pytestfrom project root. There is no CI in this repository.
References
- README.md (project setup)
- pytest.ini (tests)
- requirements.txt (dependencies)
- src/yaal_helpers/ (the yaal-helpers package: current_path, temp_helper)
- src/apps/libre_office_draw_search/ (representative app)