recently, I have tried to build a pypi server on top of github.

here are the steps:

  1. create a repo, to host those packages
  2. at the root level, define the setup.py with the findpackages(), like
import setuptools

3. at each packages, add the setup.py as well

import setuptools

the folder structure will be like

--pypi
------setup.py
------README.md
------package1
-------------setup.py
-------------README.md
-------------__init__.py
-------------functions.py
------package2
-------------setup.py
-------------README.md
-------------__init__.py
-------------functions.py

4. run this command to generate the binaries

python3 setup.py sdist bdist_wheel

the folder will become

--pypi
------setup.py
------README.md
------package1
-------------setup.py
-------------README.md
-------------__init__.py
-------------functions.py

-------------build/
-------------dist/
--------------------package1-0.0.1.tar.gz
------package2
-------------setup.py
-------------README.md
-------------__init__.py
-------------functions.py

-------------build/
-------------dist/
--------------------package2-0.0.1.tar.gz

5. then create a static pypi server which comply to Pep 503, like

6. then add the new pypi server into Pipfile and pyproject.toml

Pipfile

[source]
name = "privatepypi"
url = "http://private/pypi"
verify_ssl = false

pyproject.toml

[[tool.poetry.source]]
name = "privatepypi"
url = "https://private/pypi"
secondary = true

7. then can install packages using the commands as normal

pip install

poetry install

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store