Skip to content

Commit

Permalink
use poetry 1.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
artsiomkorzun committed Jan 9, 2025
1 parent da95107 commit ae25cd5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM python:3.11-alpine as builder

RUN apk update && apk upgrade --no-cache libcrypto3 libssl3
RUN apk add --no-cache alpine-sdk linux-headers
RUN pip install poetry
RUN pip install poetry==1.8.5

WORKDIR /app

Expand Down
25 changes: 17 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
IMAGE_NAME ?= ai-dial-interpreter
IMAGE_NAME ?= ai-dial-code-interpreter
VENV ?= .venv
PYTHON_VERSION ?= 3.11
POETRY ?= ${VENV}/bin/poetry
POETRY_VERSION ?= 1.8.5

.PHONY: all install build test clean lint format
.PHONY: all init_env install build test clean lint format

all: build

install:
poetry install
init_env:
python$(PYTHON_VERSION) -m venv ${VENV}
${VENV}/bin/pip install poetry==${POETRY_VERSION} --quiet

install: init_env
${POETRY} env use python$(PYTHON_VERSION)
${POETRY} install

build: install
poetry build
${POETRY} build

test:
@echo "No tests yet"

clean:
poetry env remove --all
${POETRY} env remove --all

lint: install
poetry run nox -s lint
${POETRY} run nox -s lint

format: install
poetry run nox -s format
${POETRY} run nox -s format

help:
@echo "===================="
Expand Down
12 changes: 9 additions & 3 deletions aidial_code_interpreter/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def upload_file(file: UploadFile):
def download_file(request: DownloadFileRequest):
path = resolve_path(request.path)
if not os.path.isfile(path):
raise HTTPException(404, f"File not found: {os.path.relpath(path, MOUNT_FOLDER)}")
raise HTTPException(
404, f"File not found: {os.path.relpath(path, MOUNT_FOLDER)}"
)

def read_file():
with open(path, "rb") as stream:
Expand All @@ -77,11 +79,15 @@ def list_files(request: ListFilesRequest):
for file in files:
path = os.path.join(root, file)
size = os.path.getsize(path)
list.append({"path": os.path.relpath(path, MOUNT_FOLDER), "size": size})
list.append(
{"path": os.path.relpath(path, MOUNT_FOLDER), "size": size}
)
return {"files": list}


def resolve_path(path: str) -> str:
def resolve_path(path: str | None) -> str:
if path is None:
raise HTTPException(status_code=400, detail="Missing path")
if not os.path.isabs(path):
path = os.path.join(MOUNT_FOLDER, path)
path = os.path.normpath(path)
Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules"
]
repository = "https://github.com/epam/ai-dial-interpreter"
repository = "https://github.com/epam/ai-dial-code-interpreter"

[tool.poetry.dependencies]
python = "^3.11"
Expand Down

0 comments on commit ae25cd5

Please sign in to comment.