-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2279c0a
commit 0b3f3ef
Showing
21 changed files
with
1,381 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff version | ||
rev: v0.7.3 | ||
hooks: | ||
# Run the linter | ||
- id: ruff | ||
args: [ --fix ] | ||
# Run the formatter | ||
- id: ruff-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,29 @@ | ||
# Base image | ||
FROM python:3.11-slim AS base | ||
# Use a Python image with uv pre-installed | ||
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim | ||
|
||
# Install the project into `/app` | ||
WORKDIR /app | ||
|
||
# Install dependencies | ||
COPY pyproject.toml poetry.lock ./ | ||
# Enable bytecode compilation | ||
ENV UV_COMPILE_BYTECODE=1 | ||
|
||
RUN pip install poetry \ | ||
&& poetry config virtualenvs.create false \ | ||
&& poetry install --no-dev --no-interaction --no-ansi | ||
# Copy from the cache instead of linking since it's a mounted volume | ||
ENV UV_LINK_MODE=copy | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
# Install the project's dependencies using the lockfile and settings | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
--mount=type=bind,source=uv.lock,target=uv.lock \ | ||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
uv sync --frozen --no-install-project --no-dev | ||
|
||
# Then, add the rest of the project source code and install it | ||
# Installing separately from its dependencies allows optimal layer caching | ||
ADD . /app | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
uv sync --frozen --no-dev | ||
|
||
# Place executables in the environment at the front of the path | ||
ENV PATH="/app/.venv/bin:$PATH" | ||
|
||
# Run the bot | ||
CMD ["poetry", "run", "python", "src/main.py"] | ||
ENTRYPOINT ["uv", "run", "python", "src/main.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
[tool.poetry] | ||
[project] | ||
name = "duckbot" | ||
version = "0.1.0" | ||
version = "1.0.0" | ||
description = "DuckBot is the CS Club's Discord Bot, created by the CS Club Open Source Team." | ||
authors = ["CS Club Open Source Team <dev@csclub.org.au>"] | ||
authors = [ | ||
{ name = "CS Club Open Source Team", email = "dev@csclub.org.au" } | ||
] | ||
license = "MIT" | ||
readme = "README.md" | ||
package-mode = false | ||
requires-python = ">=3.12" | ||
dependencies = [ | ||
"aiosqlite>=0.20.0", | ||
"discord-py>=2.4.0", | ||
"google-generativeai>=0.8.3", | ||
"levenshtein>=0.26.1", | ||
"matplotlib>=3.9.2", | ||
"pathlib>=1.0.1", | ||
"python-dotenv>=1.0.1", | ||
"pytz>=2024.2", | ||
"schedule>=1.2.2", | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
"discord.py" = "2.3.2" | ||
black = "^24.4.2" | ||
poetry-dotenv-plugin = "^0.2.0" | ||
google-generativeai = "^0.7.2" | ||
pathlib = "^1.0.1" | ||
aiosqlite = "^0.20.0" | ||
schedule = "^1.2.2" | ||
pytz = "^2024.1" | ||
matplotlib = "^3.9.2" | ||
levenshtein = "^0.26.1" | ||
[tool.ruff] | ||
lint.select = ['E', 'F', 'W', 'A', 'PLC', 'PLE', 'PLW', 'I'] | ||
lint.ignore = ["E501"] | ||
lint.fixable = ["ALL"] | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
[dependency-groups] | ||
dev = [ | ||
"pre-commit>=4.0.1", | ||
"ruff>=0.7.3", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.