|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | + |
| 5 | +This repository packages `cfdiclient`, a Python client for SAT CFDI web services. |
| 6 | +Source code lives in `cfdiclient/`, with one module per service concern: authentication |
| 7 | +(`autenticacion.py`), signing (`signer.py`, `fiel.py`), mass download flows |
| 8 | +(`solicitadescarga*.py`, `verificasolicituddescarga.py`, `descargamasiva.py`), and |
| 9 | +shared helpers (`utils.py`, `webservicerequest.py`). SOAP/XML templates are bundled |
| 10 | +beside the modules as `cfdiclient/*.xml`; keep template edits synchronized with the |
| 11 | +Python code that loads them. Tests are in `tests/`. Example usage is in |
| 12 | +`README.md` and `ejemplo_completo.py`. Sample certificate files are under |
| 13 | +`certificados/` and should not be replaced with real private credentials. |
| 14 | + |
| 15 | +## Build, Test, and Development Commands |
| 16 | + |
| 17 | +Create an isolated environment and install development dependencies: |
| 18 | + |
| 19 | +```bash |
| 20 | +python -m venv .venv |
| 21 | +source .venv/bin/activate |
| 22 | +python -m pip install -e ".[dev]" |
| 23 | +``` |
| 24 | + |
| 25 | +Run the test suite: |
| 26 | + |
| 27 | +```bash |
| 28 | +pytest |
| 29 | +``` |
| 30 | + |
| 31 | +Build distributable artifacts in `dist/`: |
| 32 | + |
| 33 | +```bash |
| 34 | +python -m build |
| 35 | +``` |
| 36 | + |
| 37 | +Optionally lint with the included Pylint configuration: |
| 38 | + |
| 39 | +```bash |
| 40 | +pylint --rcfile=pylint.rc cfdiclient tests |
| 41 | +``` |
| 42 | + |
| 43 | +## Coding Style & Naming Conventions |
| 44 | + |
| 45 | +Follow `.editorconfig`: UTF-8, LF line endings, final newline, and 4-space |
| 46 | +indentation for Python. Prefer clear snake_case for functions, variables, and module |
| 47 | +names. Preserve the existing public API names and Spanish SAT domain terminology |
| 48 | +(`Fiel`, `Autenticacion`, `SolicitaDescarga`, `rfc_solicitante`) unless a change is |
| 49 | +explicitly intended to be breaking. Keep XML template filenames aligned with their |
| 50 | +service modules. |
| 51 | + |
| 52 | +## Testing Guidelines |
| 53 | + |
| 54 | +Tests use `pytest`, with discovery configured for `tests/` in `pyproject.toml`. |
| 55 | +Name test files `test_*.py` and test functions `test_*`. Add focused unit tests for |
| 56 | +parsing, request construction, signature behavior, and error handling when changing |
| 57 | +service modules. Avoid tests that require live SAT credentials or network access; |
| 58 | +mock HTTP responses and use fixture data instead. |
| 59 | + |
| 60 | +## Commit & Pull Request Guidelines |
| 61 | + |
| 62 | +The project is configured for `python-semantic-release` with conventional commits. |
| 63 | +Use tags such as `fix:`, `feat:`, `perf:`, `docs:`, `test:`, `refactor:`, `ci:`, |
| 64 | +`build:`, `style:`, and `chore:`. `feat` creates minor releases; `fix` and `perf` |
| 65 | +create patch releases. Pull requests should describe the behavioral change, mention |
| 66 | +affected SAT service flows, link related issues, and include the commands run |
| 67 | +(`pytest`, `python -m build`, linting when relevant). Do not include real RFC keys, |
| 68 | +FIEL passwords, tokens, or downloaded CFDI data in commits, logs, or PR text. |
0 commit comments