-
Notifications
You must be signed in to change notification settings - Fork 2
Add some basic Python bindings #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
While this approach maintains pkg-config as the preferred mechanism for discovering dependencies, it allows us to support the older config mechanism shipped with many of these dependencies on older distributions like CentOS 7. An additional part of this change is the switch to CMake targets for dependencies, which significantly reduces boilerplate in the main CMakeLists.txt.
40bac1f to
a466ce9
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #18 +/- ##
==========================================
+ Coverage 38.74% 42.67% +3.93%
==========================================
Files 17 20 +3
Lines 2403 2615 +212
Branches 494 532 +38
==========================================
+ Hits 931 1116 +185
+ Misses 1259 1244 -15
- Partials 213 255 +42 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Attempting to run the Python tests locally I encountered this problem naively installing python test dependencies: |
|
I hadn't actually tried installing the package that way, but it should work. I think you specified the target twice ( - > pip install . -e .[test]
+ > pip install -e .[test] |
This change introduces some basic Python bindings for
createrepo-agent.The module itself
createrepo_agent.*createrepo_agent.Servertype, which creates acreatrepo-agentAssuan server for the given repository cluster. If there is already a server running, an error occurs.createrepo_agent.Clienttype, which connects to an already running server. It does not automatically spawn a server if one is not already running.Example for how these could be used is in the tests:
createrepo-agent/test/test_smoke.py
Lines 20 to 29 in 40bac1f
Building with vanilla CMake
During a normal CMake build, if a sufficient Python version is found or
WITH_PYTHON=ONis specifically specified, the Python module will be built and adist-infodirectory will be installed. There aren't a lot of great ways to generate the metadata from CMake, so I elected to do it manually. It's just a handful of files with mostly static content. This is how source builds from colcon, RPM, and debian packaging will build and install the module. The only additional dependency is Python itself.Building with scikit-build
A top-level
pyproject.tomlis present so thatcreaterepo-agentcan be built as a standards-based Python package. A build backend is available forscikit-build, which chains to CMake to build the module and results in a usable wheel. The shared object library is linked against system dependencies at this stage, so the wheel isn't appropriate for widespread distribution, but it should function fine on the platform it was built. For now, I elected to omit thecreaterepo-agentexecutable from the wheel, so it only contains the Python bindings.Combining scikit-build with cibuildwheel and manylinux
The pypa/cibuildwheel action can build a Python package against various
manylinuxtargets and automatically audit the resulting wheel files to include the necessary shared object library files. The resulting wheels are appropriate for upload to PyPI and should cover the vast majority Linux platforms.The action will run for each tag and can be dispatched manually as necessary. It builds the python distribution artifacts (sdist and binary wheels) and makes them available to download. At this time, it does not automatically upload the artifacts to PyPI. When a release occurs, this should be done manually and the resulting artifacts published with
twine.Future work
Another type, possibly
createrepo_agent.Agent, which combines the Server and Client and auto-spawns, similar to how thecreaterepo-agentexecutable behaves. Also, introduce higher-level workflows for concepts like "import" (again, provided by the executable) which combine multiple client calls.Important
This PR depends on #16 and is opened in a draft state until that upstream change merges.