Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
add uv maanger
thomashebrard272162f5b168
diff --git a/.github/scripts/get_uv_version.sh b/.github/scripts/get_uv_version.shnew file mode 100644index 000000000..6fb9d7af4--- /dev/null+++ b/.github/scripts/get_uv_version.sh@@ -0,0 +1,8 @@+#!/bin/bash++UV_VERSION=$(awk '/^\[tool.uv\]/{f=1;next} f==1&&/^version/{print $3;exit}' pyproject.toml | tr -d '"')+if [ -z "$UV_VERSION" ]; then+ echo "Error: UV version not found in pyproject.toml"+ exit 1+fi+echo "UV_VERSION=$UV_VERSION" >> $GITHUB_ENV\ No newline at end of filediff --git a/.github/workflows/lint-check.yml b/.github/workflows/lint-check.ymlindex eea9228b6..6bb0d7a3f 100644--- a/.github/workflows/lint-check.yml+++ b/.github/workflows/lint-check.yml@@ -19,8 +19,15 @@ jobs:with:python-version: "3.11"- - name: Install poetry package- run: pip install "poetry>=2.0.0,<2.1.0"+ - name: Get UV version+ id: uv-version+ run: echo "UV_VERSION=$(make get-uv-version)" >> $GITHUB_ENV++ - name: Install uv+ run: |+ curl -LsSf https://astral.sh/uv/install.sh | sh+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH+ uv --version- name: Install dependenciesrun: make installdiff --git a/.github/workflows/tests-check.yml b/.github/workflows/tests-check.ymlindex f7af38666..d3d1a1629 100644--- a/.github/workflows/tests-check.yml+++ b/.github/workflows/tests-check.yml@@ -44,10 +44,17 @@ jobs:with:python-version: "3.11"- - name: Install poetry package- run: pip install "poetry>=2.0.0,<2.1.0"+ - name: Get UV version+ id: uv-version+ run: echo "UV_VERSION=$(make get-uv-version)" >> $GITHUB_ENV- - name: Install virtual env and dependencies from pyproject.toml+ - name: Install uv+ run: |+ curl -LsSf https://astral.sh/uv/install.sh | sh+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH+ uv --version++ - name: Install virtual env and dependenciesrun: make install- name: Run testsdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 68a768f6e..90fa34a2e 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -34,16 +34,16 @@ We are open to contributions in all areas of our core Pipelex library:## Requirements- Python ≥ 3.11 < 3.12-- poetry ≥ 2.0.1+- uv ≥ 0.7.2## Development Setup- Fork & clone the repository- Run `make install` to set up virtualenv and dependencies- Copy `.env.example` to `.env` and configure API keys-- Use Poetry for dependency management:- - Runtime deps: `poetry add <package>`- - Dev deps: `poetry add --group dev <package>`+- Use uv for dependency management:+ - Runtime deps: `uv pip install <package>`+ - Dev deps: `uv pip install --extra dev <package>`- Keep dependencies alphabetically ordered in pyproject.toml## Pull Request Processdiff --git a/Makefile b/Makefileindex 9ab0ee512..19acc66f5 100644--- a/Makefile+++ b/Makefile@@ -11,12 +11,16 @@ LOCAL_PYTEST := $(VIRTUAL_ENV)/bin/pytestLOCAL_PYRIGHT := $(VIRTUAL_ENV)/bin/pyrightLOCAL_RUFF := $(VIRTUAL_ENV)/bin/ruff+define GET_UV_VERSION+$(shell awk '/^\[tool.uv\]/{f=1;next} f==1&&/^version/{print $$3;exit}' pyproject.toml | tr -d '"')+endef+define PRINT_TITLE- $(eval PADDED_PROJECT_NAME := $(shell printf '%-15s' "[$(PROJECT_NAME)] " | sed 's/ /=/g'))- $(eval PADDED_TARGET_NAME := $(shell printf '%-15s' "($@) " | sed 's/ /=/g'))+ $(eval PADDED_PROJECT_NAME := $(shell printf '%-15s' "[$(PROJECT_NAME)] " | sed 's/ /=/g'))+ $(eval PADDED_TARGET_NAME := $(shell printf '%-15s' "($@) " | sed 's/ /=/g'))$(if $(1),\- $(eval TITLE := $(shell printf '%s' "=== $(PADDED_PROJECT_NAME) $(PADDED_TARGET_NAME)" | sed 's/[[:space:]]/ /g')$(shell echo " $(1) " | sed 's/[[:space:]]/ /g')),\- $(eval TITLE := $(shell printf '%s' "=== $(PADDED_PROJECT_NAME) $(PADDED_TARGET_NAME)" | sed 's/[[:space:]]/ /g'))\+ $(eval TITLE := $(shell printf '%s' "=== $(PADDED_PROJECT_NAME) $(PADDED_TARGET_NAME)" | sed 's/[[:space:]]/ /g')$(shell echo " $(1) " | sed 's/[[:space:]]/ /g')),\+ $(eval TITLE := $(shell printf '%s' "=== $(PADDED_PROJECT_NAME) $(PADDED_TARGET_NAME)" | sed 's/[[:space:]]/ /g'))\)$(eval PADDED_TITLE := $(shell printf '%-126s' "$(TITLE)" | sed 's/ /=/g'))@echo ""@@ -74,7 +78,7 @@ make fix-unused-imports - Fix unused imports with ruffendefexport HELP-.PHONY: all help env lock install update format lint pyright mypy build cleanderived cleanenv run-setup s runtests test test-with-prints t test-inference ti test-imgg tg test-ocr to check cc li merge-check-ruff-lint merge-check-ruff-format merge-check-mypy check-unused-imports fix-unused-imports test-name bump-version+.PHONY: all help env lock install update format lint pyright mypy build cleanderived cleanenv run-setup s runtests test test-with-prints t test-inference ti test-imgg tg test-ocr to check cc li merge-check-ruff-lint merge-check-ruff-format merge-check-mypy check-unused-imports fix-unused-imports test-name bump-version check-uv get-uv-versionall help:@echo "$$HELP"@@ -84,7 +88,25 @@ all help:### SETUP##########################################################################################-env:+check-uv:+ $(call PRINT_TITLE,"Checking UV version")+ @UV_VERSION=$(GET_UV_VERSION); \+ if [ -z "$$UV_VERSION" ]; then \+ echo "Error: UV version not found in pyproject.toml"; \+ exit 1; \+ fi; \+ echo "UV_VERSION: $$UV_VERSION"; \+ if ! command -v uv >/dev/null 2>&1; then \+ echo "Installing UV version $$UV_VERSION"; \+ curl -LsSf https://astral.sh/uv/$$UV_VERSION/install.sh | sh; \+ elif [ "$$(uv --version | cut -d ' ' -f 2)" != "$$UV_VERSION" ]; then \+ echo "Updating UV to version $$UV_VERSION"; \+ curl -LsSf https://astral.sh/uv/$$UV_VERSION/install.sh | sh; \+ else \+ echo "UV version $$UV_VERSION is already installed"; \+ fi++env: check-uv$(call PRINT_TITLE,"Creating virtual environment")@if [ ! -d $(VIRTUAL_ENV) ]; then \echo "Creating Python virtual env in \`${VIRTUAL_ENV}\`"; \@@ -318,3 +340,11 @@ fix-unused-imports: envCURRENT_VERSION := $(shell grep '^version = ' pyproject.toml | sed -E 's/version = "(.*)"/\1/')NEXT_VERSION := $(shell echo $(CURRENT_VERSION) | awk -F. '{$$NF = $$NF + 1;} 1' | sed 's/ /./g')+get-uv-version:+ @UV_VERSION=$(GET_UV_VERSION); \+ if [ -z "$$UV_VERSION" ]; then \+ echo "Error: UV version not found in pyproject.toml" >&2; \+ exit 1; \+ fi; \+ echo "$$UV_VERSION"+diff --git a/pipelex/tools/config/manager.py b/pipelex/tools/config/manager.pyindex 3a413fb47..916bc84b7 100644--- a/pipelex/tools/config/manager.py+++ b/pipelex/tools/config/manager.py@@ -67,20 +67,21 @@ class ConfigManager:print(f"pyproject.toml not found in {self.local_root_dir}")return- pyproject = toml.load(pyproject_path)-pyproject = toml.load(pyproject_path)if "tool" in pyproject and "pipelex" in pyproject["tool"] and "config_inheritance" in pyproject["tool"]["pipelex"]:for config_name in pyproject["tool"]["pipelex"]["config_inheritance"]:print(f"Loading config inheritance for {config_name}")- # First check if it's a local dependency in poetry+ # First check if it's a local dependencypackage_path: Optional[str] = None- if "tool" in pyproject and "poetry" in pyproject["tool"] and "dependencies" in pyproject["tool"]["poetry"]:- dep_config: Dict[str, Any] = pyproject["tool"]["poetry"]["dependencies"].get(config_name, {})- if "path" in dep_config:- # It's a local path- local_path: str = str(dep_config["path"])- package_path = os.path.abspath(os.path.join(self.local_root_dir, local_path))+ if "project" in pyproject and "dependencies" in pyproject["project"]:+ # Try to find path in dependencies list+ dependencies = pyproject["project"]["dependencies"]+ for dep in dependencies:+ if isinstance(dep, str) and dep.startswith(f"{config_name} @ file://"):+ # Extract local path from file:// URL+ local_path = dep.split("file://", 1)[1]+ package_path = os.path.abspath(os.path.join(self.local_root_dir, local_path))+ breakif not package_path:# Try to find in .venv@@ -147,7 +148,7 @@ class ConfigManager:Checks the following files in order:1. pipelex's pyproject.toml- 2. Local pyproject.toml (poetry or other tools)+ 2. Local pyproject.toml3. setup.cfg4. setup.py@@ -158,7 +159,7 @@ class ConfigManager:pipelex_pyproject_path = os.path.join(os.path.dirname(self.local_root_dir), "pyproject.toml")try:pyproject = toml.load(pipelex_pyproject_path)- if project_name := pyproject.get("tool", {}).get("poetry", {}).get("name"):+ if project_name := pyproject.get("project", {}).get("name"):if isinstance(project_name, str):return project_nameexcept FileNotFoundError:@@ -172,11 +173,6 @@ class ConfigManager:pyproject_path = os.path.join(self.local_root_dir, "pyproject.toml")try:pyproject = toml.load(pyproject_path)- # Check poetry config- if poetry_name := pyproject.get("tool", {}).get("poetry", {}).get("name"):- if isinstance(poetry_name, str):- return poetry_name- # Check project config (PEP 621)if project_name := pyproject.get("project", {}).get("name"):if isinstance(project_name, str):return project_namediff --git a/pyproject.toml b/pyproject.tomlindex a8a93fd77..a13cd76f0 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -242,3 +242,6 @@ select = ["E501","I",]++[tool.uv]+version = "0.7.2"