Create a standalone PyPI package for the aptly publishing tool to enable easy distribution and reuse across all Feel++ projects and third-party dependencies.
feelpp-aptly-publisher/
├── pyproject.toml
├── README.md
├── LICENSE
├── .gitignore
├── src/
│ └── feelpp_aptly_publisher/
│ ├── __init__.py
│ ├── __main__.py
│ ├── publisher.py # Core logic from aptly_publish.py
│ ├── cli.py # CLI interface
│ └── config.py # Config handling
├── tests/
│ ├── __init__.py
│ ├── test_publisher.py
│ └── test_cli.py
└── examples/
├── aptly.conf
└── publish_example.sh
# From PyPI
pip install feelpp-aptly-publisher
# From source
pip install git+https://github.com/feelpp/aptly-publisher.git# Simple usage
feelpp-apt-publish \
--component mmg \
--channel stable \
--distro noble \
--debs ./packages/
# With signing
feelpp-apt-publish \
--component feelpp \
--channel stable \
--distro jammy \
--debs ./build/packages/ \
--sign \
--keyid YOUR_GPG_KEY_ID
# Bootstrap empty component
feelpp-apt-publish \
--component new-project \
--channel testing \
--distro noblefrom feelpp_aptly_publisher import AptlyPublisher
publisher = AptlyPublisher(
component="mmg",
distro="noble",
channel="stable",
pages_repo="https://github.com/feelpp/apt.git",
)
# Publish with .deb files
publisher.publish(debs_dir="./packages/")
# Or bootstrap empty
publisher.bootstrap()- ✅ Bootstrap or update APT repository components
- ✅ Support for multiple channels (stable, testing, pr)
- ✅ Multiple distributions (Ubuntu, Debian)
- ✅ GPG signing support
- ✅ GitHub Pages integration
- ✅ Reusable aptly configuration
- ✅ Comprehensive logging
- ✅ CI/CD friendly
PAGES_REPO=https://github.com/feelpp/apt.git
BRANCH=gh-pages
GPG_KEYID=your-key-id
GPG_PASSPHRASE=your-passphrase # Optional, for automation[project]
name = "feelpp-aptly-publisher"
version = "1.0.0"
requires-python = ">=3.8"
dependencies = [] # Only stdlib, or add 'click' for better CLI
[project.optional-dependencies]
dev = [
"pytest>=7.0",
"pytest-cov>=4.0",
"black>=23.0",
"mypy>=1.0",
"ruff>=0.1.0",
]- name: Install publisher
run: pip install feelpp-aptly-publisher
- name: Publish to APT
env:
PAGES_REPO: ${{ secrets.APT_REPO }}
GPG_KEYID: ${{ secrets.GPG_KEYID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
feelpp-apt-publish \
--component ${{ github.event.repository.name }} \
--channel stable \
--distro noble \
--debs ./packages/ \
--signstage('Publish to APT') {
steps {
sh 'pip install feelpp-aptly-publisher'
withCredentials([
string(credentialsId: 'gpg-keyid', variable: 'GPG_KEYID'),
string(credentialsId: 'gpg-pass', variable: 'GPG_PASSPHRASE')
]) {
sh '''
feelpp-apt-publish \
--component ${JOB_NAME} \
--channel ${BRANCH_NAME == 'master' ? 'stable' : 'testing'} \
--distro noble \
--debs ./packages/ \
--sign
'''
}
}
}- Easy Distribution:
pip installanywhere - Version Control: Track tool versions separately from projects
- Testing: Proper unit tests and CI
- Documentation: Standard PyPI docs + examples
- Independence: Projects don't need the entire apt repo
- Consistency: Same tool version across all Feel++ projects
- Extensibility: Easy to add plugins or extensions
- Extract
aptly_publish.pyinto package structure - Add tests and documentation
- Publish to PyPI
- Add to CI/CD pipelines
- Create wrapper scripts (like
publish-mmg.sh) - Update documentation
- Keep
apt/scripts/aptly_publish.pyas alias - Eventually remove in favor of PyPI package
feelpp-aptly-publisher(recommended)feelpp-apt-toolsaptly-gh-pagesapt-component-publisher
- Name:
feelpp/aptly-publisher - URL: https://github.com/feelpp/aptly-publisher
- PyPI: https://pypi.org/project/feelpp-aptly-publisher/
- Create new repository
feelpp/aptly-publisher - Refactor
aptly_publish.pyinto package structure - Add tests and CI
- Publish to PyPI
- Update mmg and other projects to use it
- Document in Feel++ developer guide