pythonpypipython-wheelpypiserver

How do I deploy a python wheels package statically on a custom CDN server?


I have a fork of a CPython extension package that takes literally hours to compile, so I would like to deploy precompiled wheels somewhere to download from instead of compiling from source.

I am also aware that I can host pypiserver myself, but I have CDN service I have lying around for basically free, and I wonder if I can deploy wheels somehow "statically" on my CDN and then do:

pip install -i https://<my cdn of choice> SomePackage

instead of:

pip install https://<my cdn of choice>/SomePackage-1.0-py2.py3-none-any.whl

which would allow me to specify the package version or operating system.

Meaning the "repository" in that case would be just a folder with bunch of static files in right order.


Solution

  • You could make a 'simple' index at the root of your CDN, and make the file structure for each project equivalent to what pip expects for a 'simple' index, which is essentially:

    simple
    ├── SomePackage
    │   ├── SomePackage-1.0-py2.py3-none-any.whl
    │   └── index.html
    └── index.html
    

    And then you can do:

    $ pip install -i https://<my cdn of choice>/simple SomePackage
    

    See PEP 503 -- Simple Repository API for the exact specification of how the HTML pages should be structured.