my_package is a python package set-up with https://github.com/cjolowicz/cookiecutter-hypermodern-python.
a_subprepo is a python package made with a bare poetry init and added to my_package with poetry add src/my_package/a_subprepo.
The same deal with another_subprepo. It was added to a_subprepo (from its root directory) with poetry add another_subprepo.
The two subprepos are git submodules and I'd prefer to keep it that way, for faster development.
Now, I'm at the root directory of my_package and poetry install find the sub-repos as expected:
> poetry show
...
another_subrepo 0.1.0 src/my_package/a_subprepo/another_subrepo Another Subackage description
...
a_subrepo 1.0.0 src/my_package/a_subprepo A Subpackage description.
...
The dependencies can be imported in the code and run just fine.
But opening a nox session does not work:
❯ nox -s pre-commit
nox > Running session pre-commit
nox > Creating virtual environment (virtualenv) using python3.8 in .nox/pre-commit
nox > poetry export --format=requirements.txt --dev --without-hashes
nox > Session pre-commit raised exception RuntimeError('line 60: \'another_subrepo @ file://<abs_path_to_another_subprepo>; python_version >= "3.8" and python_version < "3.11"\': Parse error at "\'python_v\'": Expected stringEnd')
Traceback (most recent call last):
File "/home/<user_name>/.local/lib/python3.8/site-packages/packaging/requirements.py", line 102, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "/home/<user_name>/.local/lib/python3.8/site-packages/pyparsing.py", line 1955, in parseString
raise exc
File "/home/<user_name>/.local/lib/python3.8/site-packages/pyparsing.py", line 3814, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected stringEnd, found 'p' (at char 130), (line:1, col:131)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox_poetry/sessions.py", line 68, in to_constraint
requirement = Requirement(requirement_string)
File "/home/<user_name>/.local/lib/python3.8/site-packages/packaging/requirements.py", line 104, in __init__
raise InvalidRequirement(
packaging.requirements.InvalidRequirement: Parse error at "'python_v'": Expected stringEnd
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox/sessions.py", line 695, in execute
self.func(session)
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox/_decorators.py", line 68, in __call__
return self.func(*args, **kwargs)
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox_poetry/sessions.py", line 43, in wrapper
function(proxy, *_args, **_kwargs)
File "/home/<user_name>/Dropbox/<user_name>/Projects/Avy/performance_models/noxfile.py", line 122, in precommit
session.install(
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox_poetry/sessions.py", line 292, in install
return self.poetry.install(*args, **kwargs)
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox_poetry/sessions.py", line 147, in install
requirements = self.export_requirements()
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox_poetry/sessions.py", line 227, in export_requirements
constraints = to_constraints(self.poetry.export())
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox_poetry/sessions.py", line 90, in to_constraints
return "\n".join(_to_constraints())
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox_poetry/sessions.py", line 86, in _to_constraints
constraint = to_constraint(requirement, line)
File "/home/<user_name>/.local/lib/python3.8/site-packages/nox_poetry/sessions.py", line 70, in to_constraint
raise RuntimeError(f"line {line}: {requirement_string!r}: {error}") from error
RuntimeError: line 60: 'another_subprepo @ file://<abs_path_to_another_subprepo>; python_version >= "3.8" and python_version < "3.11"': Parse error at "'python_v'": Expected stringEnd
nox > Session pre-commit failed.
And indeed the offending line in the requirements.txt file is
another_subrepo @ file://<abs_path_to_another_subrepo>; python_version >= "3.8" and python_version < "3.11"
I fear that pip does not support local dependencies, but I can't be sure; I find it weird, because pip install <path_to_another_subrepo> works just fine.
Hello there!
I'm having a hard time with the particular configuration of my project. Here's what I have:
my_package
is a python package set-up with https://github.com/cjolowicz/cookiecutter-hypermodern-python.a_subprepo
is a python package made with a barepoetry init
and added tomy_package
withpoetry add src/my_package/a_subprepo
. The same deal withanother_subprepo
. It was added toa_subprepo
(from its root directory) withpoetry add another_subprepo
.The two subprepos are git submodules and I'd prefer to keep it that way, for faster development.
Now, I'm at the root directory of
my_package
andpoetry install
find the sub-repos as expected:The dependencies can be imported in the code and run just fine. But opening a nox session does not work:
And indeed the offending line in the requirements.txt file is
I fear that pip does not support local dependencies, but I can't be sure; I find it weird, because
pip install <path_to_another_subrepo>
works just fine.Any ideas? Thanks in advance!