This is the pulp_python Plugin for Pulp Project
3.0+. A Pulp plugin to support hosting your own
pip compatible Python packages.
For more information, please see http://www.pulpproject.org.
All REST API examples bellow use httpie to perform the requests.
The httpie commands below assume that the user executing the commands has a .netrc file
in the home directory. The .netrc should have the following configuration:
machine localhost login admin password admin
If you configured the admin user with a different password, adjust the configuration
accordingly. If you prefer to specify the username and password with each request, please see
httpie documentation on how to do that.
This documentation makes use of the jq library to parse the json received from requests, in order to get the unique urls generated when objects are created. To follow this documentation as-is please install the jq library with:
$ sudo dnf install jq
Follow the installation instructions provided with pulpcore.
- sudo -u pulp -i
- source ~/pulpvenv/bin/activate
- git clone https://github.com/pulp/pulp_python.git
- cd pulp_python
- git checkout 3.0-dev
- python setup.py develop
- pulp-manager makemigrations pulp_python
- pulp-manager migrate pulp_python
- django-admin runserver
- sudo systemctl restart pulp_resource_manager
- sudo systemctl restart pulp_worker@1
- sudo systemctl restart pulp_worker@2
- sudo -u pulp -i
- source ~/pulpvenv/bin/activate
- pip install pulp-python
- pulp-manager makemigrations pulp_python
- pulp-manager migrate pulp_python
- django-admin runserver
- sudo systemctl restart pulp_resource_manager
- sudo systemctl restart pulp_worker@1
- sudo systemctl restart pulp_worker@2
$ http POST http://localhost:8000/api/v3/repositories/ name=foo
{
"_href": "http://localhost:8000/api/v3/repositories/e81221c3-9c7a-4681-a435-aa74020753f2/",
...
}$ export REPO_HREF=$(http :8000/api/v3/repositories/ | jq -r '.results[] | select(.name == "foo") | ._href')
$ http POST http://localhost:8000/api/v3/importers/python/ name='bar' download_policy='immediate' sync_mode='additive' repository=$REPO_HREF feed_url='https://repos.fedorapeople.org/repos/pulp/pulp/fixtures/python-pypi/' projects='["shelf-reader"]'
{
"_href": "http://localhost:8000/api/v3/repositories/foo/importers/python/3750748b-781f-48df-9734-df014b2a11b4/",
...
}$ export IMPORTER_HREF=$(http :8000/api/v3/importers/python/ | jq -r '.results[] | select(.name == "bar") | ._href')
Use python Importer:
$ http POST $IMPORTER_HREF'sync/'
$ http POST $REPO_HREF'versions/'
Create an Artifact by uploading the wheel to Pulp.
$ http --form POST http://localhost:8000/api/v3/artifacts/ file@./shelf_reader-0.1-py2-none-any.whl
{
"_href": "http://localhost:8000/api/v3/artifacts/7d39e3f6-535a-4b6e-81e9-c83aa56aa19e/",
...
}Create a file with the json bellow and save it as content.json.
{
"filename": "shelf_reader-0.1-py2-none-any.whl",
"packagetype": "bdist_wheel",
"name": "shelf-reader",
"version": "0.1",
"metadata_version": null,
"summary": "Make sure your collections are in call number order.",
"description": "Shelf Reader is a tool for libraries that retrieves call numbers of items \nfrom their barcode and determines if they are in the correct order.",
"keywords": "",
"home_page": "https://github.com/asmacdo/shelf-reader",
"download_url": "UNKNOWN",
"author": "Austin Macdonald",
"author_email": "[email protected]",
"maintainer": null,
"maintainer_email": null,
"license": "GNU GENERAL PUBLIC LICENSE Version 2",
"requires_python": null,
"project_url": null,
"platform": "UNKNOWN",
"supported_platform": null,
"requires_dist": "[]",
"provides_dist": "[]",
"obsoletes_dist": "[]",
"requires_external": "[]",
"classifiers": [],
"artifacts": {"shelf_reader-0.1-py2-none-any.whl":"http://localhost:8000/api/v3/artifacts/7d39e3f6-535a-4b6e-81e9-c83aa56aa19e/"}
}$ http POST http://localhost:8000/api/v3/content/python/ < content.json
{
"_href": "http://localhost:8000/api/v3/content/python/a9578a5f-c59f-4920-9497-8d1699c112ff/",
"artifacts": {
"shelf_reader-0.1-py2-none-any.whl": "http://localhost:8000/api/v3/artifacts/7d39e3f6-535a-4b6e-81e9-c83aa56aa19e/"
},
"digest": "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c",
"notes": {},
"path": "shelf_reader-0.1-py2-none-any.whl",
"type": "python"
}$ export CONTENT_HREF=$(http :8000/api/v3/content/python/ | jq -r '.results[] | select(.path == "shelf_reader-0.1-py2-none-any.whl") | ._href')
Currently there is no endpoint to manually associate content to a repository. This functionality will be added before pulp3 beta is released.
$ http POST http://localhost:8000/api/v3/repositories/foo/publishers/python/ name=bar
{
"_href": "http://localhost:8000/api/v3/repositories/foo/publishers/python/bar/",
...
}$ export PUBLISHER_HREF=$(http :8000/api/v3/publishers/python/ | jq -r '.results[] | select(.name == "bar") | ._href')
$ http POST http://localhost:8000/api/v3/publications/ publisher=$PUBLISHER_HREF
[
{
"_href": "http://localhost:8000/api/v3/tasks/fd4cbecd-6c6a-4197-9cbe-4e45b0516309/",
"task_id": "fd4cbecd-6c6a-4197-9cbe-4e45b0516309"
}
]$ export PUBLICATION_HREF=$(http :8000/api/v3/publications/ | jq -r --arg PUBLISHER_HREF "$PUBLISHER_HREF" '.results[] | select(.publisher==$PUBLISHER_HREF) | ._href')
$ http POST http://localhost:8000/api/v3/distributions/ name='baz' base_path='foo' auto_updated=true http=true https=true publisher=$PUBLISHER_HREF publication=$PUBLICATION_HREF
{
"_href": "http://localhost:8000/api/v3/distributions/9b29f1b2-6726-40a2-988a-273d3f009a41/",
...
}$ http GET http://localhost:8000/api/v3/tasks/82e64412-47f8-4dd4-aa55-9de89a6c549b/
$ http GET http://localhost:8000/content/foo/shelf_reader-0.1-py2-none-any.whl