From 8a1215fdba2799974b5a8d7a2bef787c6efcb366 Mon Sep 17 00:00:00 2001 From: Soufiane Amini Date: Tue, 16 Dec 2025 11:31:35 +0100 Subject: [PATCH] pep --- .gitignore | 5 ++- pyagentspec/pyproject.toml | 63 ++++++++++++++++++++++++++--- pyagentspec/setup.py | 74 +++-------------------------------- pyagentspec/tests/conftest.py | 4 +- 4 files changed, 69 insertions(+), 77 deletions(-) diff --git a/.gitignore b/.gitignore index d420805b..a88b8dca 100644 --- a/.gitignore +++ b/.gitignore @@ -128,4 +128,7 @@ cython_debug/ .dmypy.json dmypy.json .pyre/ -.pytype/ \ No newline at end of file +.pytype/ + +# uv +uv.lock diff --git a/pyagentspec/pyproject.toml b/pyagentspec/pyproject.toml index 7c42f109..3e8af956 100644 --- a/pyagentspec/pyproject.toml +++ b/pyagentspec/pyproject.toml @@ -1,10 +1,63 @@ +[project] +name = "pyagentspec" +dynamic = ["version"] +description = "Package defining the PyAgentSpec library for Agents and LLM fixed-flows abstractions." +license = {text = "Apache-2.0 OR UPL-1.0"} +readme = "README.md" +authors = [ +{name = "Oracle"}, +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Natural Language :: English", + "Intended Audience :: Science/Research", + "Programming Language :: Python", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Topic :: Software Development :: Libraries :: Python Modules", +] +keywords = ["NLP", "text generation", "code generation", "LLM", "Assistant", "Tool", "Agent"] +requires-python = ">=3.10" +dependencies = [ + "jsonschema>=4.23.0,<5", + "pydantic>=2.10,<2.13", + "pyyaml>=6,<7", + "httpx>0.28.0", +] + +[project.optional-dependencies] +full = ["pyagentspec[crewai, autogen, langgraph]"] +crewai = [ + "crewai[litellm]>=1.6.1; python_version < '3.14'", + "litellm>=1.79.0; python_version < '3.14'", +] +autogen = [ + "autogen-core>=0.5.6; python_version < '3.13'", + "autogen-ext[ollama,openai]>=0.5.6; python_version < '3.13'", + "autogen-agentchat>=0.5.6; python_version < '3.13'", +] +langgraph = [ + "langgraph>=0.5.3", + "langchain-core>=0.3", + "langchain-openai>=0.3.7", + "langchain-ollama>=0.3.3", +] + +[dependency-groups] +dev = [ + "pyagentspec[full]", +] + [build-system] requires = [ - "setuptools<72.0.0", - "wheel", - # setuptools-scm lets us include all necessary files (e.g. .pyx files) in the source - # distribution (sdist) without needing a MANIFEST.in file. - "setuptools-scm == 7.1.0", + "setuptools<72.0.0", + "wheel", + # setuptools-scm lets us include all necessary files (e.g. .pyx files) in the source + # distribution (sdist) without needing a MANIFEST.in file. + "setuptools-scm==7.1.0", ] build-backend = "setuptools.build_meta" diff --git a/pyagentspec/setup.py b/pyagentspec/setup.py index 27fff1bc..a4c588d9 100644 --- a/pyagentspec/setup.py +++ b/pyagentspec/setup.py @@ -4,79 +4,15 @@ # (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) or Universal Permissive License # (UPL) 1.0 (LICENSE-UPL or https://oss.oracle.com/licenses/upl), at your option. -import io -import os.path +import os +from pathlib import Path -from setuptools import find_packages, setup +from setuptools import setup -NAME = "pyagentspec" - -# Check for an environment variable to override the version VERSION = os.environ.get("BUILD_VERSION") -if not VERSION: - with open("../VERSION") as version_file: - VERSION = version_file.read().strip() - - -def read(file_name): - """Read a text file and return the content as a string.""" - file_path = os.path.join(os.path.dirname(__file__), file_name) - with io.open(file_path, encoding="utf-8") as f: - return f.read() - +if VERSION is None: + VERSION = Path("../VERSION").read_text().strip() setup( - name=NAME, version=VERSION, - description="Package defining the PyAgentSpec library for Agents and LLM fixed-flows abstractions.", - license="Apache-2.0 OR UPL-1.0", - long_description=read("README.md"), - long_description_content_type="text/markdown", - url="", - author="Oracle", - author_email="", - classifiers=[ - "Development Status :: 3 - Alpha", - "Natural Language :: English", - "Intended Audience :: Science/Research", - "Programming Language :: Python", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: 3.14", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - keywords="NLP, text generation,code generation, LLM, Assistant, Tool, Agent", - package_dir={"": "src"}, - packages=find_packages("src"), - python_requires=">=3.10", - install_requires=[ - "jsonschema>=4.23.0,<5", - "pydantic>=2.10,<2.13", - "pyyaml>=6,<7", - "httpx>0.28.0", - ], - test_suite="tests", - entry_points={ - "console_scripts": [], - }, - include_package_data=True, - extras_require={ - "crewai": [ - "crewai[litellm]>=1.6.1; python_version < '3.14'", - "litellm>=1.79.0; python_version < '3.14'", - ], - "autogen": [ - "autogen-core>=0.5.6; python_version < '3.13'", - "autogen-ext[ollama,openai]>=0.5.6; python_version < '3.13'", - "autogen-agentchat>=0.5.6; python_version < '3.13'", - ], - "langgraph": [ - "langgraph>=0.5.3", - "langchain-core>=0.3", - "langchain-openai>=0.3.7", - "langchain-ollama>=0.3.3", - ], - }, ) diff --git a/pyagentspec/tests/conftest.py b/pyagentspec/tests/conftest.py index 7f6c4e4c..7e9f2f87 100644 --- a/pyagentspec/tests/conftest.py +++ b/pyagentspec/tests/conftest.py @@ -7,8 +7,8 @@ import os import stat from contextlib import contextmanager -from distutils.sysconfig import get_python_lib from pathlib import Path +from sysconfig import get_path from typing import Any, Iterator, List, Union from unittest.mock import patch @@ -134,7 +134,7 @@ def check_file_permissions(path: Any) -> None: def get_directory_allowlist_write(tmp_path: str) -> List[Union[str, Path]]: return [ - get_python_lib(), # Allow packages to r/w their pycache + get_path("platlib"), # Allow packages to r/w their pycache tmp_path, "/dev/null", ]