-
Notifications
You must be signed in to change notification settings - Fork 373
python: Add uv package manager support #11269
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: michaelb-mentee <michaelb@menteebot.com>
|
I closed a previous PR on top of python inspector, since e was not the time and not the complete right approach. But you should not consider parse uv.lock but abstract to parse the lock file pep that was accepted and been used right now by uv and poetry and others. https://peps.python.org/pep-0751/ So, doing explicitly uv is doomed to have again just another python package manager, and more maintenance that is exactly what we do not want. Doing the pep way, is a good forward approach where we can make general first python analyzer and make python inspector as a backup solution. |
| * License-Filename: LICENSE | ||
| */ | ||
|
|
||
| package org.ossreviewtoolkit.plugins.packagemanagers.python |
Check warning
Code scanning / detekt
Too many functions inside a/an file/class/object/interface always indicate a violation of the single responsibility principle. Maybe the file/class/object/interface wants to manage too many things at once. Extract functionality which clearly belongs together. Warning
| ?: throw IllegalStateException( | ||
| "No entry representing the current project was found in '${definitionFile.invariantSeparatorsPath}'." | ||
| ) |
Check warning
Code scanning / detekt
Use check() or error() instead of throwing an IllegalStateException. Warning
| } | ||
|
|
||
| private fun UvPackage.toPackageReference( | ||
| packageIndex: PackageIndex, |
Check warning
Code scanning / detekt
Format signature to be single when possible, multiple lines otherwise. Warning
|
|
||
| private fun UvPackage.toPackageReference( | ||
| packageIndex: PackageIndex, | ||
| visited: Set<Identifier> |
Check warning
Code scanning / detekt
Format signature to be single when possible, multiple lines otherwise. Warning
| visited: Set<Identifier> | ||
| ): PackageReference { |
Check warning
Code scanning / detekt
Format signature to be single when possible, multiple lines otherwise. Warning
| ":" in hashValue -> { | ||
| val (algorithm, value) = hashValue.split(':', limit = 2) | ||
| Hash(value, algorithm) | ||
| } |
Check warning
Code scanning / detekt
Reports code blocks that are not followed by an empty line Warning
| private fun normalizeGitUrl(url: String?): String? = | ||
| url?.substringBefore('?') |
Check warning
Code scanning / detekt
Format signature to be single when possible, multiple lines otherwise. Warning
|
|
||
| return candidates.any { | ||
| val candidatePath = File(it) | ||
| val resolved = if (candidatePath.isAbsolute) candidatePath.normalize() else directory.resolve(candidatePath).normalize() |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style. Warning
plugins/package-managers/python/src/funTest/kotlin/UvFunTest.kt
Dismissed
Show dismissed
Hide dismissed
| description = "The uv package manager for Python.", | ||
| factory = PackageManagerFactory::class | ||
| ) | ||
| class Uv( |
Check warning
Code scanning / QDJVM
Unused symbol Warning
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11269 +/- ##
=========================================
Coverage 57.41% 57.41%
Complexity 1705 1705
=========================================
Files 346 346
Lines 12875 12875
Branches 1228 1228
=========================================
Hits 7392 7392
Misses 5005 5005
Partials 478 478
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
UVpackage manager implementation that parsesuv.lock, derives scope dependencies, and maps sources / artifacts into ORT packagesuvfixture plusUvFunTestto verify analyzer behaviordocker run --rm -e GRADLE_USER_HOME=/workspace/.gradle \ -v "$PWD":/workspace -w /workspace gradle:9.2.1-jdk21-ubi \ ./gradlew --no-configuration-cache -Dorg.gradle.wrapper.timeout=60000 \ :plugins:package-managers:python:funTest \ --tests org.ossreviewtoolkit.plugins.packagemanagers.python.UvFunTest