Sonatype Nexus Repository Manager (Nexus)


https://help.sonatype.com/repomanager3/nexus-repository-administration/formats/pypi-repositories


Прокси сервер (proxy)


Были проблемы с работой в docker. Установил на хост. Может быть, просто забыл выбрать “trusted certs”


Allow anonymous users to access the server


Инсталляция nexus в ubuntu linux


Nexus Repo


login: admin


Create PyPi Proxy Repo


Nexus Repo


$ cd ~/.config
$ mkdir pip
$ cd pip


$ vi ~/.config/pip/pip.conf


[global]
index = http://localhost:8081/repository/pypi-proxy/pypi
index-url = http://localhost:8081/repository/pypi-proxy/simple


$ export PIP_CONFIG_FILE=/home/marley/.config/pip/pip.conf


$ pip config list


$ pip install yolk3k


$ pip install flask


Nexus Repo


$ pip install flask --index-url http://192.168.1.9:8081/repository/pypi-proxy/simple/ --trusted-host 192.168.1.9


$ pip install -r ./requirements.txt --index-url http://192.168.1.9:8081/repository/pypi-proxy/simple/ --trusted-host 192.168.1.9


Загрузка python пакетов в nexus (hosted)


$ cd ~/tpm
$ pip download flask

// Тоже работает
$ pip download -r ./requirements.txt


// Когда нужна специфичная версия.
$ pip download --only-binary=:all: --python-version=37 --abi=cp37m --platform=manylinux2010_x86_64 numpy==1.18.0


$ pip show flask
Name: Flask
Version: 2.1.1
Summary: A simple framework for building complex web applications.
Home-page: https://palletsprojects.com/p/flask
Author: Armin Ronacher
Author-email: [email protected]
License: BSD-3-Clause
Location: /home/marley/.local/lib/python3.8/site-packages
Requires: Jinja2, click, itsdangerous, Werkzeug, importlib-metadata
Required-by: prometheus-flask-exporter, mlflow, Flask-Script, flask-restx


$ ls
click-8.1.2-py3-none-any.whl
Flask-2.1.1-py3-none-any.whl
importlib_metadata-4.11.3-py3-none-any.whl
itsdangerous-2.1.2-py3-none-any.whl
Jinja2-3.1.1-py3-none-any.whl
MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Werkzeug-2.1.0-py3-none-any.whl
zipp-3.7.0-py3-none-any.whl


$ vi ~/.pypirc


[distutils]
index-servers:
   nexus

[nexus]
repository: http://192.168.1.9:8081/repository/pypi-internal/
username: admin
password: admin



UPD! Делал в env от conda. Не работал. Вышел командой, $ conda deactivate, стало OK!

// Если нужно без проверки сертификатов
$ export CURL_CA_BUNDLE=""


$ pip install twine


// UPLOAD 1
$ twine upload --repository nexus ./Flask-2.1.1-py3-none-any.whl

// UPLOAD multiple
$ twine upload --repository nexus dist/* --skip-existing --verbose


// Или еше вариант
$ python -m twine upload --repository nexus dist/* --skip-existing --verbose


// Download
$ pip download example-package --index-url http://192.168.1.9:8081/repository/pypi-internal/simple/ --trusted-host 192.168.1.9


// INSTALL
$ pip install example-package --index-url http://192.168.1.9:8081/repository/pypi-internal/simple/ --trusted-host 192.168.1.9


Packaging Python Projects

https://packaging.python.org/en/latest/tutorials/packaging-projects/