Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use rye #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ ENV/
config.yaml
.volume
elasticsearch-analysis-ik
.pytest_cache
.pytest_cache
.venv
18 changes: 2 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,8 @@ monitor: ## flower
# docker images

build-tifa: ## > tifa
docker build -t 'twocucao/tifa:latest' -f 'compose/app/Dockerfile' .
docker build -t 'tifa:local' -f 'compose/app/Dockerfile' .

build-tifa-no-cache: ## > tifa
docker build -t 'twocucao/tifa:latest' -f 'compose/app/Dockerfile' --no-cache .

build-elasticsearch: ## > elasticsearch
docker build -t 'elasticsearch:local' -f 'compose/elasticsearch/Dockerfile' .

build-elasticsearch-no-cache: ## > elasticsearch
docker build -t 'elasticsearch:local' -f 'compose/elasticsearch/Dockerfile' . --no-cache

publish-tifa-image: ## > build and publish tifa image
echo ${DOCKER_PASS} | docker login -u twocucao --password-stdin
docker pull twocucao/tifa:latest || true
docker build -t 'tifa:latest' -f 'compose/app/Dockerfile' . --cache-from=twocucao/tifa:latest
docker tag 'tifa:latest' twocucao/tifa:latest
docker push twocucao/tifa:latest || true

docker build -t 'tifa:local' -f 'compose/app/Dockerfile' --no-cache .

36 changes: 24 additions & 12 deletions compose/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
FROM python:3.10.9-buster
FROM python:3.11.8-bullseye
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update &&\
apt-get upgrade -y &&\
apt-get install -y \
vim \
git \
gcc \
liblzma-dev \
build-essential \
libffi-dev \
cmake \
curl \
freetds-bin \
gcc \
git \
krb5-user \
ldap-utils \
libffi6 \
libbz2-dev \
libffi-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsasl2-2 \
libsasl2-modules \
libsqlite3-dev \
libssl-dev \
libssl1.1 \
llvm \
locales \
lsb-release \
sasl2-bin \
sqlite3 \
unixodbc

unixodbc \
vim \
wget \
xz-utils \
zlib1g-dev \
tk-dev

ENV RYE_NO_AUTO_INSTALL=1
RUN curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash
RUN /root/.rye/shims/rye pin 3.11.8
ENV PYPI=https://mirrors.cloud.tencent.com/pypi/simple
ENV PIP_DEFAULT_TIMEOUT=1000
RUN pip install -U pip -i $PYPI
RUN pip install -U poetry -i $PYPI
ENV POETRY_VIRTUALENVS_CREATE=false
WORKDIR /opt/tifa
COPY . .
RUN poetry install
RUN --mount=type=cache,target=/root/.cache /root/.rye/shims/rye sync
CMD ["start"]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.7"

x-tifa-common:
&tifa-common
image: twocucao/tifa:latest
image: tifa:local
volumes:
- .:/opt/tifa
environment:
Expand Down
136 changes: 55 additions & 81 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,89 +1,63 @@
[tool.poetry]
[project]
name = "tifa"
version = "0.1.0"
description = ""
authors = ["twocucao <[email protected]>"]
include = ["tifa/templates/", "tifa/static/"]
description = "Add your description here"
authors = [
{ name = "twocucao", email = "[email protected]" }
]
dependencies = [
"fastapi>=0.110.0",
"ipython>=8.22.2",
"pandas>=2.2.1",
"aiofiles>=23.2.1",
"tenacity>=8.2.3",
"gunicorn>=21.2.0",
"celery>=5.3.6",
"aiohttp>=3.9.3",
"sqlalchemy[asyncio]>=2.0.28",
"loguru>=0.7.2",
"aiobotocore>=2.12.1",
"aiomysql>=0.2.0",
"aioredis>=2.0.1",
"greenlet>=3.0.3",
"jinja2>=3.1.3",
"orjson>=3.9.15",
"passlib>=1.7.4",
"pillow>=10.2.0",
"pydantic>=2.6.4",
"pydantic-core>=2.16.3",
"pydantic-settings>=2.2.1",
"alembic>=1.13.1",
"asyncer>=0.0.5",
"python-dotenv>=1.0.1",
"python-jose>=3.3.0",
"requests>=2.31.0",
"rich>=13.7.1",
"typer>=0.9.0",
"uvicorn>=0.28.0",
]
readme = "README.md"
requires-python = ">= 3.11"

[[tool.poetry.source]]
name = "tencent"
url = 'https://mirrors.cloud.tencent.com/pypi/simple'
priority = 'default'
[project.scripts]
fastcli = 'tifa.cli.cli:app'

[tool.poetry.dependencies]
python = "^3.10"
ipython = "*"
markdown = "*"
xlsxwriter = "*"
xlwt = "*"
fastapi = "^0.70.1"
uvicorn = "*"
typer = "*"
python-jose = {extras = ["cryptography"], version = "^3.1.0"}
passlib = {extras = ["bcrypt"], version = "^1.7.2"}
aiofiles = "*"
orjson = "*"
python-dotenv = "^0.12.0"
asyncpg = "*"
aioredis = "*"
aiokafka = "*"
prometheus_client = "*"
devtools = "*"
python-socketio = {extras = ["asyncio_client"], version = "^5.2.1"}
jinja2 = "*"
requests = "^2.25.1"
aiohttp = "^3.7.4"
celery = "^5.3.1"
fastapi-utils = "^0.2.1"
gunicorn = "*"
pandas = "*"
pillow = "*"
psycopg2-binary = "^2.9.6"
pypinyin = "^0.42.0"
qrcode = "^7.1"
raven = "^6.10.0"
redis = "^3.5.3"
tenacity = "^7.0.0"
xlrd = "^2.0.1"
opentelemetry-api = "^1.4.0"
opentelemetry-exporter-jaeger = "^1.4.0"
opentelemetry-sdk = "^1.4.0"
opentelemetry-instrumentation-fastapi = "^0.23b2"
opentelemetry-instrumentation-aiohttp-client = "^0.23b2"
elasticsearch = "^8.9.0"
django = "^4.2.3"
dj-database-url = "^2.0.0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry.dev-dependencies]
black = "*"
autoflake = "*"
coverage = "*"
"flake8" = "*"
mypy = "*"
pytest = "*"
pytest-cov = "*"
pre-commit = "*"
pytest-asyncio = "^0.15.1"
[tool.rye]
managed = true
dev-dependencies = [
"ruff>=0.3.2",
"pytest>=8.1.1",
"mypy>=1.9.0",
"pytest-asyncio>=0.23.5.post1",
]

[tool.black]
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
[tool.poetry.scripts]
fastcli = 'tifa.cli:cli'
tifa-cli = 'tifa.cli:cli'

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/tifa"]
92 changes: 92 additions & 0 deletions pyproject.toml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
project = { dependencies = [
"fastapi>=0.110.0",
] , requires-python = ">= 3.11" }
[tool.poetry]
name = "tifa"
version = "0.1.0"
description = ""
authors = ["twocucao <[email protected]>"]
include = ["tifa/templates/", "tifa/static/"]

[[tool.poetry.source]]
name = "tencent"
url = 'https://mirrors.cloud.tencent.com/pypi/simple'
priority = 'default'

[tool.poetry.dependencies]
python = "^3.10"
ipython = "*"
markdown = "*"
xlsxwriter = "*"
xlwt = "*"
fastapi = "^0.70.1"
uvicorn = "*"
typer = "*"
python-jose = {extras = ["cryptography"], version = "^3.1.0"}
passlib = {extras = ["bcrypt"], version = "^1.7.2"}
aiofiles = "*"
orjson = "*"
python-dotenv = "^0.12.0"
asyncpg = "*"
aioredis = "*"
aiokafka = "*"
prometheus_client = "*"
devtools = "*"
python-socketio = {extras = ["asyncio_client"], version = "^5.2.1"}
jinja2 = "*"
requests = "^2.25.1"
aiohttp = "^3.7.4"
celery = "^5.3.1"
fastapi-utils = "^0.2.1"
gunicorn = "*"
pandas = "*"
pillow = "*"
psycopg2-binary = "^2.9.6"
pypinyin = "^0.42.0"
qrcode = "^7.1"
raven = "^6.10.0"
redis = "^3.5.3"
tenacity = "^7.0.0"
xlrd = "^2.0.1"
opentelemetry-api = "^1.4.0"
opentelemetry-exporter-jaeger = "^1.4.0"
opentelemetry-sdk = "^1.4.0"
opentelemetry-instrumentation-fastapi = "^0.23b2"
opentelemetry-instrumentation-aiohttp-client = "^0.23b2"
elasticsearch = "^8.9.0"
django = "^4.2.3"
dj-database-url = "^2.0.0"

[tool.poetry.dev-dependencies]
black = "*"
autoflake = "*"
coverage = "*"
"flake8" = "*"
mypy = "*"
pytest = "*"
pytest-cov = "*"
pre-commit = "*"
pytest-asyncio = "^0.15.1"

[tool.black]
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
[tool.poetry.scripts]
fastcli = 'tifa.cli:cli'
tifa-cli = 'tifa.cli:cli'

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Loading
Loading