atrhub
atrhub validates and routes ATR/CCH exchange files between market actors.
- Python: 3.8+
- CLI entrypoint:
atrhub - Main package:
atrhub
Table of contents
What it does
For supported files, atrhub:
- Scans outgoing queues in a tree structure.
- Validates files (including sender/receiver constraints).
- Routes valid files to the target actor queue.
- Marks invalid files as
.errorand logs the failure reason.
Installation
Install from PyPI:
pip install atrhub
Usage
CLI
Inspect options:
atrhub --help
Usage: atrhub [OPTIONS]
Options:
--path PATH Directory to process [required]
--log-file PATH Absolute log file path for this execution [required]
--mode [atr|cch] Processor mode [default: atr]
--help Show this message and exit.
Example:
atrhub --path /tmp/atr_tree --log-file /tmp/atrhub.log --mode atr
Exit code behavior:
0: successful execution (including empty runs with no files to process)>0: execution failed
Library API
import atrhub
atr_files = atrhub.ATRFiles(path="/tmp/atr_tree")
atr_files.deliver()
Create FTP users
The package ships the create_ftp_user helper command (from bin/create_ftp_user.sh).
create_ftp_user AAAA XXXX
This command creates users and sets required grants for atrhub-compatible SFTP usage.
Development
Local setup
Clone and install with development dependencies:
pip install -e ".[dev]"
If you only need test dependencies (same profile used in CI):
pip install -e ".[test]"
Run tests
pytest
Lint and format
python -m ruff check .
python -m ruff format .
python -m pre_commit run --all-files
Type checks:
python -m ty check
Build distributions
python -m build
Artifacts are generated in dist/.
Logs
Action example
2019-01-14 19:55:59,264 INFO Moving file '/tmp/atr_tree/0034/Salida/M1_2.xml' to '/tmp/atr_tree/0762/Entrada/M1_2.xml'
Error example
2019-01-14 19:55:59,297 ERROR File '/tmp/atr_tree/0096/Salida/inexistent_destination.xml' is not accepted, wrong destinatary inside XML "0000"
CI/CD
- CI tests run from .github/workflows/ci_test_config.yml
- Release publishing runs from .github/workflows/release.yml
The release workflow is triggered by pushing a Git tag.
Tag formats:
- Final release:
vX.Y.Z(example:v1.0.0) - Release candidate:
vX.Y.Z-rcN(example:v1.0.0-rc1)
Guide 1: Release Candidate (RC) from current PR branch
Use this flow to validate packaging/release automation before merge.
-
Bump package version in
atrhub/__init__.py:__version__ = "1.0.0"
-
Commit and push the version bump to your PR branch:
git add atrhub/__init__.py git commit -m "Bump version to 1.0.0" git push origin <your-branch>
-
Create and push an RC tag from your current branch HEAD:
git tag v1.0.0-rc1 git push origin refs/tags/v1.0.0-rc1
-
Verify
GISCE_ATRHUB_RELEASEin GitHub Actions.
Result:
- GitHub builds
sdist+wheel - GitHub creates a pre-release
- PyPI publish step is skipped for RC tags
Guide 2: Final release (vX.Y.Z)
Final releases should be tagged from the commit already merged to master.
-
Merge the PR with the version bump.
-
Ensure CI is green on
master. -
From
master, create and push the final tag:git checkout master git pull --ff-only git tag v1.0.0 git push origin refs/tags/v1.0.0
Result:
- GitHub builds
sdist+wheel - GitHub creates the final Release
- Workflow publishes package to PyPI (requires
PYPI_TOKENsecret)
Release files for atrhub 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| atrhub-1.0.0.tar.gz | 16.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| atrhub-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.3 kB
Release files / atrhub-1.0.0.tar.gz
| Download URL | atrhub-1.0.0.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a35bf4770968c201db9a0c8545f96ec0c8916c81bd5a4e6277eb9479d57e27d6
|
|
BLAKE2b-256 checksum How to use checksums |
96440dc3e0921e00c846381d6287f71d160ec1ef6faddeaad7257a468a87bb30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / atrhub-1.0.0-py3-none-any.whl
| Download URL | atrhub-1.0.0-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3688456f056218e406fed578fcf83153bc1229bd25a7dfad284c5b47f0f00bf1
|
|
BLAKE2b-256 checksum How to use checksums |
d93fab8a159f26a5c5df2a9e97e0360730a0052b2a446205c3b42bf232cf5fac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|