Repl.it allows you to easily load Python modules that are on PyPi, but I needed to write some code that relied on a Python module hosted on GitHub specifically (long story short: it's a temporary fork of another Python package, and I didn't feel it would be necessary to deploy it up onto PyPi). So I wound up doing some weird stuff to wind up using that Python package hosted on GitHub.
@PaoloAmoroso Eventually, my code was merged into the master branch and the updated package deployed onto PyPy, so I didn't really need to maintain the "Experimental" repl, and just used https://repl.it/@tra38/LittleNiftySubweb exclusively.
Your post did inspire me to fork my existing repl and update it to use git instead of a zip file. It works wonderfully. Here's my new repl that proves that I can indeed install package with pip using a git url. No more zip files for me!
The code snippet:
def set_up_user_directory():
import sys
import site
# this makes it work
if not os.path.exists(site.USER_SITE):
os.makedirs(site.USER_SITE)
# since I'm installing with --user, packages
# should be installed here,
#so make sure it's on the path
sys.path.insert(0, site.USER_SITE)
def install(package):
set_up_user_directory()
import pip
pip.main(['install', package, "--user", "--upgrade"])
install("git+https://github.com/tra38/[email protected]")
Using Pip On Repl.it
Repl.it allows you to easily load Python modules that are on PyPi, but I needed to write some code that relied on a Python module hosted on GitHub specifically (long story short: it's a temporary fork of another Python package, and I didn't feel it would be necessary to deploy it up onto PyPi). So I wound up doing some weird stuff to wind up using that Python package hosted on GitHub.
You can read my blog post to explain the weird stuff that I did: https://tra38.github.io/blog/using-pip-on-repl-it.html
Here is my final Repl (https://repl.it/@tra38/LittleNiftySubweb-Experimental\) where I successfully loaded up my Python package from GitHub.
I hope this experience will be useful for you if you wind up needing to do something like this!
Your post did inspire me to fork my existing repl and update it to use
git
instead of a zip file. It works wonderfully. Here's my new repl that proves that I can indeed install package withpip
using agit
url. No more zip files for me!The code snippet: