What is the right syntax to use &
inside a requirements.txt? Is there an escape sequence?
I have a Python package in a subdirectory of a Git repo. I can install the package successfully using pip (syntax here: https://stackoverflow.com/a/26174655/6032073)
However, I cannot install if I put the Git URL into a requirements.txt file. I believe it is breaking on the ampersand character in the URL (&subdirectory=blah)
Quotes dont work inside the requirements file. Escaping the ampersand with backslash and carot does not work either (\&
or ^&
).
$ pip install 'git+ssh://git@github.example.com/reponame.git@branchname#egg=packagename&subdirectory=one/two'
[OK]
$ cat requirements.txt
"git+ssh://git@github.example.com/reponame.git@branchname#egg=pac..."
$ pip install -r requirements.txt
RequirementParseError: Missing distribution spec "git+ssh://git@github.example.com/reponame.git@branchname#egg=packagename&subdirectory=one/two"
Update
- I got it to work using the
-e
syntax in requirements.txt (no quotes needed). Is this possible without-e
?