Skip to content

Conversation

@bmicha4
Copy link

@bmicha4 bmicha4 commented Dec 28, 2025

  • add a new UV package manager implementation that parses uv.lock, derives scope dependencies, and maps sources / artifacts into ORT packages
  • add a synthetic uv fixture plus UvFunTest to verify analyzer behavior
  • mention UV in the analyzer documentation’s supported-package-managers list
docker 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

Signed-off-by: michaelb-mentee <michaelb@menteebot.com>
@bmicha4 bmicha4 requested review from a team as code owners December 28, 2025 10:09
@heliocastro
Copy link
Contributor

heliocastro commented Dec 28, 2025

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

File '/home/runner/work/ort/ort/plugins/package-managers/python/src/main/kotlin/Uv.kt' with '12' functions detected. Defined threshold inside files is set to '11'
Comment on lines +93 to +95
?: 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

Use check() or error() instead of throwing an IllegalStateException.
}

private fun UvPackage.toPackageReference(
packageIndex: PackageIndex,

Check warning

Code scanning / detekt

Format signature to be single when possible, multiple lines otherwise. Warning

No whitespace expected between opening parenthesis and first parameter name

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

Single whitespace expected before parameter
Comment on lines +213 to +214
visited: Set<Identifier>
): PackageReference {

Check warning

Code scanning / detekt

Format signature to be single when possible, multiple lines otherwise. Warning

No whitespace expected between last parameter and closing parenthesis
Comment on lines +284 to +287
":" 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

Missing empty line after block.
Comment on lines +355 to +356
private fun normalizeGitUrl(url: String?): String? =
url?.substringBefore('?')

Check warning

Code scanning / detekt

Format signature to be single when possible, multiple lines otherwise. Warning

First line of body expression fits on same line as function signature

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

Line detected, which is longer than the defined maximum line length in the code style.
description = "The uv package manager for Python.",
factory = PackageManagerFactory::class
)
class Uv(

Check warning

Code scanning / QDJVM

Unused symbol Warning

Class "Uv" is never used
@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.41%. Comparing base (1ae59c2) to head (f8c1858).

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           
Flag Coverage Δ
test-ubuntu-24.04 42.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants