From 5ea607be580942618e4f769e3e222f901085b220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Gr=C3=B3dek?= Date: Wed, 26 Jul 2023 08:14:36 +0200 Subject: [PATCH 1/6] Add package setup --- .gitignore | 4 +++- pyproject.toml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 14 +----------- setup.py | 5 +++++ 4 files changed, 67 insertions(+), 14 deletions(-) create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 93932ec7..d1fb50ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .idea/ venv/ pr_agent/settings/.secrets.toml -__pycache__ \ No newline at end of file +__pycache__ +dist/ +*.egg-info/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 0bcb8f7c..a3ef5a12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,61 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "pr_agent" +version = "0.0.1" + +# FIXME: add authors/maintainers +authors = [ + {name = "Ori Kotek", email = "ori.k@codium.ai"}, +] +maintainers = [ + {name = "Ori Kotek", email = "ori.k@codium.ai"}, +] +description = "CodiumAI PR-Agent is an open-source tool to automatically analyze a pull request and provide several types of feedback" +readme = "README.md" +requires-python = ">=3.9" +keywords = ["ai", "tool", "developer", "review", "agent"] +license = {file = "LICENSE", name = "Apache 2.0 License"} +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Operating System :: Independent", + "Programming Language :: Python :: 3", +] + +dependencies = [ + "dynaconf==3.1.12", + "fastapi==0.99.0", + "PyGithub==1.59.*", + "retry==0.9.2", + "openai==0.27.8", + "Jinja2==3.1.2", + "tiktoken==0.4.0", + "uvicorn==0.22.0", + "python-gitlab==3.15.0", + "pytest~=7.4.0", + "aiohttp~=3.8.4", + "atlassian-python-api==3.39.0", + "GitPython~=3.1.32", +] + +[project.urls] +"Homepage" = "https://github.com/Codium-ai/pr-agent" + +[tool.setuptools] +include-package-data = false +license-files = ["LICENSE"] + +[tool.setuptools.packages.find] +where = ["."] +include = ["pr_agent"] + +[project.scripts] +pr-agent = "pr_agent.cli:run" + + [tool.ruff] line-length = 120 diff --git a/requirements.txt b/requirements.txt index 51dc6fee..ecf975e2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1 @@ -dynaconf==3.1.12 -fastapi==0.99.0 -PyGithub==1.59.* -retry==0.9.2 -openai==0.27.8 -Jinja2==3.1.2 -tiktoken==0.4.0 -uvicorn==0.22.0 -python-gitlab==3.15.0 -pytest~=7.4.0 -aiohttp~=3.8.4 -atlassian-python-api==3.39.0 -GitPython~=3.1.32 \ No newline at end of file +-e . \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..dc4e2095 --- /dev/null +++ b/setup.py @@ -0,0 +1,5 @@ +# for compatibility with legacy tools +# see: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html +from setuptools import setup + +setup() \ No newline at end of file From 9e1e0766b7b1e3fb311fa62f57ec068f8f6411a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Gr=C3=B3dek?= Date: Wed, 26 Jul 2023 09:13:54 +0200 Subject: [PATCH 2/6] Set python min version to 3.10 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a3ef5a12..048478e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ maintainers = [ ] description = "CodiumAI PR-Agent is an open-source tool to automatically analyze a pull request and provide several types of feedback" readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["ai", "tool", "developer", "review", "agent"] license = {file = "LICENSE", name = "Apache 2.0 License"} classifiers = [ From bc2cf75b76a494e0f7aeccd98a8a7892efc65529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Gr=C3=B3dek?= Date: Wed, 26 Jul 2023 09:14:24 +0200 Subject: [PATCH 3/6] Use pyproject.toml to install dependencies instead of requirements.txt. Fix incorrect mangum version --- docker/Dockerfile | 4 ++-- docker/Dockerfile.lambda | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b763985c..4a8b86d5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,8 +1,8 @@ FROM python:3.10 as base WORKDIR /app -ADD requirements.txt . -RUN pip install -r requirements.txt && rm requirements.txt +ADD pyproject.toml . +RUN pip install . && rm pyproject.toml ENV PYTHONPATH=/app ADD pr_agent pr_agent diff --git a/docker/Dockerfile.lambda b/docker/Dockerfile.lambda index 404c8529..59e78a54 100644 --- a/docker/Dockerfile.lambda +++ b/docker/Dockerfile.lambda @@ -4,9 +4,9 @@ RUN yum update -y && \ yum install -y gcc python3-devel && \ yum clean all -ADD requirements.txt . -RUN pip install -r requirements.txt && rm requirements.txt -RUN pip install mangum==16.0.0 +ADD pyproject.toml . +RUN pip install . && rm pyproject.toml +RUN pip install mangum==0.17.0 COPY pr_agent/ ${LAMBDA_TASK_ROOT}/pr_agent/ CMD ["pr_agent.servers.serverless.serverless"] From a78d741292cc7f25ecb84ce5ee7ee99909d1c74f Mon Sep 17 00:00:00 2001 From: Ori Kotek Date: Fri, 28 Jul 2023 02:09:01 +0300 Subject: [PATCH 4/6] updated pyproject.toml --- pyproject.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 048478e6..03df2480 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,16 +6,18 @@ build-backend = "setuptools.build_meta" name = "pr_agent" version = "0.0.1" -# FIXME: add authors/maintainers authors = [ - {name = "Ori Kotek", email = "ori.k@codium.ai"}, + {name = "Itamar Friedman", email = "itamar.f@codium.ai"}, ] maintainers = [ {name = "Ori Kotek", email = "ori.k@codium.ai"}, + {name = "Tal Ridnik", email = "tal.r@codium.ai"}, + {name = "Hussam Lawen", email = "hussam.l@codium.ai"}, + {name = "Sagi Medina", email = "sagi.m@codium.ai"} ] description = "CodiumAI PR-Agent is an open-source tool to automatically analyze a pull request and provide several types of feedback" readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.9" keywords = ["ai", "tool", "developer", "review", "agent"] license = {file = "LICENSE", name = "Apache 2.0 License"} classifiers = [ From b4ca52c7d8efc937349c05cbfd674f12b679a895 Mon Sep 17 00:00:00 2001 From: Ori Kotek Date: Fri, 28 Jul 2023 02:18:12 +0300 Subject: [PATCH 5/6] updated Dockerfile.github_action --- Dockerfile.github_action | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.github_action b/Dockerfile.github_action index c7211787..d6763f0a 100644 --- a/Dockerfile.github_action +++ b/Dockerfile.github_action @@ -1,8 +1,8 @@ FROM python:3.10 as base WORKDIR /app -ADD requirements.txt . -RUN pip install -r requirements.txt && rm requirements.txt +ADD pyproject.toml . +RUN pip install . && rm pyproject.toml ENV PYTHONPATH=/app ADD pr_agent pr_agent ADD github_action/entrypoint.sh / From 3770bf80316f722524a9d9872bc6b01649ca1050 Mon Sep 17 00:00:00 2001 From: Ori Kotek Date: Fri, 28 Jul 2023 02:22:38 +0300 Subject: [PATCH 6/6] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index dc4e2095..9b9785ce 100644 --- a/setup.py +++ b/setup.py @@ -2,4 +2,4 @@ # see: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html from setuptools import setup -setup() \ No newline at end of file +setup()