I would like to configure pip
to use a custom search path to install packages from a local folder, which are not hosted on PyPI. The goal is to be able to run
$ pip install --user my_non_published_package
And have it install said package from /home/myuser/projects/my_non_published_package
.
I know that I can explicitely install it using
$ pip install --user /home/myuser/projects/my_non_published_package
but this is not what I want. I want pip to transparently resolve potential depencies of other packages and install them from /home/myuser/projects/<package>
iff they are not hosted on PyPI. So, if I have a project foo
having a setup.py
containing
from setuptools import setup
setup(
...
install_requires=[
bar,
...
],
...
)
And package bar
is not on PyPI, I want pip to install it from /home/myuser/projects/bar
automatically.
Update I found some information here, but the proposed solution does not work.
#! /usr/bin/env python3
"""Setup configuration."""
from pathlib import Path
from setuptools import setup
def local_pkg(name: str) -> str:
"""Returns a path to a local package."""
return f'{name} @ file://{Path.cwd().parent / name}'
setup(
name='openimmodb',
use_scm_version={
"local_scheme": "node-and-timestamp"
},
setup_requires=['setuptools_scm'],
author='HOMEINFO - Digitale Informationssysteme GmbH',
author_email='<info at homeinfo dot de>',
maintainer='Richard Neumann',
maintainer_email='<r dot neumann at homeinfo period de>',
install_requires=[
local_pkg('filedb'),
local_pkg('mdb'),
local_pkg('openimmo'),
local_pkg('openimmolib'),
'peewee',
local_pkg('peeweeplus'),
'pyxb',
local_pkg('timelib'),
local_pkg('xmldom')
],
packages=[
'openimmodb',
'openimmodb.dom',
'openimmodb.dom.ausstattung',
'openimmodb.json',
'openimmodb.json.ausstattung',
'openimmodb.json.barrier_freeness',
'openimmodb.json.flaechen',
'openimmodb.json.immobilie',
'openimmodb.json.preise',
'openimmodb.mixins',
'openimmodb.orm'
],
entry_points={
'console_scripts': [
'oidbctl = openimmodb.oidbctl:main'
]
},
description='Relational OpenImmo database'
)
Results in:
...
Processing dependencies for openimmodb==0.1.dev987+g199a834.d20220110094301
Searching for xmldom@ file:///home/neumann/Projekte/xmldom
Reading https://pypi.org/simple/xmldom/
Couldn't find index page for 'xmldom' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Even though it is there:
$ ls /home/neumann/Projekte/xmldom
LICENSE Makefile README.md setup.py venv xmldom.egg-info xmldom.py
Same with additional localhost
:
Searching for xmldom@ file://localhost/home/neumann/Projekte/xmldom
Reading https://pypi.org/simple/xmldom/
Couldn't find index page for 'xmldom' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
And with #egg=
Processing dependencies for openimmodb==0.1.dev987+g199a834.d20220110095236
Searching for xmldom@ file://localhost/home/neumann/Projekte/xmldom#egg=xmldom
Reading https://pypi.org/simple/xmldom/
Couldn't find index page for 'xmldom' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
With the absolute path in install_requires
I get:
$ python setup.py install
error in openimmodb setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Parse error at "'/home/ne'": Expected W:(abcd...)