Skip to content

Commit

Permalink
chore: switch to rye as the package manager
Browse files Browse the repository at this point in the history
  • Loading branch information
KotaHv committed Jul 25, 2024
1 parent 9248446 commit 071f6bb
Show file tree
Hide file tree
Showing 8 changed files with 425 additions and 57 deletions.
31 changes: 15 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,30 @@ ENV LANG="C.UTF-8" \

WORKDIR /app

COPY backend/requirements.txt .
COPY backend/requirements.lock .
RUN set -ex && \
apk add --no-cache \
bash \
busybox-suid \
python3 \
py3-aiohttp \
py3-bcrypt \
py3-pip \
su-exec \
shadow \
tini \
openssl \
tzdata && \
bash \
busybox-suid \
python3 \
py3-aiohttp \
py3-bcrypt \
py3-pip \
su-exec \
shadow \
tini \
openssl \
tzdata && \
python3 -m pip install --no-cache-dir --upgrade pip && \
sed -i '/bcrypt/d' requirements.txt && \
pip install --no-cache-dir -r requirements.txt && \
PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -r requirements.lock && \
# Add user
mkdir -p /home/ab && \
addgroup -S ab -g 911 && \
adduser -S ab -G ab -h /home/ab -s /sbin/nologin -u 911 && \
# Clear
rm -rf \
/root/.cache \
/tmp/*
/root/.cache \
/tmp/*

COPY --chmod=755 backend/src/. .
COPY --chmod=755 entrypoint.sh /entrypoint.sh
Expand Down
1 change: 1 addition & 0 deletions backend/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.1
8 changes: 3 additions & 5 deletions backend/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

# This script is used to run the development environment.

python3 -m venv venv

./venv/bin/python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements-dev.txt
rye sync

# install git-hooks for pre-commit before committing.
./venv/bin/pre-commit install
rye run pre-commit install

cd src || exit

Expand All @@ -25,4 +23,4 @@ if [ ! -f "$VERSION_FILE" ]; then
echo "VERSION='DEV_VERSION'" >>"$VERSION_FILE"
fi

../venv/bin/uvicorn main:app --reload --port 7892
rye run uvicorn main:app --reload --port 7892
47 changes: 47 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
[project]
name = "AutoBangumi"
version = "3.1.14"
description = "AutoBangumi 是基于 RSS 的全自动追番整理下载工具。只需要在 Mikan Project 等网站上订阅番剧,就可以全自动追番。 并且整理完成的名称和目录可以直接被 Plex、Jellyfin 等媒体库软件识别,无需二次刮削。"
dependencies = [
"uvicorn>=0.30.3",
"fastapi>=0.111.1",
"sqlmodel>=0.0.21",
"torrentool>=1.2.0",
"pydantic>=2.8.2",
"httpx[socks,http2]>=0.27.0",
"lxml>=5.2.2",
"openai>=1.37.0",
"python-dotenv>=1.0.1",
"python-jose>=3.3.0",
"qbittorrent-api>=2024.7.64",
"bs4>=0.0.2",
"semver>=3.0.2",
"sse-starlette>=2.1.2",
"passlib[bcrypt]>=1.7.4",
"bcrypt==4.0.1",
]
requires-python = ">= 3.8"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = [
"ruff>=0.5.4",
"black>=24.4.2",
"pre-commit>=3.7.1",
"pytest>=8.3.1",
]

[tool.rye.scripts]
backend = "python src/main.py"
dev = "uvicorn main:app --reload --port 7892"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/module"]

[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
Expand Down
195 changes: 195 additions & 0 deletions backend/requirements-dev.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
# universal: false

-e file:.
annotated-types==0.7.0
# via pydantic
anyio==4.4.0
# via httpx
# via openai
# via sse-starlette
# via starlette
# via watchfiles
bcrypt==4.0.1
# via autobangumi
# via passlib
beautifulsoup4==4.12.3
# via bs4
black==24.4.2
bs4==0.0.2
# via autobangumi
certifi==2024.7.4
# via httpcore
# via httpx
# via requests
cfgv==3.4.0
# via pre-commit
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via black
# via typer
# via uvicorn
distlib==0.3.8
# via virtualenv
distro==1.9.0
# via openai
dnspython==2.6.1
# via email-validator
ecdsa==0.19.0
# via python-jose
email-validator==2.2.0
# via fastapi
fastapi==0.111.1
# via autobangumi
fastapi-cli==0.0.4
# via fastapi
filelock==3.15.4
# via virtualenv
h11==0.14.0
# via httpcore
# via uvicorn
h2==4.1.0
# via httpx
hpack==4.0.0
# via h2
httpcore==1.0.5
# via httpx
httptools==0.6.1
# via uvicorn
httpx==0.27.0
# via autobangumi
# via fastapi
# via openai
hyperframe==6.0.1
# via h2
identify==2.6.0
# via pre-commit
idna==3.7
# via anyio
# via email-validator
# via httpx
# via requests
iniconfig==2.0.0
# via pytest
jinja2==3.1.4
# via fastapi
lxml==5.2.2
# via autobangumi
markdown-it-py==3.0.0
# via rich
markupsafe==2.1.5
# via jinja2
mdurl==0.1.2
# via markdown-it-py
mypy-extensions==1.0.0
# via black
nodeenv==1.9.1
# via pre-commit
openai==1.37.0
# via autobangumi
packaging==24.1
# via black
# via pytest
# via qbittorrent-api
passlib==1.7.4
# via autobangumi
pathspec==0.12.1
# via black
platformdirs==4.2.2
# via black
# via virtualenv
pluggy==1.5.0
# via pytest
pre-commit==3.7.1
pyasn1==0.6.0
# via python-jose
# via rsa
pydantic==2.8.2
# via autobangumi
# via fastapi
# via openai
# via sqlmodel
pydantic-core==2.20.1
# via pydantic
pygments==2.18.0
# via rich
pytest==8.3.1
python-dotenv==1.0.1
# via autobangumi
# via uvicorn
python-jose==3.3.0
# via autobangumi
python-multipart==0.0.9
# via fastapi
pyyaml==6.0.1
# via pre-commit
# via uvicorn
qbittorrent-api==2024.7.64
# via autobangumi
requests==2.32.3
# via qbittorrent-api
rich==13.7.1
# via typer
rsa==4.9
# via python-jose
ruff==0.5.4
semver==3.0.2
# via autobangumi
shellingham==1.5.4
# via typer
six==1.16.0
# via ecdsa
sniffio==1.3.1
# via anyio
# via httpx
# via openai
socksio==1.0.0
# via httpx
soupsieve==2.5
# via beautifulsoup4
sqlalchemy==2.0.31
# via sqlmodel
sqlmodel==0.0.21
# via autobangumi
sse-starlette==2.1.2
# via autobangumi
starlette==0.37.2
# via fastapi
# via sse-starlette
torrentool==1.2.0
# via autobangumi
tqdm==4.66.4
# via openai
typer==0.12.3
# via fastapi-cli
typing-extensions==4.12.2
# via fastapi
# via openai
# via pydantic
# via pydantic-core
# via sqlalchemy
# via typer
urllib3==2.2.2
# via qbittorrent-api
# via requests
uvicorn==0.30.3
# via autobangumi
# via fastapi
# via sse-starlette
uvloop==0.19.0
# via uvicorn
virtualenv==20.26.3
# via pre-commit
watchfiles==0.22.0
# via uvicorn
websockets==12.0
# via uvicorn
5 changes: 0 additions & 5 deletions backend/requirements-dev.txt

This file was deleted.

Loading

0 comments on commit 071f6bb

Please sign in to comment.