Add some basic Python bindings #18
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.