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

wip: transition to uv #371

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions invenio_cli/commands/packages.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2021 CERN.
# Copyright (C) 2022 Graz University of Technology.
# Copyright (C) 2022-2024 Graz University of Technology.
#
# Invenio-Cli is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -23,8 +23,7 @@ def install_packages(packages, log_file=None):

It is a class method since it does not require any configuration.
"""
prefix = ["pipenv", "run"]
cmd = prefix + ["pip", "install"]
cmd = ["uv", "pip", "install"]
for package in packages:
cmd.extend(["-e", package])

Expand All @@ -45,6 +44,7 @@ def outdated_packages():

It is a class method since it does not require any configuration.
"""
raise RuntimeError("not yet ported to uv")
cmd = ["pipenv", "update", "--outdated"]

steps = [
Expand All @@ -63,6 +63,7 @@ def update_packages():

It is a class method since it does not require any configuration.
"""
raise RuntimeError("not yet ported to uv")
cmd = ["pipenv", "update"]

steps = [
Expand All @@ -81,6 +82,7 @@ def update_package_new_version(package, version):

It is a class method since it does not require any configuration.
"""
raise RuntimeError("not yet ported to uv")
prefix = ["pipenv"]
app = prefix + ["install", package + version]

Expand All @@ -96,13 +98,8 @@ def update_package_new_version(package, version):

@staticmethod
def install_locked_dependencies(pre, dev):
"""Install dependencies from Pipfile.lock using sync."""
# NOTE: sync has no interactive process feedback
cmd = ["pipenv", "sync"]
if pre:
cmd += ["--pre"]
if dev:
cmd += ["--dev"]
"""Install dependencies from requirements.txt using install."""
cmd = ["uv", "pip", "install", "-r", "requirements.txt"]

steps = [
CommandStep(
Expand All @@ -118,11 +115,7 @@ def install_locked_dependencies(pre, dev):
@staticmethod
def lock(pre, dev):
"""Steps to lock Python dependencies."""
cmd = ["pipenv", "lock"]
if pre:
cmd += ["--pre"]
if dev:
cmd += ["--dev"]
cmd = ["uv", "pip", "compile", "pyproject.toml", "-o", "requirements.txt"]

steps = [
CommandStep(
Expand All @@ -137,7 +130,7 @@ def lock(pre, dev):
@staticmethod
def is_locked():
"""Checks if the dependencies have been locked."""
locked = "Pipfile.lock" in listdir(".")
locked = "requirements.txt" in listdir(".")
if not locked:
return ProcessResponse(
error="Dependencies were not locked. "
Expand Down