Skip to content

Commit

Permalink
build: use poetry for dependency management
Browse files Browse the repository at this point in the history
  • Loading branch information
LeslieLeung committed Jan 9, 2024
1 parent 2ec322e commit 733614f
Show file tree
Hide file tree
Showing 9 changed files with 830 additions and 62 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ config/config.json
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
*$py.class

.mypy_cache
47 changes: 0 additions & 47 deletions .onedev-buildspec.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fail_fast: true
repos:
- repo: local
hooks:
- id: black
name: black
entry: poetry run black
language: system
types: [file, python]
- id: isort
name: isort
entry: poetry run isort
language: system
types: [file, python]
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM python:3.10-slim
FROM python:3.11.6-slim
WORKDIR /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
COPY ./ /app
RUN pip install poetry && poetry config virtualenvs.create false

COPY pyproject.toml poetry.lock ./
RUN poetry install --no-dev
COPY . .
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9000"]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pre-commit:
poetry run pre-commit run

run:
python -m uvicorn main:app --host 0.0.0.0 --port 9000 --reload
6 changes: 0 additions & 6 deletions gh.Dockerfile

This file was deleted.

775 changes: 775 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[tool.poetry]
name = "heimdallr"
version = "v1.2.4"
description = ""
authors = ["Leslie Leung <lesily9@gmail.com>"]
license = "GPL-3.0"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
fastapi = "^0.108.0"
uvicorn = "^0.25.0"
requests = "^2.31.0"
python-multipart = "^0.0.6"


[tool.poetry.group.dev.dependencies]
pre-commit = "^3.6.0"
black = "^23.12.1"
isort = "^5.13.2"

[tool.isort]
profile = "black"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

0 comments on commit 733614f

Please sign in to comment.