Skip to content

Requirements.txt parser needs to handle lines with trailing comments #310

@drdavella

Description

@drdavella

It is valid for for a requirements.txt file to have lines with trailing comments:

foo>=1.2.3   # very informative comment

Right now we properly filter for lines that begin with comments but we also need to strip any trailing comments before parsing the requirement. This logic occurs here:

dependencies = set(line.strip() for line in lines if not line.startswith("#"))

The logic above properly strips whitespace and filters lines that begin with comments but does not properly account for trailing comments.

We need to:

  1. Add a good test case
  2. Update the parser to handle these kinds of lines

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions