Core is a fork of Apollo cyber, a publish-subscribe system used as middleware for autonomous driving.
Latency of publish and subscribe messages.
- Deploy build env.
sudo bash scripts/deploy/build.sh- Run the build script.
bash scripts/build.shFor a narrower pycyber-focused build/test loop, use the existing Bazel targets directly:
bazel test --color=no --curses=no \
//cyber/python/internal:py_cyber_test \
//cyber/python/internal:py_record_test \
//cyber/python/cyber_py3/test:init_test \
//cyber/python/cyber_py3/test:cyber_test \
//cyber/python/cyber_py3/test:cyber_time_test \
//cyber/python/cyber_py3/test:record_test-
Set Environment Variable
source scripts/env/runtime.bash -
Run the Publisher and Subscriber
- In the first terminal, run
./bazel-bin/cyber/examples/listenerto start the subscriber program. - In the second terminal, run
./bazel-bin/cyber/examples/talkerto start the publisher program.
- In the first terminal, run
-
Check the log in
data/log
Recommended: use the included one-step packaging script which stages, builds, repairs and validates the wheel. Always run packaging inside an isolated Python environment (venv) or a clean container to avoid dependency conflicts.
Quick start (recommended)
- Create and activate a virtual environment (venv):
python3 -m venv .packaging-venv
source .packaging-venv/bin/activate
python -m pip install --upgrade pip
pip install build auditwheel twine setuptools_scm
# On Linux, also install patchelf
sudo apt-get update && sudo apt-get install -y patchelf- Run the one-step packaging script. The script will use PYCYBER_VERSION if set, otherwise it reads the most recent tag matching
pycyber-v*:
# Preferred: use tag-derived version (make and push a tag first)
./scripts/release/build_and_package_pycyber.sh
# Or override version explicitly:
PYCYBER_VERSION=0.0.7 ./scripts/release/build_and_package_pycyber.shArtifacts and checks:
- Artifacts are written to
packaging/pycyber/wheelhouse/. - The script runs
twine checkand the repository'svalidate_pycyber.pysmoke test. - A
SHA256SUMSfile is created in the wheelhouse.
Script flags:
--skip-auditwheel: Skipauditwheelrepair (useful on non-Linux machines).--skip-validate: Skip running the smoke validation.--skip-sdist: Only build wheel, skip sdist.--skip-build: Skip staging (build_pycyber.py), useful if staging already exists.--outdir DIR: Write artifacts to a custom directory.
Manual (step-by-step) packaging
If you prefer to run the steps manually, follow these commands (run inside a clean venv / container):
- Stage the package from Bazel outputs:
python3 scripts/release/build_pycyber.py- Build sdist + wheel:
python3 -m build --sdist --wheel --outdir packaging/pycyber/dist packaging/pycyber- Repair Linux wheels (auditwheel):
auditwheel repair packaging/pycyber/dist/*.whl -w packaging/pycyber/wheelhouse- Check metadata and run validation:
python3 -m twine check packaging/pycyber/wheelhouse/*
python3 scripts/release/validate_pycyber.py --wheel packaging/pycyber/wheelhouse/*.whl- Upload to TestPyPI (recommended first):
TWINE_USERNAME=__token__ TWINE_PASSWORD=$TEST_PYPI_TOKEN \
python -m twine upload --repository testpypi packaging/pycyber/wheelhouse/*
# Test install from TestPyPI in a fresh venv:
pip install --index-url https://test.pypi.org/simple/ --no-deps pycyber==0.0.7- Final upload to PyPI:
TWINE_USERNAME=__token__ TWINE_PASSWORD=$PYPI_TOKEN \
python -m twine upload packaging/pycyber/wheelhouse/*Versioning
pyproject.tomlis configured to usesetuptools_scmwith the tag pattern^pycyber-v(?P<version>.+)$.- Preferred release flow: create an annotated tag on the release commit and push it:
git tag -a pycyber-v1.2.3 -m "Release 1.2.3"
git push origin --tags- The one-step script will extract the version from the tag automatically. If needed, override with
PYCYBER_VERSION.
Troubleshooting
- pip dependency conflicts (for example:
streamlitvsprotobuf) occur when build tools are installed into the global Python environment. Always use a clean virtualenv (venv) or container for packaging. - For reproducible manylinux wheels and multi-Python builds, use
cibuildwheelor the official manylinux Docker images: https://github.com/pypa/manylinux - If
auditwheelcannot patch RPATH becausepatchelfis missing, installpatchelf(Debian/Ubuntu:apt-get install -y patchelf) or run the packaging inside an appropriate Linux build environment.
Security and best practices
- Use PyPI API tokens (username
__token__) with minimal scope; store tokens as secrets in CI. - Upload to TestPyPI first to verify installation before publishing to the real PyPI.
- Tag releases and attach built artifacts and
SHA256SUMSto GitHub Releases. - Optionally GPG-sign artifacts for extra authenticity.
CI
- The repository includes
.github/workflows/release-pycyber.ymlwhich is triggered by tagspycyber-v*. The workflow checks out the full history (fetch-depth: 0) sosetuptools_scmcan compute versions correctly.