Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pip): remove extras from lines of requirement.txt files #211

Merged
merged 3 commits into from
Apr 24, 2023

Conversation

DmitriyLewen
Copy link
Collaborator

Description

requirement.txt can contain extras. e.g. pyjwt[crypto]==2.1.0
We need to find dependency name correctly.

@DmitriyLewen DmitriyLewen marked this pull request as ready for review April 21, 2023 07:06
@DmitriyLewen DmitriyLewen self-assigned this Apr 21, 2023
startIndex := strings.Index(line, startExtras)
endIndex := strings.Index(line, endExtras) + 1
if startIndex != -1 && endIndex != -1 {
log.Logger.Debugf("unable to get name and version for extras of %q. Run `pip3 freeze > requirements.txt` to update file and get this dependency", line)
Copy link
Collaborator

@knqyf263 knqyf263 Apr 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this message.

setup(
    name="example",
    ...
    install_requires=[
        "requests"],
    extras_require={
        'test':  ["nose"],
        'doc': ["sphinx"],
    }
)

In the above example, the following commands download different dependencies.

pip install example[test] # install request and nose
pip install example[doc] # install request and sphinx
pip install example # install request

Even when extras are not specified, we can't get the names and versions of indirect dependencies (requiest in this case). So, recommending pip freeze in our doc is enough.

But thanks for your hospitality👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, i removed it in 47b299f

@knqyf263 knqyf263 merged commit f8baca3 into aquasecurity:main Apr 24, 2023
@DmitriyLewen DmitriyLewen deleted the fix/pip-extras branch April 24, 2023 08:41
Sq34sy pushed a commit to Sq34sy/go-dep-parser that referenced this pull request Jul 28, 2023
Sq34sy pushed a commit to Sq34sy/go-dep-parser that referenced this pull request Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants