Rather than pushing a release to PyPi and GitHub, it would be easier to have PyPi use the latest GitHub master. Is there are proper way to do this?
I know you can list dependencies as GitHub repos in install_requires, but is there a way to do this for the primary package?
For example, when you use easy_install to install Flask, it reads from multiple sources, including GitHub, which is listed in the setup URL ( https://github.com/mitsuhiko/flask/blob/master/setup.py#L78):
$ sudo easy_install Flask
Searching for Flask
Reading http://pypi.python.org/simple/Flask/
Reading http://github.com/mitsuhiko/flask/
Is listing the URL in setup.py what causes easy_install to also read from GitHub?
If so, will it always install from GitHub if the GitHub version is more current than the PyPi version?
And does this work the same for pip?
You can deploy Git locally, or use it via a hosted service, such as Github, Gitlab or Bitbucket. One of the advantages of using pip together with Git is to install the latest commits of unreleased Python packages as branches from Github.
Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
If I recall correctly you can use download_url
to point to the lastest tarball at GitHub.
Do not send any sdist/bdist to PyPI, only register the package and change setup.py
to something like:
setup(...,
download_url='https://github.com/USER/PROJECT/tarball/master')
The reason those pages are read is because setuptools
crawls lots of pages (starting from http://pypi.python.org/simple/) looking for any download url that looks like what the installation needs. You can see more details if you use the -v
option in easy_install
/pip
.
pip install -vvv flask
References:
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