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

Replace pipdeptree with python-inspector #1

Closed
wants to merge 115 commits into from
Closed

Replace pipdeptree with python-inspector #1

wants to merge 115 commits into from

Conversation

pombredanne
Copy link

Signed-off-by: Tushar Goel tushar.goel.dav@gmail.com

@pombredanne
Copy link
Author

See oss-review-toolkit#5631

@pombredanne
Copy link
Author

Status of the python-inspector integration in ORT:

  • python-inspector is installed in the Docker image by default.
  • the integration works when dealing with a requirements.txt file and using ORT built with Docker.
  • pipdeptree has been removed

Locally we can also run this way:

  • run gradlew python_inspector
  • then source venv/bin/activate

fviernau and others added 25 commits August 3, 2022 09:34
The previous algorithm exhibits the following issues when run on graphs
with cycles, in particular when the amount of edges is large:

1. Cycles of length 1 lead to infinite recursion.
2. The algorithm is inefficient in terms of execution time and memory
   allocation, as it creates a copy of the
   `predecessorNodes` set per recursion.
3. When run against [1] the execution of `toPackageReferenceForest()`
   didn't finish within 15 minutes, causing high CPU load and memory
   consumption.

If GoMod used the dependency graph format already, the solution would be
as simple as calling `DependencyGraphBuilder.breakCycles()`. Fix the
problem by copying the code of `DependencyGraphBuilder.breakCycles()` as
a temporary quick fix. This saves effort, because refactoring GoMod to
use the dependency graph is planned anyway [2], which will allow for
removing that copied code again.

[1] https://github.com/ossf/scorecard
[2] oss-review-toolkit#4249

Fixes oss-review-toolkit#5627.

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
The rule is nested inside a package rule, whereas only the inner rule
may flag violations. The rule name of the outer rule is unused.

Align both names for consistency with other rules and use a slightly
shorter name which does not mention all aspects of the `require`
conditions. This relaxes the need for renaming the rule in case of
adjustments to the `require` condition.

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
While at it, remove the accidental empty line.

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
The submodules are found by traversing the `node_modules` directory
which can become quite large. To avoid doing this if it is not required,
use a cache for the result.1

Additionally, factor out the `loadWorkspaceSubmodules()` method, so the
discovery of submodules can be done differently in NPM's subclasses.

Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
PNPM [1] is an alternative package manager for JavaScript / TypeScript
projects.
To detect PNPM projects, the `pnpm-lock.yaml` file is being used.

By using the `--shamefully-hoist` option when installing packages using
PNPM, a directory structure similar to NPM and Yarn is created for the
`node_modules` directory. This enables ORT to reuse the NPM
implementation to resolve dependencies.

[1]: https://pnpm.io

Resolves oss-review-toolkit#2024.

Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
The issue [1] was resolved.

[1]: oss-review-toolkit#3741

Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
sschuberth and others added 3 commits August 22, 2022 14:30
Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
The list of copyrights was compiled by a combination of a source code
search for for `Copyright (C)` and from the information in
`.reuse/dep5`.

Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
@TG1999 TG1999 force-pushed the pyinsp branch 2 times, most recently from a56816f to 9137a68 Compare August 22, 2022 17:52
mnonnenmacher and others added 17 commits August 22, 2022 22:48
Do not set the exit code to 2 if a tool version cannot be determined,
and the tool does set a version requirement.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
The configured precision of 36 never really had any effect as the number
refers to the number of name components, not characters, and no logger
name exceeded 36 components.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
These versions could theoretically be different, and independent
versioninig eases the migration to a different logging implementation only
while keeping the API.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
This change is not so much about the past security flaws in the Log4j
implementation [1], but more about generally switching (back) to a more
lightweight logger that also plays more nicely with GraalVM [2].

However, stick to Log4j on the API side as it is more powerful than SLF4J,
see [3].

This commit restores the Logback configuration files from bac29f6 and
updates them with changes meanwhile done to `log4j2.xml`.

[1]: https://blog.ltgt.net/migrating-off-log4j2/
[2]: micronaut-projects/micronaut-core#6041 (comment)
[3]: https://kajalrawal.medium.com/log4j2-is-it-worth-to-use-slf4j-with-log4j2-21e83d0d792c

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
See [1]. Once [2] is resolved the official Gradle plugin should be used
instead of the current Palantir plugin [3] to benefit from automatic
download of reachability-metadata [4].

Note that still more work is required to make the native-image build
succeed.

[1]: https://github.com/oracle/graalvm-reachability-metadata/blob/master/metadata/ch.qos.logback/logback-classic/1.2.11/reflect-config.json
[2]: graalvm/native-build-tools#100
[3]: https://github.com/palantir/gradle-graal
[4]: https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html#metadata-support

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
The format was changed in 4ea9863.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
The TODO belongs to the PostgreSQL connection parameters which were
moved to a separate class in 4ea9863.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Add a warning announcing that the experimental scanner will replace the
current default scanner implementation.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
…try fails

This allows to handle packages that were never published to the NPM
registry but only ever referenced by (short) repository URL.

Fixes oss-review-toolkit#5632.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
This is the same code as in the base class.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Newer versions depend on newer versions of the graphql-java library
[1] that limit the number of tokens to be parsed. ORT's GitHub client
library exceeds that token limit, so the plugin needs to make the
maximum configurable.

[1]: https://github.com/graphql-java/graphql-java

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
This fixes a deployment issue [1] with version 1.12.6 [2].

[1]: mockk/mockk#884
[2]: https://github.com/mockk/mockk/releases/tag/1.12.6

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
@TG1999 TG1999 force-pushed the pyinsp branch 3 times, most recently from d9bf6b5 to 76f44ff Compare August 23, 2022 14:53
This PR replaces pipdeptree with python-inspector to resolve
Python packages dependencies found in requirement files.
python-inspector can resolve dependencies for any target
Python version and OS (and not only the one running the tool).
In this integration in ORT, it replaces pipdeptree pretty much
in place as python-inspector implements a similar output data
structure by design to ease the integration.

Reference: https://github.com/nexB/python-inspector
Reference: oss-review-toolkit#4637
Reference: oss-review-toolkit#3671
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
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.

7 participants