1
Fork 0
mirror of https://github.com/allthingslinux/tux.git synced 2024-10-02 16:43:12 +00:00

chore(.env.example): restructure and clean up environment variables for better organization and clarity

feat(.pre-commit-config.yaml): add pre-commit hooks for yaml, json, toml files and dotenv files for better code quality
feat(justfile): add check-types command to run pyright for type checking
refactor(pyproject.toml): replace aiopath with aiofiles and add types for aiofiles and psutil, adjust pyright settings for strict type checking
This commit is contained in:
kzndotsh 2024-07-13 19:21:16 +00:00
parent ee47eb22c0
commit b02e1ee5f3
5 changed files with 69 additions and 148 deletions

View file

@ -1,45 +1,36 @@
# Misc
TZ=UTC
DEV=
PROD_TOKEN=""
DEV_TOKEN=""
TZ=""
DISCORD_GUILD=
TEMPVC_CATEGORY_ID=
TEMPVC_CHANNEL_ID=
PROD_SUPABASE_DB_PASSWORD=""
DEV_SUPABASE_DB_PASSWORD=""
# Dev
DEV=False
DEV_TOKEN=
DEV_PREFIX=
DEV_COG_IGNORE_LIST=
SUPABASE_KEY=""
# Prod
PROD_TOKEN=
PROD_PREFIX=
PROD_COG_IGNORE_LIST=
PROD_DATABASE_URL=""
PROD_DIRECT_URL=""
# Sentry
SENTRY_URL=
DEV_DATABASE_URL=""
DEV_DIRECT_URL=""
# Database
SUPABASE_URL=
SUPABASE_KEY=
SUPABASE_DB_PASSWORD=
DATABASE_URL=
DIRECT_URL=
SENTRY_URL=""
# Perms
BOT_OWNER_ID=
# PROD_COG_IGNORE_LIST="kick,ban"
# STAGING_COG_IGNORE_LIST="kick,ban,tty_roles,temp_vc"
GITHUB_APP_ID=
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
GITHUB_PUBLIC_KEY=""
GITHUB_INSTALLATION_ID=
GITHUB_PRIVATE_KEY_BASE64=""
# Github
GITHUB_REPO_URL=
GITHUB_REPO_OWNER=
GITHUB_REPO=
GITHUB_TOKEN=
GITHUB_APP_ID=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_PUBLIC_KEY=
GITHUB_INSTALLATION_ID=
GITHUB_PRIVATE_KEY_BASE64=
# Mailcow
MAILCOW_API_KEY=
MAILCOW_API_URL=

View file

@ -1,4 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: check-json
- id: check-toml
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
@ -18,4 +25,9 @@ repos:
hooks:
- id: gitleaks
- repo: https://github.com/hija/clean-dotenv
rev: v0.0.7
hooks:
- id: clean-dotenv
exclude: ".archive/"

View file

@ -25,6 +25,10 @@ lint:
lint-fix:
poetry run ruff --fix .
# Type-check the code using pyright
check-types:
poetry run pyright
# Environment setup
setup-env:
@echo "Setting up environment..."

137
poetry.lock generated
View file

@ -11,23 +11,6 @@ files = [
{file = "aioconsole-0.7.1.tar.gz", hash = "sha256:a3e52428d32623c96746ec3862d97483c61c12a2f2dfba618886b709415d4533"},
]
[[package]]
name = "aiofile"
version = "3.8.8"
description = "Asynchronous file operations."
optional = false
python-versions = ">=3.7, <4"
files = [
{file = "aiofile-3.8.8-py3-none-any.whl", hash = "sha256:41e8845cce055779cd77713d949a339deb012eab605b857765e8f8e52a5ed811"},
{file = "aiofile-3.8.8.tar.gz", hash = "sha256:41f3dc40bd730459d58610476e82e5efb2f84ae6e9fa088a9545385d838b8a43"},
]
[package.dependencies]
caio = ">=0.9.0,<0.10.0"
[package.extras]
develop = ["aiomisc-pytest", "coveralls", "pytest", "pytest-cov", "pytest-rst"]
[[package]]
name = "aiofiles"
version = "24.1.0"
@ -134,21 +117,6 @@ yarl = ">=1.0,<2.0"
[package.extras]
speedups = ["Brotli", "aiodns", "brotlicffi"]
[[package]]
name = "aiopath"
version = "0.7.7"
description = "📁 Async pathlib for Python"
optional = false
python-versions = ">=3.12"
files = [
{file = "aiopath-0.7.7-py2.py3-none-any.whl", hash = "sha256:cd5d18de8ede167e1db659f02ee448fe085f923cb8e194407ccc568bffc4fe4e"},
{file = "aiopath-0.7.7.tar.gz", hash = "sha256:ad4b9d09ae08ddf6d39dd06e7b0a353939e89528da571c0cd4f3fe071aefad4f"},
]
[package.dependencies]
aiofile = ">=3.8.8,<4"
anyio = ">=4.0.0,<5"
[[package]]
name = "aiosignal"
version = "1.3.1"
@ -227,30 +195,6 @@ tests = ["attrs[tests-no-zope]", "zope-interface"]
tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"]
tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"]
[[package]]
name = "caio"
version = "0.9.17"
description = "Asynchronous file IO for Linux MacOS or Windows."
optional = false
python-versions = "<4,>=3.7"
files = [
{file = "caio-0.9.17-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3f69395fdd45c115b2ef59732e3c8664722a2b51de2d6eedb3d354b2f5f3be3c"},
{file = "caio-0.9.17-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3028b746e9ec7f6d6ebb386a7fd8caf0eebed5d6e6b4f18c8ef25861934b1673"},
{file = "caio-0.9.17-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:079730a353bbde03796fab681e969472eace09ffbe5000e584868a7fe389ba6f"},
{file = "caio-0.9.17-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:549caa51b475877fe32856a26fe937366ae7a1c23a9727005b441db9abb12bcc"},
{file = "caio-0.9.17-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0ddb253b145a53ecca76381677ce465bc5efeaecb6aaf493fac43ae79659f0fb"},
{file = "caio-0.9.17-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3e320b0ea371c810359934f8e8fe81777c493cc5fb4d41de44277cbe7336e74"},
{file = "caio-0.9.17-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:a39a49e279f82aa022f0786339d45d9550b5aa3e46eec7d08e0f351c503df0a5"},
{file = "caio-0.9.17-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3e96925b9f15f43e6ef1d42a83edfd937eb11a984cb6ef7c10527e963595497"},
{file = "caio-0.9.17-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:fca916240597005d2b734f1442fa3c3cfb612bf46e0978b5232e5492a371de38"},
{file = "caio-0.9.17-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40bd0afbd3491d1e407bcf74e3a9e9cc67a7f290ed29518325194184d63cc2b6"},
{file = "caio-0.9.17-py3-none-any.whl", hash = "sha256:c55d4dc6b3a36f93237ecd6360e1c131c3808bc47d4191a130148a99b80bb311"},
{file = "caio-0.9.17.tar.gz", hash = "sha256:8f30511526814d961aeef389ea6885273abe6c655f1e08abbadb95d12fdd9b4f"},
]
[package.extras]
develop = ["aiomisc-pytest", "pytest", "pytest-cov"]
[[package]]
name = "cairocffi"
version = "1.7.1"
@ -972,63 +916,6 @@ files = [
{file = "multidict-6.0.5.tar.gz", hash = "sha256:f7e301075edaf50500f0b341543c41194d8df3ae5caf4702f2095f3ca73dd8da"},
]
[[package]]
name = "mypy"
version = "1.10.1"
description = "Optional static typing for Python"
optional = false
python-versions = ">=3.8"
files = [
{file = "mypy-1.10.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e36f229acfe250dc660790840916eb49726c928e8ce10fbdf90715090fe4ae02"},
{file = "mypy-1.10.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:51a46974340baaa4145363b9e051812a2446cf583dfaeba124af966fa44593f7"},
{file = "mypy-1.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:901c89c2d67bba57aaaca91ccdb659aa3a312de67f23b9dfb059727cce2e2e0a"},
{file = "mypy-1.10.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0cd62192a4a32b77ceb31272d9e74d23cd88c8060c34d1d3622db3267679a5d9"},
{file = "mypy-1.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:a2cbc68cb9e943ac0814c13e2452d2046c2f2b23ff0278e26599224cf164e78d"},
{file = "mypy-1.10.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:bd6f629b67bb43dc0d9211ee98b96d8dabc97b1ad38b9b25f5e4c4d7569a0c6a"},
{file = "mypy-1.10.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a1bbb3a6f5ff319d2b9d40b4080d46cd639abe3516d5a62c070cf0114a457d84"},
{file = "mypy-1.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8edd4e9bbbc9d7b79502eb9592cab808585516ae1bcc1446eb9122656c6066f"},
{file = "mypy-1.10.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:6166a88b15f1759f94a46fa474c7b1b05d134b1b61fca627dd7335454cc9aa6b"},
{file = "mypy-1.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:5bb9cd11c01c8606a9d0b83ffa91d0b236a0e91bc4126d9ba9ce62906ada868e"},
{file = "mypy-1.10.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d8681909f7b44d0b7b86e653ca152d6dff0eb5eb41694e163c6092124f8246d7"},
{file = "mypy-1.10.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:378c03f53f10bbdd55ca94e46ec3ba255279706a6aacaecac52ad248f98205d3"},
{file = "mypy-1.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6bacf8f3a3d7d849f40ca6caea5c055122efe70e81480c8328ad29c55c69e93e"},
{file = "mypy-1.10.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:701b5f71413f1e9855566a34d6e9d12624e9e0a8818a5704d74d6b0402e66c04"},
{file = "mypy-1.10.1-cp312-cp312-win_amd64.whl", hash = "sha256:3c4c2992f6ea46ff7fce0072642cfb62af7a2484efe69017ed8b095f7b39ef31"},
{file = "mypy-1.10.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:604282c886497645ffb87b8f35a57ec773a4a2721161e709a4422c1636ddde5c"},
{file = "mypy-1.10.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37fd87cab83f09842653f08de066ee68f1182b9b5282e4634cdb4b407266bade"},
{file = "mypy-1.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8addf6313777dbb92e9564c5d32ec122bf2c6c39d683ea64de6a1fd98b90fe37"},
{file = "mypy-1.10.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5cc3ca0a244eb9a5249c7c583ad9a7e881aa5d7b73c35652296ddcdb33b2b9c7"},
{file = "mypy-1.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:1b3a2ffce52cc4dbaeee4df762f20a2905aa171ef157b82192f2e2f368eec05d"},
{file = "mypy-1.10.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:fe85ed6836165d52ae8b88f99527d3d1b2362e0cb90b005409b8bed90e9059b3"},
{file = "mypy-1.10.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c2ae450d60d7d020d67ab440c6e3fae375809988119817214440033f26ddf7bf"},
{file = "mypy-1.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6be84c06e6abd72f960ba9a71561c14137a583093ffcf9bbfaf5e613d63fa531"},
{file = "mypy-1.10.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:2189ff1e39db399f08205e22a797383613ce1cb0cb3b13d8bcf0170e45b96cc3"},
{file = "mypy-1.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:97a131ee36ac37ce9581f4220311247ab6cba896b4395b9c87af0675a13a755f"},
{file = "mypy-1.10.1-py3-none-any.whl", hash = "sha256:71d8ac0b906354ebda8ef1673e5fde785936ac1f29ff6987c7483cfbd5a4235a"},
{file = "mypy-1.10.1.tar.gz", hash = "sha256:1f8f492d7db9e3593ef42d4f115f04e556130f2819ad33ab84551403e97dd4c0"},
]
[package.dependencies]
mypy-extensions = ">=1.0.0"
typing-extensions = ">=4.1.0"
[package.extras]
dmypy = ["psutil (>=4.0)"]
install-types = ["pip"]
mypyc = ["setuptools (>=50)"]
reports = ["lxml"]
[[package]]
name = "mypy-extensions"
version = "1.0.0"
description = "Type system extensions for programs checked with the mypy type checker."
optional = false
python-versions = ">=3.5"
files = [
{file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"},
{file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"},
]
[[package]]
name = "nodeenv"
version = "1.9.1"
@ -1763,6 +1650,28 @@ files = [
{file = "tomlkit-0.12.5.tar.gz", hash = "sha256:eef34fba39834d4d6b73c9ba7f3e4d1c417a4e56f89a7e96e090dd0d24b8fb3c"},
]
[[package]]
name = "types-aiofiles"
version = "24.1.0.20240626"
description = "Typing stubs for aiofiles"
optional = false
python-versions = ">=3.8"
files = [
{file = "types-aiofiles-24.1.0.20240626.tar.gz", hash = "sha256:48604663e24bc2d5038eac05ccc33e75799b0779e93e13d6a8f711ddc306ac08"},
{file = "types_aiofiles-24.1.0.20240626-py3-none-any.whl", hash = "sha256:7939eca4a8b4f9c6491b6e8ef160caee9a21d32e18534a57d5ed90aee47c66b4"},
]
[[package]]
name = "types-psutil"
version = "6.0.0.20240621"
description = "Typing stubs for psutil"
optional = false
python-versions = ">=3.8"
files = [
{file = "types-psutil-6.0.0.20240621.tar.gz", hash = "sha256:1be027326c42ff51ebd65255a5146f9dc57e5cf8c4f9519a88b3f3f6a7fcd00e"},
{file = "types_psutil-6.0.0.20240621-py3-none-any.whl", hash = "sha256:b02f05d2c4141cd5926d82d8b56e4292a4d8f483d8a3400b73edf153834a3c64"},
]
[[package]]
name = "typing-extensions"
version = "4.12.2"
@ -1970,4 +1879,4 @@ multidict = ">=4.0"
[metadata]
lock-version = "2.0"
python-versions = ">=3.12,<4"
content-hash = "4539127e5518dbc8223debfd3235ff779474f08cdab9f5ae180ba8c438128ca0"
content-hash = "89d8512e54687ba3b58ff0b4b2ccddb18e57032b44aba75fea8b7454978c7df3"

View file

@ -9,7 +9,7 @@ version = "0.1.0"
[tool.poetry.dependencies]
aioconsole = "^0.7.0"
aiopath = "^0.7.7"
aiofiles = "^24.1.0"
asynctempfile = "^0.5.0"
cairosvg = "^2.7.1"
dateparser = "^1.2.0"
@ -17,7 +17,6 @@ discord-py = "^2.4.0"
githubkit = {extras = ["auth-app"], version = "^0.11.3"}
httpx = "^0.27.0"
loguru = "^0.7.2"
mypy = "^1.9.0"
pillow = "^10.3.0"
pre-commit = "^3.7.0"
prisma = "^0.13.1"
@ -29,6 +28,9 @@ python-dotenv = "^1.0.1"
rsa = "^4.9"
ruff = "^0.4.0"
sentry-sdk = {extras = ["httpx", "loguru"], version = "^2.7.0"}
types-aiofiles = "^24.1.0.20240626"
types-psutil = "^6.0.0.20240621"
typing-extensions = "^4.12.2"
[build-system]
build-backend = "poetry.core.masonry.api"
@ -145,6 +147,9 @@ exclude = [
include = ["tux"]
pythonPlatform = "Linux"
pythonVersion = "3.12"
reportMissingTypeStubs = true
reportShadowedImports = false
stubPath = "tux/stubs"
typeCheckingMode = "strict"
venv = ".venv"
venvPath = "."