I need to install dependency from private git repository. It looks like pip install -e . worked OK, but the content of the repository is missing.
My setup.py contains:
from setuptools import setup, find_packages
setup(
name="",
packages=find_packages(),
include_package_data=True,
install_requires=[
"db@git+ssh://private_repo_git_path@master#egg=1.0.0"
]
)
I am running the installation with
venv\Scripts\pip install -e .
(windows)
Installation logs says:
Collecting db@ git+ssh://private_repo_git_path@master#egg=1.0.0
Cloning ssh://****@private_repo_git_path (to revision master) to c:\users\...\appdata\local\temp\pip-install-lobhunuh\db
Running command git clone -q 'ssh://****@private_repo_git_path' 'C:\Users\...\AppData\Local\Temp\pip-install-lobhunuh\db'
...
Installing collected packages: ..., db, ...
Running setup.py install for db ... done
...
Please, any ideas, what I'm doing wrong?
Even though newer versions of Python 3 are able to import directories without a __init__.py
file as packages, these directories still need to be added to the distributions of Python projects.
In this case setuptools is in charge of the packaging and its find_packages
function is in charge of finding the packages automatically. But as far as I know this function only detects packages based on the presence of a __init__.py
file in the directories. Directories without such a file are then either not added to the distributions of the project or not installed (not entirely sure, which it is).
Maybe try setuptools find_namespace_packages
instead. This function seems to be designed to consider any directory containing at least one Python file as a package even without the usual __init__.py
file. Which obviously can have side-effects, for example a test
directory should not be a package installed with the project, even though it does contain Python code.
From my point of view, there is not much drawback to adding the __init__.py
files anyway, so that would be my recommendation.