Update installation instructions and bump Python requirement to 3.13; remove Poetry and nox; update pre-commit hooks.

This commit is contained in:
2025-06-29 04:24:25 +02:00
parent 41c03e10f6
commit b87639910b
7 changed files with 1638 additions and 101 deletions

56
.gitignore vendored
View File

@ -1,6 +1,6 @@
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[codz]
*$py.class *$py.class
# C extensions # C extensions
@ -46,7 +46,7 @@ htmlcov/
nosetests.xml nosetests.xml
coverage.xml coverage.xml
*.cover *.cover
*.py,cover *.py.cover
.hypothesis/ .hypothesis/
.pytest_cache/ .pytest_cache/
cover/ cover/
@ -85,38 +85,45 @@ ipython_config.py
# pyenv # pyenv
# For a library or package, you might want to ignore these files since the code is # For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in: # intended to run in multiple environments; otherwise, check them in:
.python-version # .python-version
# pipenv # pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies # However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not # having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies. # install all needed dependencies.
Pipfile.lock #Pipfile.lock
# UV # UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more # This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries. # commonly ignored for libraries.
uv.lock #uv.lock
# poetry # poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more # This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries. # commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
poetry.lock #poetry.lock
#poetry.toml
# pdm # pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
#pdm.lock #pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it #pdm.toml
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python .pdm-python
.pdm-build/ .pdm-build/
# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
#pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/ __pypackages__/
@ -129,6 +136,7 @@ celerybeat.pid
# Environments # Environments
.env .env
.envrc
.venv .venv
env/ env/
venv/ venv/
@ -167,9 +175,37 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/
# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/
# Ruff stuff:
.ruff_cache/
# PyPI configuration file # PyPI configuration file
.pypirc .pypirc
# Cursor
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
# refer to https://docs.cursor.com/context/ignore-files
.cursorignore
.cursorindexingignore
# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/
# SQLite # SQLite
*.sqlite *.sqlite
*.sqlite.* *.sqlite.*

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/asottile/add-trailing-comma - repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0 rev: v3.2.0
hooks: hooks:
- id: add-trailing-comma - id: add-trailing-comma
@ -23,13 +23,13 @@ repos:
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v3.19.1 rev: v3.20.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: ["--py310-plus"] args: ["--py310-plus"]
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.6 rev: v0.12.1
hooks: hooks:
- id: ruff-format - id: ruff-format
- id: ruff - id: ruff

View File

@ -31,30 +31,18 @@ using [Docker](https://hub.docker.com/r/thelovinator/discord-reminder-bot).
### Install directly on your computer ### Install directly on your computer
- Install the latest version of needed software: - Install the latest version of needed software:
- [Python](https://www.python.org/) - `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"`
- You should use the latest version.
- You want to add Python to your PATH.
- Windows: Find `App execution aliases` and disable python.exe and python3.exe
- [Poetry](https://python-poetry.org/docs/master/#installation)
- Windows: You have to add `%appdata%\Python\Scripts` to your PATH for Poetry to work.
- Download project from GitHub with Git or download - Download project from GitHub with Git or download
the [ZIP](https://github.com/TheLovinator1/discord-reminder-bot/archive/refs/heads/master.zip). the [ZIP](https://github.com/TheLovinator1/discord-reminder-bot/archive/refs/heads/master.zip).
- If you want to update the bot, you can run `git pull` in the project folder or download the ZIP again. - If you want to update the bot, you can run `git pull` in the project folder or download the ZIP again.
- Rename .env.example to .env and open it in a text editor (e.g., VSCode, Notepad++, Notepad). - Rename .env.example to .env and open it in a text editor (e.g., VSCode, Notepad++, Notepad).
- If you can't see the file extension: - If you can't see the file extension:
- Windows 10: Click the View Tab in File Explorer and click the box next to File name extensions.
- Windows 11: Click View -> Show -> File name extensions. - Windows 11: Click View -> Show -> File name extensions.
- Open a terminal in the repository folder. - Open a terminal in the repository folder.
- Windows 10: <kbd>Shift</kbd> + <kbd>right-click</kbd> in the folder and select `Open PowerShell window here`
- Windows 11: <kbd>Shift</kbd> + <kbd>right-click</kbd> in the folder and Show more options - Windows 11: <kbd>Shift</kbd> + <kbd>right-click</kbd> in the folder and Show more options
and `Open PowerShell window here` and `Open PowerShell window here`
- Install requirements:
- Type `poetry install` into the PowerShell window. Make sure you are
in the repository folder with the [pyproject.toml](pyproject.toml) file.
- You may have to restart your terminal if it can't find the `poetry` command. Also double check it is in
your PATH.
- Start the bot: - Start the bot:
- Type `poetry run bot` into the PowerShell window. - Type `uv run .\discord_reminder_bot\main.py` into the PowerShell window.
- You can stop the bot with <kbd>Ctrl</kbd> + <kbd>c</kbd>. - You can stop the bot with <kbd>Ctrl</kbd> + <kbd>c</kbd>.
Note: You will need to run `poetry install` again if poetry.lock has been modified. Note: You will need to run `poetry install` again if poetry.lock has been modified.

View File

@ -1,13 +0,0 @@
from __future__ import annotations
import nox # type: ignore[import]
nox.options.default_venv_backend = "uv"
@nox.session(python=["3.10", "3.11", "3.12", "3.13"])
def tests(session: nox.Session) -> None:
"""Run the test suite."""
session.install(".")
session.install("pytest")
session.run("pytest")

View File

@ -1,9 +1,9 @@
[project] [project]
name = "discord-reminder-bot" name = "discord-reminder-bot"
version = "2.0.0" version = "3.0.0"
description = "Discord bot that allows you to set date, cron and interval reminders." description = "Discord bot that allows you to set date, cron and interval reminders."
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.13"
dependencies = [ dependencies = [
# The Discord bot library uses discord.py # The Discord bot library uses discord.py
"discord-py[speed]>=2.5.0", # https://github.com/Rapptz/discord.py "discord-py[speed]>=2.5.0", # https://github.com/Rapptz/discord.py
@ -29,63 +29,7 @@ dependencies = [
] ]
[dependency-groups] [dependency-groups]
dev = ["pytest", "nox"] dev = ["pytest"]
[tool.poetry]
name = "discord-reminder-bot"
version = "2.0.0"
description = "Discord bot that allows you to set date, cron and interval reminders."
authors = ["Joakim Hellsén <tlovinator@gmail.com>"]
license = "GPL-3.0-or-later"
[tool.poetry.scripts]
bot = "discord_reminder_bot.main:start"
[tool.poetry.dependencies]
python = "^3.10"
# https://github.com/agronholm/apscheduler
# https://github.com/sqlalchemy/sqlalchemy
# For scheduling reminders, sqlalchemy is needed for storing reminders in a database
sqlalchemy = { version = ">=2.0.37,<3.0.0" }
apscheduler = { version = ">=3.11.0,<4.0.0" }
# https://github.com/scrapinghub/dateparser
# For parsing dates and times in /remind commands
dateparser = { version = ">=1.0.0" }
# https://github.com/Rapptz/discord.py
# https://github.com/jackrosenthal/legacy-cgi
# https://github.com/AbstractUmbra/audioop
# The Discord bot library uses discord.py
# legacy-cgi and audioop-lts are because Python 3.13 removed cgi module and audioop module
discord-py = { version = ">=2.4.0,<3.0.0", extras = ["speed"] }
legacy-cgi = { version = ">=2.6.2,<3.0.0", markers = "python_version >= '3.13'" }
audioop-lts = { version = ">=0.2.1,<1.0.0", markers = "python_version >= '3.13'" }
# https://github.com/lovvskillz/python-discord-webhook
# For sending webhook messages to Discord
discord-webhook = { version = ">=1.3.1,<2.0.0" }
# https://github.com/theskumar/python-dotenv
# For loading environment variables from a .env file
python-dotenv = { version = ">=1.0.1,<2.0.0" }
# https://github.com/getsentry/sentry-python
# For error tracking
sentry-sdk = { version = ">=2.20.0,<3.0.0" }
# https://github.com/Delgan/loguru
# For logging
loguru = { version = ">=0.7.3,<1.0.0" }
[tool.poetry.dev-dependencies]
pytest = "*"
nox = "*"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.ruff] [tool.ruff]
preview = true preview = true

View File

@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
import zoneinfo import zoneinfo
from datetime import datetime, timezone from datetime import UTC, datetime
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import pytest import pytest
@ -25,7 +25,7 @@ def dummy_job() -> None:
def test_calculate() -> None: def test_calculate() -> None:
"""Test the calculate function with various job inputs.""" """Test the calculate function with various job inputs."""
scheduler = BackgroundScheduler() scheduler = BackgroundScheduler()
scheduler.timezone = timezone.utc scheduler.timezone = UTC
scheduler.start() scheduler.start()
# Create a job with a DateTrigger # Create a job with a DateTrigger

1582
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff