我有以下项目结构:
root
- sample/
- src/
- tests/
- pyproject.toml
- libs/
- lol/
- src/
- tests/
- pyproject.toml
Run Code Online (Sandbox Code Playgroud)
我想指定lol为samplein的依赖项sample/pyproject.toml。怎样才能做到呢?我试过了:
dependencies = [
"lol @ file://libs/lol"
]
Run Code Online (Sandbox Code Playgroud)
但它给了我:
ValueError: non-local file URIs are not supported on this platform: 'file://libs/lol'
Run Code Online (Sandbox Code Playgroud)
没关系,但是我不能在这里放置绝对路径,因为这将是共享代码。对于 也一样file://./lib/lol。
对此我们能做些什么呢?我可以在这里使用环境变量或一些占位符吗?我不想使用诗歌之类的工具。
根据我的研究,以下应该有效:
from setuptools import setup
from setuptools import find_packages
...
REQUIRES_INSTALL = [
'spacy==2.3.2',
'tensorflow==1.14.0',
'Keras==2.2.4',
'keras-contrib@git+https://github.com/keras-team/keras-contrib.git#egg=keras-contrib',
'en-core-web-sm@https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.0/en_core_web_sm-2.3.0.tar.gz#egg=en-core-web-sm'
]
...
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
install_requires=REQUIRES_INSTALL,
...
)
Run Code Online (Sandbox Code Playgroud)
当建造轮子或鸡蛋时,一切都很好:python setup.py bdist_wheel。
但是当尝试使用pip install -U dist/mypack-....whl.
我得到:
ERROR: Could not find a version that satisfies the requirement keras-contrib (from mypack==0.3.5) (from versions: none)
ERROR: No matching distribution found for keras-contrib (from mypack==0.3.5)
...
ERROR: Could not find a version that satisfies the requirement en-core-web-sm (from mypack==0.3.5) (from versions: …Run Code Online (Sandbox Code Playgroud)