Skip to content

Commit ce0450f

Browse files
committed
Add project scaffolding
1 parent fd60e63 commit ce0450f

File tree

17 files changed

+1065
-0
lines changed

17 files changed

+1065
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TOKEN=DISCORD_BOT_TOKEN_HERE

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/ci.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
formatting:
13+
runs-on: ubuntu-latest
14+
name: "Run ruff via nox"
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
19+
with:
20+
version: "0.6.9"
21+
python-version: "3.13"
22+
23+
- name: Run ruff via nox
24+
run: |
25+
uv run nox -s format
26+
27+
pyright:
28+
runs-on: ubuntu-latest
29+
name: "Run pyright via nox"
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v5
34+
with:
35+
version: "0.6.9"
36+
python-version: "3.13"
37+
38+
- name: Run pyright via nox
39+
run: |
40+
uv run nox -s pyright

.github/workflows/publish.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish to Github Container Registry
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
push-to-ghcr:
10+
name: Push to Github Container Registry
11+
runs-on: ubuntu-latest
12+
permissions:
13+
packages: write
14+
steps:
15+
- name: Setup | Login to GHCR
16+
uses: docker/login-action@v3
17+
with:
18+
registry: ghcr.io
19+
username: ${{ github.actor }}
20+
password: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Setup | QEMU
23+
uses: docker/setup-qemu-action@v3
24+
25+
- name: Setup | Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Build & Deploy | Docker image
29+
uses: docker/build-push-action@v6
30+
with:
31+
push: true
32+
tags: |
33+
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
34+
ghcr.io/${{ github.repository }}:latest

.vscode/extensions.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"ms-python.python",
4+
"charliermarsh.ruff",
5+
"njpwerner.autodocstring",
6+
"EditorConfig.EditorConfig",
7+
"tamasfe.even-better-toml"
8+
]
9+
}

.vscode/python.code-snippets

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"Set up new file": {
3+
"scope": "python",
4+
"prefix": "!!!",
5+
"body": [
6+
"from __future__ import annotations",
7+
"",
8+
"$0",
9+
"",
10+
"# Copyright (C) 2025-present hypergonial, rayakame",
11+
"",
12+
"# This program is free software: you can redistribute it and/or modify",
13+
"# it under the terms of the GNU General Public License as published by",
14+
"# the Free Software Foundation, either version 3 of the License, or",
15+
"# (at your option) any later version.",
16+
"",
17+
"# This program is distributed in the hope that it will be useful,",
18+
"# but WITHOUT ANY WARRANTY; without even the implied warranty of",
19+
"# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
20+
"# GNU General Public License for more details.",
21+
"",
22+
"# You should have received a copy of the GNU General Public License",
23+
"# along with this program. If not, see: https://www.gnu.org/licenses",
24+
],
25+
"description": "Set up a new Python source file"
26+
}
27+
}

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"editor.tabCompletion": "onlySnippets",
3+
"python.analysis.autoImportCompletions": true,
4+
"python.analysis.typeCheckingMode": "strict",
5+
"python.analysis.diagnosticMode": "workspace",
6+
"python.analysis.exclude": [
7+
"build*",
8+
".nox*",
9+
],
10+
"editor.formatOnSave": true,
11+
"[python]": {
12+
"editor.defaultFormatter": "charliermarsh.ruff"
13+
},
14+
"autoDocstring.docstringFormat": "numpy",
15+
}

.vscode/tasks.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
// Use Ctrl+Shift+B or the command palette to run nox.
5+
"version": "2.0.0",
6+
"tasks": [
7+
{
8+
"label": "Run nox",
9+
"type": "shell",
10+
"command": "uv run nox",
11+
"group": {
12+
"kind": "build",
13+
"isDefault": true
14+
}
15+
}
16+
]
17+
}

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm
2+
3+
WORKDIR /app
4+
5+
# Enable bytecode compilation
6+
ENV UV_COMPILE_BYTECODE=1
7+
8+
# Copy from the cache instead of linking since it's a mounted volume
9+
ENV UV_LINK_MODE=copy
10+
11+
# Install the project's dependencies using the lockfile and settings
12+
RUN --mount=type=cache,target=/root/.cache/uv \
13+
--mount=type=bind,source=uv.lock,target=uv.lock \
14+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
15+
uv sync --frozen --no-install-project --no-dev
16+
17+
# Then, add the rest of the project source code and install it
18+
# Installing separately from its dependencies allows optimal layer caching
19+
ADD . /app
20+
RUN --mount=type=cache,target=/root/.cache/uv \
21+
uv sync --frozen --no-dev
22+
23+
# Place executables in the environment at the front of the path
24+
ENV PATH="/app/.venv/bin:$PATH"
25+
26+
# Reset the entrypoint, don't invoke `uv`
27+
ENTRYPOINT []
28+
29+
CMD ["python3.13", "-O", "-m", "src"]

0 commit comments

Comments
 (0)