tips:pypi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tips:pypi [2017/01/13 10:02] – [pip custom repo] scipiotips:pypi [2023/04/13 15:10] (current) sscipioni
Line 1: Line 1:
 ====== PYPI ====== ====== PYPI ======
  
-===== pip custom repo =====+===== pypiserver =====
  
-~/.pip/pip.conf 
-<code> 
-[global] 
-#trusted-host = projects.csgalileo.org 
-extra-index-url = https://user:password@projects.csgalileo.org/pypi/simple 
-</code> 
  
-===== setuptools with custom repo =====+https://hub.docker.com/r/pypiserver/pypiserver
  
-~/.pypirc 
-<code> 
-[distutils] 
-index-servers = pypi 
-                galileo 
  
-[pypi] +===== authentication =====
-repository: http://pypi.python.org/pypi +
-username: +
-password:+
  
-[galileo] 
-repository: https://pypi.csgalileo.org 
-username:user 
-password:password 
-</code> 
  
 +create
  
-===== PYPI repo with apache =====+<code | download> 
 +htpasswd -sc htpasswd.txt galileo
  
-==== https ==== 
- 
-<code> 
-sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \ 
- -keyout /etc/apache2/ssl/pypi.csgalileo.org.key \ 
- -out /etc/apache2/ssl/pypi.csgalileo.o.pem 
 </code> </code>
  
 +update
 +<code | download>
 +
 +htpasswd -s htpasswd.txt <user2>
  
-<code> 
-sudo a2enmod ssl 
 </code> </code>
  
-==== apache virtualhost ==== 
  
-/etc/apache2/sites-enabled/pypi.conf +===== client ===== 
-<code> + 
-<VirtualHost *:80> +
-    ServerName pypi.csgalileo.org+
  
-    RewriteEngine On +Client authentication use keyring and: 
-    RewriteCond %{HTTPS} off +- ~/.pip/pip.conf for install  
-    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} +- ~/.pypirc for publish and eventually for clear password
-</VirtualHost>+
  
-<VirtualHost *:443> +===== pip =====
-    ServerName pypi.csgalileo.org +
-    DocumentRoot /var/www/pypi.csgalileo.org+
  
-    SSLEngine On 
-    SSLCertificateFile /etc/apache2/ssl/pypi.csgalileo.org.pem 
-    SSLCertificateKeyFile /etc/apache2/ssl/pypi.csgalileo.org.key 
  
-    <Directory /var/www/pypi.csgalileo.org/+~/.pip/pip.conf
-        AllowOverride None +
-        Options +Indexes +
-        IndexOptions SuppressColumnSorting +
-        IndexIgnore .. +
-        Order deny,allow +
-        Allow from all+
  
-        AuthType Basic +<code | download> 
-        AuthName "Galileo" +[global] 
-        AuthBasicProvider file +extra-index-url = http://localhost:8081 
-        AuthUserFile /etc/apache2/passwords_pypi +                  https://pypi.csgalileo.org 
-        Require valid-user +trusted-host = localhost
-    </Directory>+
  
-    LogLevel warn 
-    ErrorLog /var/log/apache2/pypi-error.log 
-    CustomLog /var/log/apache2/pypi-access.log combined 
-</VirtualHost> 
 </code> </code>
  
  
-==== Users ====+now it is possible to use install command like "pip install blabla"
  
-create +===== twine =====
-<code> +
-sudo htpasswd -c /etc/apache2/passwords_pypi <user> +
-</code>+
  
-add user or change password 
-<code> 
-sudo htpasswd /etc/apache2/passwords_pypi <user> 
-</code> 
  
-generate password +~/.pypirc 
-<code bash+<code | download> 
-openssl passwd -apr1+ 
 +[distutils] 
 +index-servers = 
 +    galileo 
 +    localhost 
 + 
 +[localhost] 
 +repository = http://localhost:8081 
 +username = galileo 
 +#password = <first-repository password> 
 + 
 + 
 +[galileo] 
 +repository = https://pypi.csgalileo.org 
 +username = galileo 
 +# not needed if keyring is used 
 +#password = <first-repository password> 
 + 
 +</code> 
 +now it is possibile publish package like 
 +<code | download
 +twine upload -r galileo dist/*
 </code> </code>
  
  
 +===== user keyring =====
 +
 +
 +twine has keyring utility
 +add galileo user to keyring
 +
 +<code>
 +keyring set http://localhost:8081 galileo
 +</code>
  
  
  
  • tips/pypi.1484298141.txt.gz
  • Last modified: 2017/01/13 10:02
  • by scipio