From 851e177e71b12729f07912fc251785856a74d378 Mon Sep 17 00:00:00 2001 From: Aymeric Date: Wed, 11 Dec 2024 16:15:49 +0100 Subject: [PATCH] Uv config --- Makefile | 53 ++++++++++++++++++++++++++ pyproject.toml | 98 +++++++++++-------------------------------------- requirements.in | 13 +++++++ 3 files changed, 88 insertions(+), 76 deletions(-) create mode 100644 Makefile create mode 100644 requirements.in diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b7036c7 --- /dev/null +++ b/Makefile @@ -0,0 +1,53 @@ +.PHONY: quality style test docs utils + +check_dirs := . + +# Check that source code meets quality standards + +extra_quality_checks: + python utils/check_copies.py + python utils/check_dummies.py + python utils/check_repo.py + doc-builder style agents docs/source --max_len 119 + +# this target runs checks on all files +quality: + ruff check $(check_dirs) + ruff format --check $(check_dirs) + doc-builder style agents docs/source --max_len 119 --check_only + +# Format source code automatically and check is there are any problems left that need manual fixing +style: + ruff check $(check_dirs) --fix + ruff format $(check_dirs) + doc-builder style agents docs/source --max_len 119 + +# Run tests for the library +test_big_modeling: + python -m pytest -s -v ./tests/test_big_modeling.py ./tests/test_modeling_utils.py $(if $(IS_GITHUB_CI),--report-log "$(PYTORCH_VERSION)_big_modeling.log",) + +test_core: + python -m pytest -s -v ./tests/ --ignore=./tests/test_examples.py $(if $(IS_GITHUB_CI),--report-log "$(PYTORCH_VERSION)_core.log",) + +test_cli: + python -m pytest -s -v ./tests/test_cli.py $(if $(IS_GITHUB_CI),--report-log "$(PYTORCH_VERSION)_cli.log",) + + +# Since the new version of pytest will *change* how things are collected, we need `deepspeed` to +# run after test_core and test_cli +test: + $(MAKE) test_core + $(MAKE) test_cli + $(MAKE) test_big_modeling + $(MAKE) test_deepspeed + $(MAKE) test_fsdp + +test_examples: + python -m pytest -s -v ./tests/test_examples.py $(if $(IS_GITHUB_CI),--report-log "$(PYTORCH_VERSION)_examples.log",) + +# Same as test but used to install only the base dependencies +test_prod: + $(MAKE) test_core + +test_rest: + python -m pytest -s -v ./tests/test_examples.py::FeatureExamplesTests $(if $(IS_GITHUB_CI),--report-log "$(PYTORCH_VERSION)_rest.log",) diff --git a/pyproject.toml b/pyproject.toml index 55120dd..6cbb33d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,81 +1,27 @@ -[tool.ruff] -line-length = 119 -target-version = "py38" +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" - -[tool.ruff.lint] -preview = true -extend-select = [ - "B009", # static getattr - "B010", # static setattr - "CPY", # Copyright - "E", # PEP8 errors - "F", # PEP8 formatting - "I", # Import sorting - "TID251", # Banned API - "UP", # Pyupgrade - "W", # PEP8 warnings -] -ignore = [ - "E501", # Line length (handled by ruff-format) - "E741", # Ambiguous variable name - "W605", # Invalid escape sequence - "UP007", # X | Y type annotations -] - - -[tool.ruff.lint.per-file-ignores] -"__init__.py" = [ - "F401", # Ignore seemingly unused imports (they're meant for re-export) -] -"manim_animations/*" = ["ALL"] - - -[tool.ruff.lint.isort] -lines-after-imports = 2 -known-first-party = ["accelerate"] - - -[tool.ruff.format] -exclude = [ - "manim_animations/*" -] - - -[tool.ruff.lint.flake8-tidy-imports.banned-api] -"os.getenv".msg = "Use os.environ instead" -"os.putenv".msg = "Use os.environ instead" -"os.unsetenv".msg = "Use os.environ instead" - - -[tool.poetry] +[project] name = "agents" version = "0.1.0" -description = "Agents : The simplest way to build agentic systems." -authors = ["Aymeric Roucher"] -license = "Apache 2.0" +description = "Add your description here" readme = "README.md" +requires-python = ">=3.12" +dependencies = [ + "transformers>=4.0.0", + "pytest>=8.1.0", + "requests>=2.32.3", + "rich>=13.9.4", + "pandas>=2.2.3", + "jinja2>=3.1.4", + "pillow>=11.0.0", + "llama-cpp-python>=0.3.4", + "markdownify>=0.14.1", + "gradio>=5.8.0", + "duckduckgo-search>=6.3.7", + "python-dotenv>=1.0.1" +] - -[tool.poetry.dependencies] -python = ">=3.10,<3.13" -transformers = ">=4.0.0" -pytest = {version = ">=8.1.0", optional = true} -requests = "^2.32.3" -rich = "^13.9.4" -pandas = "^2.2.3" -jinja2 = "^3.1.4" -pillow = "^11.0.0" -llama-cpp-python = "^0.3.4" -markdownify = "^0.14.1" -gradio = "^5.8.0" -duckduckgo-search = "^6.3.7" -python-dotenv = "^1.0.1" - - -[tool.poetry.group.dev.dependencies] -ipykernel = "^6.29.5" - -[build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" \ No newline at end of file +[tool.setuptools] +packages = ["agents"] \ No newline at end of file diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..d200183 --- /dev/null +++ b/requirements.in @@ -0,0 +1,13 @@ +transformers>=4.0.0 +pytest>=8.1.0 +requests>=2.32.3 +rich>=13.9.4 +pandas>=2.2.3 +jinja2>=3.1.4 +pillow>=11.0.0 +llama-cpp-python>=0.3.4 +markdownify>=0.14.1 +gradio>=5.8.0 +duckduckgo-search>=6.3.7 +python-dotenv>=1.0.1 +ipykernel>=6.29.5 \ No newline at end of file