damnever / pigar

:coffee: A tool to generate requirements.txt for Python project, and more than that. (IT IS NOT A PACKAGE MANAGEMENT TOOL)
https://damnever.github.io/pigar/
BSD 3-Clause "New" or "Revised" License
1.61k stars 90 forks source link

Preserve optional dependencies in output of `pigar check` #198

Open gsingh93 opened 4 months ago

gsingh93 commented 4 months ago

Is your feature request related to a problem? Please describe. I use pigar check --format-requirements to update my requirements.txt. This works fine for most projects, but sometimes I have a package with optional dependencies, and pigar doesn't include this in the output. For example, if the requirements.txt is:

coverage[toml]==7.4.2

Running pigar check --format requirements correct updates the package version, but it drops the optional toml dependency.

coverage==7.4.3

Describe the solution you'd like Preserve any optional dependencies. In the example above, the output should be:

coverage[toml]==7.4.3