I have configured the Nexus-OSS-3.14 private Python artifact server on aws cloud. I want to be maintain all my project related Python packages on my private repository server.
I downloaded the all the Python packages on my local Linux box and I want to be upload all the Python packages to private Python artifact server.
I have tried curl put request and I didn't upload and your help is needed to complete this.
I have tried curl put request:
curl -v -u admin:admin --upload-file boto3-1.9.76-py2.py3-none-any.whl https://artifact.example.com/repository/ASAP-Python-2.7-Hosted/
When I used that command and I get 404 response.
To upload a pom file and its associated artifacts add all the files into the upload screen at the same time. Be sure to specify the extension of the pom file as pom ; this will let Nexus Repository know it should be taking the coordinates from the pom file, not the UI.
Build the python package twine : publishes the package on a package registry (a private one or PyPi). Install the requirements. To keep things simple, we will use the python virtual environment. Create a file setup.py and fill it with the information about your package.
Pip (yarn) for download. Twine for upload. Configuration:
be careful with trailing slashes!
pip config edit [--editor [nano|code|...]] [--global|--user]
for edit config
[global]
index = https://nexus.your.domain/repository/pypi/pypi
index-url = https://nexus.your.domain/repository/pypi/simple
Or set environment variables. Dockerfile for example:
ENV \
PIP_INDEX=https://nexus.your.domain/repository/pypi/pypi \
PIP_INDEX_URL=https://nexus.your.domain/repository/pypi/simple
Or use command line args pip install --index
Edit .pypirc
:
[distutils]
index-servers =
pypi
[pypi]
repository: https://nexus.your.domain/repository/pypi-hosted/
username: nexususername
password: nexuspassword
Or environment
ENV \
TWINE_REPOSITORY_URL=https://nexus.your.domain/repository/pypi-hosted/ \
TWINE_USERNAME=nexususername \
TWINE_PASSWORD=nexuspassword
Or command line
twine upload --repository-url
I think the recommended approach is to use twine
, something like this should work:
pip install twine
twine upload --repository https://artifact.example.com/repository/ASAP-Python-2.7-Hosted/ boto3-1.9.76-py2.py3-none-any.whl
It should ask for your username and password. To make life a bit easier you can create $HOME/.pypirc
file with the URL, username and password
[nexus]
repository: https://artifact.example.com/repository/ASAP-Python-2.7-Hosted/
username: admin
password: admin
Then when you call twine
, do so like this:
twine upload --repository nexus boto3-1.9.76-py2.py3-none-any.whl
It's not a hard requirement, but if you're on multi user system and you've put a password in the file you should probably do
chmod 600 $HOME/.pypirc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With