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

Create report containing information about packages installed #206

Open
fridex opened this issue Nov 5, 2021 · 11 comments
Open

Create report containing information about packages installed #206

fridex opened this issue Nov 5, 2021 · 11 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@fridex
Copy link
Collaborator

fridex commented Nov 5, 2021

Is your feature request related to a problem? Please describe.

micropipenv provides easy to use tool to install application dependencies. It might be an interesting feature to let users know more about the installation process and provenance of installed packages. Consider a use-case when a user wants to know information about packages installed into the environment. The user can trigger:

pip list

This pip's package listing shows installed packages - only their names and versions. Sadly, the output does not capture additional information, such as which index was used to install packages or which wheel file was chosen.

Describe the solution you'd like

Provide --report option in micropipenv that would produce a report out of the installation process. This report can capture:

  • which distribution was used (sdist/wheel)
  • which index was used to obtain the package
  • artifact hash used (even if users use lock files, lock files state multiple hashes matching multiple artifacts and the installation procedure picks the one matching environment)
  • additional information about the artifact (such as size, full url following redirects, ...)
  • environment information (ex. python interpreter version, markers evaluated, ...)

Additional context

The very first implementation could try to parse pip logs. Some instrumentation or monkey patching of pip might be needed to obtain relevant information.

@fridex
Copy link
Collaborator Author

fridex commented Nov 5, 2021

CC @frenzymadness does this sound interesting feature to be implemented in micropipenv? It might be interesting to keep the report even in python s2i after the build to have a mechanism to introspect what exact packages are present after the image is built.

@frenzymadness
Copy link
Collaborator

Should this work during the installation or ex-post? I honestly think that micropipenv is verbose enough and you can always increase pip verbosity via an environment variable so I'm not sure I'd find a use case for such a feature. Moreover, with hashes in a dependency spec, you should be able to re-run the same installation and track down whatever you need to know. Have you ever been in need of such a feature?

@fridex
Copy link
Collaborator Author

fridex commented Dec 3, 2021

The feature might be interesting to track down what the installation process brought to the environment. The lockfile states package versions (optionally index URL in case of Pipenv lockfiles) but it lists multiple hashes per package version. If one or more artifacts go missing, it might be hard to track down which artifacts were actually picked by pip and used during the installation process (similarly if more specific builds are added, not limited to manylinux standards). This additionally plays a role when one wants to snapshot used artifacts or things like SBOM. I agree that the pip verbosity can be increased, but having a report which artifacts (package name, package version, index url, artifact) really went to the installation process might be interesting to capture and keep track of.

@fridex
Copy link
Collaborator Author

fridex commented Dec 3, 2021

BTW this might be interesting to discuss with pip upstream and see their vision in this area.

EDIT: A link to the discussion.
EDIT: related: pypa/pip-audit#170

@goern
Copy link
Member

goern commented Jan 14, 2022

/kind feature
/priority important-soon

@sesheta sesheta added kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Jan 14, 2022
@sesheta
Copy link
Member

sesheta commented Apr 14, 2022

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@sesheta sesheta added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 14, 2022
@harshad16
Copy link
Member

/lifecycle frozen

@sesheta sesheta added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 18, 2022
@goern goern added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Jul 19, 2022
@fridex
Copy link
Collaborator Author

fridex commented Apr 3, 2023

This resulted in PEP-710. Please feel free to participate in the discussion if you find this feature valuable. Thank you!

@frenzymadness
Copy link
Collaborator

Thanks for the info. So, the goal is to implement some kind of report functionality into micropipenv when the pip starts to provide files proposed in the PEP we can base the report on. Correct?

@fridex
Copy link
Collaborator Author

fridex commented Apr 4, 2023

Thanks for the info. So, the goal is to implement some kind of report functionality into micropipenv when the pip starts to provide files proposed in the PEP we can base the report on. Correct?

As micropipenv uses pip, the provenance_url.json file would be automatically created when installing packages. Consumers can automatically take the file when needed. I don't think there is anything needed in micropipenv if the PEP is accepted.

@fridex
Copy link
Collaborator Author

fridex commented Apr 4, 2023

Consumers can automatically take the file when needed.

If micropipenv upstream decides to be the consumer of this file, it can provide some kind of report subcomand. IMHO, it might be a good idea not to introduce such functionality into micropipenv. micropipenv could be kept lightweight and other tools can be used for this functionality (such as pip-preserve or others).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

5 participants