question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect documentation on requirements.txt format

See original GitHub issue

While attempting to fix an issue in pip-tools, it was discovered that the documentation for the requirements.txt format conflicts with the actual behaviour of pip when it parses a requirements.txt file.

The documentation for requirements.txt format mentions Comments are stripped before line continuations are processed. but the pip code appears to do the opposite, processing the line continuations before it strips the comments.

Which one is correct?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
atugushevcommented, Apr 19, 2020

I made an experiment (#8094) and swapped the lines to see what happens. Two tests test_comments_and_joins_case1 and test_comments_and_joins_case3 are failed, see the tests:

https://github.com/pypa/pip/blob/a531a15376ae8ee9670c1ab15262876a96624b97/tests/unit/test_req_file.py#L76-L100

Since this case:

package1 \
   # a comment
package2

is pretty legit and well tested, thus we may assume that there is a bug in documentation rather than in code.

1reaction
AndydeCleyrecommented, Apr 17, 2020

Just in case it’s missed, all that’s needed IMO is #7780.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Requirements File Format - pip documentation v22.3.1
Requirements files serve as a list of items to be installed by pip, ... Files that use this format are often called “pip...
Read more >
Invalid "requirements_file": path docs/requirements.txt does ...
This is particularly strange because the repo clearly has a docs/requirements.txt file. What could be causing this?
Read more >
pip fails to install packages from requirements.txt
I am trying to install a python software using the requirements file. >> cat requirements.txt Cython ...
Read more >
Errors while running pip install -r requirements.txt
Hi,. I have same problem when I run the command in virtualenv in Window Command Prompt. (mflix_venv) C:\Program Files\MongoDB\M220P\mflix-python ...
Read more >
Why and How to make a Requirements.txt - Robert Boscacci
In short, we generate and share requirements.txt files to make it easier for other developers to install the correct versions of the required...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found