put dependencies in pyproject

This commit is contained in:
Izalia Mae 2024-04-01 17:29:27 -04:00
parent c67b26760b
commit 65b6c0a5ad
5 changed files with 36 additions and 37 deletions

View file

@ -1,28 +1,20 @@
FROM python:3-alpine FROM python:3.12-alpine
# install build deps for pycryptodome and other c-based python modules
RUN apk add alpine-sdk autoconf automake libtool gcc
# add env var to let the relay know it's in a container # add env var to let the relay know it's in a container
ENV DOCKER_RUNNING=true ENV DOCKER_RUNNING=true
# setup various container properties # setup various container properties
VOLUME ["/data"] VOLUME ["/data"]
CMD ["python", "-m", "relay"] CMD ["python3", "-m", "relay"]
EXPOSE 8080/tcp EXPOSE 8080/tcp
WORKDIR /opt/activityrelay WORKDIR /opt/activityrelay
# only copy necessary files
COPY relay ./relay
COPY pyproject.toml ./
# install and update important python modules # install and update important python modules
RUN pip3 install -U setuptools wheel pip RUN pip3 install -U setuptools wheel pip
# only copy necessary files
COPY relay ./relay
COPY LICENSE .
COPY README.md .
COPY requirements.txt .
COPY setup.cfg .
COPY setup.py .
COPY .git ./.git
# install relay deps # install relay deps
RUN pip3 install -r requirements.txt RUN pip3 install `python3 -c "import tomllib; print(' '.join(dep.replace(' ', '') for dep in tomllib.load(open('pyproject.toml', 'rb'))['project']['dependencies']))"`

View file

@ -1,6 +0,0 @@
flake8 == 7.0.0
mypy == 1.9.0
pyinstaller == 6.3.0
watchdog == 4.0.0
typing_extensions >= 4.10.0; python_version < '3.11.0'

View file

@ -54,6 +54,7 @@ case $1 in
COLS="%-22s %s\n" COLS="%-22s %s\n"
echo "Valid commands:" echo "Valid commands:"
printf "$COLS" "- start" "Run the relay in the background" printf "$COLS" "- start" "Run the relay in the background"
printf "$COLS" "- stop" "Stop the relay" printf "$COLS" "- stop" "Stop the relay"
printf "$COLS" "- manage <cmd> [args]" "Run a relay management command" printf "$COLS" "- manage <cmd> [args]" "Run a relay management command"
@ -62,5 +63,8 @@ case $1 in
printf "$COLS" "- rescue" "Drop into a bash shell on a temp container with the data volume mounted" printf "$COLS" "- rescue" "Drop into a bash shell on a temp container with the data volume mounted"
printf "$COLS" "- install" "Build the image, create a new container and volume, and run relay setup" printf "$COLS" "- install" "Build the image, create a new container and volume, and run relay setup"
printf "$COLS" "- uninstall" "Delete the relay image, container, and volume" printf "$COLS" "- uninstall" "Delete the relay image, container, and volume"
echo ""
echo "Note: This script may not work. It is recommended to manually install and manage the container if you know what you're doing."
;; ;;
esac esac

View file

@ -15,8 +15,23 @@ classifiers = [
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.12",
] ]
dependencies = [
"activitypub-utils == 0.2.1",
"aiohttp >= 3.9.1",
"aiohttp-swagger[performance] == 1.0.16",
"argon2-cffi == 23.1.0",
"barkshark-sql == 0.1.2",
"click >= 8.1.2",
"hiredis == 2.3.2",
"jinja2-haml == 0.3.5",
"markdown == 3.5.2",
"platformdirs == 4.2.0",
"pyyaml >= 6.0",
"redis == 5.0.1",
"importlib_resources == 6.1.1; python_version < '3.9'"
]
requires-python = ">=3.8" requires-python = ">=3.8"
dynamic = ["version", "dependencies", "optional-dependencies"] dynamic = ["version"]
[project.readme] [project.readme]
file = "README.md" file = "README.md"
@ -30,6 +45,15 @@ Tracker = "https://git.pleroma.social/pleroma/relay/-/issues"
[project.scripts] [project.scripts]
activityrelay = "relay.manage:main" activityrelay = "relay.manage:main"
[project.optional-dependencies]
dev = [
"flake8 == 7.0.0",
"mypy == 1.9.0",
"pyinstaller == 6.3.0",
"watchdog == 4.0.0",
"typing_extensions >= 4.10.0; python_version < '3.11.0'"
]
[tool.setuptools] [tool.setuptools]
zip-safe = false zip-safe = false
packages = [ packages = [
@ -50,7 +74,6 @@ relay = [
[tool.setuptools.dynamic] [tool.setuptools.dynamic]
version = {attr = "relay.__version__"} version = {attr = "relay.__version__"}
dependencies = {file = ["requirements.txt"]}
[tool.setuptools.dynamic.optional-dependencies] [tool.setuptools.dynamic.optional-dependencies]
dev = {file = ["dev-requirements.txt"]} dev = {file = ["dev-requirements.txt"]}

View file

@ -1,14 +0,0 @@
activitypub-utils == 0.2.1
aiohttp >= 3.9.1
aiohttp-swagger[performance] == 1.0.16
argon2-cffi == 23.1.0
barkshark-sql == 0.1.2
click >= 8.1.2
hiredis == 2.3.2
jinja2-haml == 0.3.5
markdown == 3.5.2
platformdirs == 4.2.0
pyyaml >= 6.0
redis == 5.0.1
importlib_resources == 6.1.1; python_version < '3.9'