Skip to content

Instantly share code, notes, and snippets.

@KyleJamesWalker
Created January 31, 2019 19:34
Show Gist options
  • Save KyleJamesWalker/a630fe28a1e0cb0c73423a8d8bb9f7d8 to your computer and use it in GitHub Desktop.
Save KyleJamesWalker/a630fe28a1e0cb0c73423a8d8bb9f7d8 to your computer and use it in GitHub Desktop.
Setup.py Install a Fork

Setup.py Hacking

To get this to work without updating your forked version number, you must lie in the dependency_links section, and then unpin the version that you want installed. This makes it think that the branch is version current linux time (int) in the lookup but will acutally install whatever version it finds in the fork.

Note: You also will likely need to clear your pip cache so it won't install the version it finds in pypi, I think doing the current time will keep it from using the pypi version, so just make sure you keep an eye on the logs when you install your library, and that it says "Cloning ..../KyleJamesWalker/example_lib

rm -rf ~/Library/Caches/pip; pip uninstall example_lib; pip install --process-dependency-links ".[test]" | grep example_lib
import time
from setuptools import find_packages, setup
requirements = [
]
extras_require = {
'test': [
"example_lib",
],
'dev': [
],
'setup': [
],
}
extras_require.update(all=sorted(set().union(*extras_require.values())))
setup(
name='annoying_example',
version='0.0.0',
author='KyleJamesWalker',
description="Really Setup Tools",
packages=find_packages(),
package_data={
'': ['*.yaml'],
},
install_requires=requirements,
extras_require=extras_require,
setup_requires=extras_require['setup'],
tests_require=extras_require['test'],
test_suite='tests',
dependency_links=[
'git+https://github.com/KyleJamesWalker/example_lib@cool-branch#egg=example_lib-{}'.format(str(time.time())),
],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment