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

Added --packages option #19

Closed
wants to merge 11 commits into from
Closed

Conversation

Liam-Deacon
Copy link

Implemented as solution of #18

@codecov
Copy link

codecov bot commented Feb 8, 2019

Codecov Report

Merging #19 into master will decrease coverage by 4.62%.
The diff coverage is 52.94%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #19      +/-   ##
=========================================
- Coverage   98.03%   93.4%   -4.63%     
=========================================
  Files           1       1              
  Lines         254     182      -72     
=========================================
- Hits          249     170      -79     
- Misses          5      12       +7
Impacted Files Coverage Δ
piplicenses.py 93.4% <52.94%> (-4.63%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b1c8b6...5a0ed65. Read the comment docs.

@codecov
Copy link

codecov bot commented Feb 8, 2019

Codecov Report

Merging #19 into master will decrease coverage by 4.22%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #19      +/-   ##
==========================================
- Coverage   97.59%   93.37%   -4.23%     
==========================================
  Files           1        1              
  Lines         166      181      +15     
==========================================
+ Hits          162      169       +7     
- Misses          4       12       +8
Impacted Files Coverage Δ
piplicenses.py 93.37% <50%> (-4.23%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 121fa86...b4a3236. Read the comment docs.

@raimon49
Copy link
Owner

@LightSlayer Thank you for your feature request and implementation.

I think that this option is a good proposal.

In order to merge we have to solve 2 tasks.

  1. I am against arguments receiving external files.This is because we need to implement a merge algorithm when multiple .txt or .json are given. It seems not to be taken into account in the current Pull Request. If this option is only accept the package name in the argument, it is acceptable to me.
  2. pip-licenses always measures code coverage for quality. If you implement the new feature, please also write unit test in test_piplicenses.py. Tests can be run with make test command by constructing dependent environment with dev-requirements.txt

@codecov-io
Copy link

codecov-io commented Feb 23, 2020

Codecov Report

Merging #19 into master will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #19      +/-   ##
==========================================
+ Coverage   98.42%   98.50%   +0.07%     
==========================================
  Files           1        1              
  Lines         318      334      +16     
==========================================
+ Hits          313      329      +16     
  Misses          5        5              

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e63ba8f...df5e18c. Read the comment docs.

@Liam-Deacon
Copy link
Author

Thanks @raimon49 for your feedback - and apologies it has taken me about a year to return to this!

I've now added some tests to cover the new functionality. On the point of loading multiple .txt or .json files, I am simply using a set of all of the packages to get the list of merged package names, which is simple and should be okay (version pinning elements of the requirements.txt files are ignored when loaded thanks to some regex magic).

Hope this is now suitable for bringing into the main code repo - please just let me know if you'd like me to make any more changes or add anything further.

Name Version License
numpy 1.16.1 BSD
twine 1.12.1 MIT
```
Copy link
Owner

Choose a reason for hiding this comment

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

The implementation does not work as of this document.

# error with this option
$ pip-licenses --packages twine numpy
usage: piplicenses.py [-h] [-v] [--from SOURCE] [-s] [-a] [-u] [-d] [-l] [--no-license-path] [-i PKG] [-p INCLUDES] [-o COL]
                      [-f STYLE] [--summary] [--output-file OUTPUT_FILE]
piplicenses.py: error: unrecognized arguments: numpy

Since action='append' is used, it must be specified multiple times. Please see docs for argpase.

# work with this option
$ pip-licenses --packages twine --packages numpy

The behavior of the existing option --ignore-packages is also a breaking change.

Is it difficult to achieve your function with a combination of action='store' and nargs='+'?

ignore_pkg_name = 'PTable'
else:
ignore_pkg_name = 'prettytable'
ignore_pkg_name = 'pytest'
Copy link
Owner

Choose a reason for hiding this comment

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

Why was this change needed?

Copy link
Owner

@raimon49 raimon49 left a comment

Choose a reason for hiding this comment

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

I want to merge existing options without breaking change.

@maldo maldo mentioned this pull request May 21, 2021
@raimon49
Copy link
Owner

raimon49 commented Jun 4, 2021

@Liam-Deacon I adopted a simpler solution, #99, and shipped pip-licenses 3.4.0.

You can use pipe and shell scripts to work with the content output by pydep that fits your idea. Probably this way is more "UNIX-like".

Thanks for your suggestions and attempts.

@raimon49 raimon49 closed this Jun 4, 2021
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

3 participants