move to uv pyproject, drop setup.py/requirements/pytest.ini

This commit is contained in:
Oleksandr Kozachuk
2026-07-13 12:51:53 +02:00
parent cb630533e4
commit 1879992b22
7 changed files with 2461 additions and 129 deletions
+9
View File
@@ -8,9 +8,18 @@ build/
history/ history/
.config.yaml .config.yaml
.db .db
db/
.env .env
openai_chat.dat openai_chat.dat
openai_chat.dat.*
start.sh start.sh
env.sh env.sh
ggg.toml ggg.toml
kroa.toml
last_updates.json
.coverage .coverage
.venv/
.mypy_cache/
.pytest_cache/
*.py,v
*.msg
+28 -46
View File
@@ -1,6 +1,6 @@
# Fjerkroa Bot Development Makefile # Fjerkroa Bot Development Makefile (uv-managed)
.PHONY: help install install-dev clean test test-cov lint format type-check security-check all-checks pre-commit run build .PHONY: help install install-dev clean test test-cov test-fast lint format format-check type-check security-check audit trace check all-checks pre-commit run run-dev build ci
# Default target # Default target
help: ## Show this help message help: ## Show this help message
@@ -9,12 +9,12 @@ help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Installation targets # Installation targets
install: ## Install production dependencies install: ## Sync production dependencies
pip3.11 install -r requirements.txt uv sync --no-dev
install-dev: install ## Install development dependencies and pre-commit hooks install-dev: ## Sync all dependencies and install pre-commit hooks
pip3.11 install -e . uv sync
pre-commit install uv run pre-commit install
# Cleaning targets # Cleaning targets
clean: ## Clean up temporary files and caches clean: ## Clean up temporary files and caches
@@ -28,72 +28,54 @@ clean: ## Clean up temporary files and caches
# Testing targets # Testing targets
test: ## Run tests test: ## Run tests
python3.11 -m pytest -v uv run pytest -v
test-cov: ## Run tests with coverage report test-cov: ## Run tests with coverage report
python3.11 -m pytest --cov=fjerkroa_bot --cov-report=html --cov-report=term-missing uv run pytest --cov=fjerkroa_bot --cov-report=html --cov-report=term-missing
test-fast: ## Run tests without slow tests test-fast: ## Run tests without slow tests
python3.11 -m pytest -v -m "not slow" uv run pytest -v -m "not slow"
# Code quality targets # Code quality targets
lint: ## Run linter (flake8) lint: ## Run linter (flake8)
python3.11 -m flake8 fjerkroa_bot tests uv run flake8 fjerkroa_bot tests
format: ## Format code with black and isort format: ## Format code with black and isort
python3.11 -m black fjerkroa_bot tests uv run black fjerkroa_bot tests
python3.11 -m isort fjerkroa_bot tests uv run isort fjerkroa_bot tests
format-check: ## Check if code is properly formatted format-check: ## Check if code is properly formatted
python3.11 -m black --check fjerkroa_bot tests uv run black --check fjerkroa_bot tests
python3.11 -m isort --check-only fjerkroa_bot tests uv run isort --check-only fjerkroa_bot tests
type-check: ## Run type checker (mypy) type-check: ## Run type checker (mypy)
python3.11 -m mypy fjerkroa_bot tests uv run mypy fjerkroa_bot tests
security-check: ## Run security scanner (bandit) security-check: ## Run security scanner (bandit)
python3.11 -m bandit -r fjerkroa_bot --configfile pyproject.toml uv run bandit -r fjerkroa_bot --configfile pyproject.toml
audit: ## Audit locked dependencies for known CVEs
uv export --no-dev --no-emit-project --format requirements-txt | uv run pip-audit -r /dev/stdin --disable-pip
trace: ## Verify spec requirement coverage (SDD/BDD/TDD)
uv run python tools/trace.py
# Combined targets # Combined targets
all-checks: lint format-check type-check security-check test ## Run all code quality checks and tests check: lint format-check type-check security-check trace test ## The gate: all quality checks + spec trace + tests
all-checks: check audit ## check + dependency audit
pre-commit: format lint type-check security-check test ## Run all pre-commit checks (format, then check) pre-commit: format lint type-check security-check test ## Run all pre-commit checks (format, then check)
# Development targets # Development targets
run: ## Run the bot (requires config.toml) run: ## Run the bot (requires config.toml)
python3.11 -m fjerkroa_bot uv run python -m fjerkroa_bot
run-dev: ## Run the bot in development mode with auto-reload run-dev: ## Run the bot in development mode with auto-reload
python3.11 -m watchdog.watchmedo auto-restart --patterns="*.py" --recursive -- python3.11 -m fjerkroa_bot uv run watchmedo auto-restart --patterns="*.py" --recursive -- python -m fjerkroa_bot
# Build targets # Build targets
build: clean ## Build distribution packages build: clean ## Build distribution packages
python3.11 setup.py sdist bdist_wheel uv build
# CI targets # CI targets
ci: install-dev all-checks ## Full CI pipeline (install deps and run all checks) ci: install-dev all-checks ## Full CI pipeline (install deps and run all checks)
# Docker targets (if needed in future)
docker-build: ## Build Docker image
docker build -t fjerkroa-bot .
docker-run: ## Run bot in Docker container
docker run -d --name fjerkroa-bot fjerkroa-bot
# Utility targets
deps-update: ## Update dependencies (requires pip-tools)
python3.11 -m piptools compile requirements.in --upgrade
requirements-lock: ## Generate locked requirements
pip3.11 freeze > requirements-lock.txt
check-deps: ## Check for outdated dependencies
pip3.11 list --outdated
# Documentation targets (if needed)
docs: ## Generate documentation (placeholder)
@echo "Documentation generation not implemented yet"
# Database/migration targets (if needed)
migrate: ## Run database migrations (placeholder)
@echo "No migrations needed for this project"
+44 -47
View File
@@ -1,6 +1,46 @@
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["setuptools>=77"]
build-backend = "poetry.core.masonry.api" build-backend = "setuptools.build_meta"
[project]
name = "fjerkroa-bot"
version = "2.0"
description = "Discord bot with OpenAI responder for Fjærkroa and GGG"
authors = [{ name = "Oleksandr Kozachuk", email = "ddeus.lp@mailnull.com" }]
requires-python = ">=3.11"
dependencies = [
"discord.py>=2.5,<3",
"openai>=2.45", # 2.x since the FDB-005 envelope rewrite (D-007)
"aiohttp>=3.12",
"tomlkit>=0.13",
"watchdog>=6",
"requests>=2.32",
]
[project.scripts]
fjerkroa_bot = "fjerkroa_bot:main"
[dependency-groups]
dev = [
"pytest>=8",
"pytest-asyncio>=1",
"pytest-bdd>=8",
"pytest-cov>=6",
"respx>=0.22",
"toml>=0.10",
"mypy>=1.16",
"flake8>=7",
"black>=25",
"isort>=6",
"bandit[toml]>=1.8",
"pre-commit>=4",
"pip-audit>=2.9",
"types-requests",
"types-toml",
]
[tool.setuptools]
packages = ["fjerkroa_bot"]
[tool.mypy] [tool.mypy]
files = ["fjerkroa_bot", "tests"] files = ["fjerkroa_bot", "tests"]
@@ -22,7 +62,6 @@ show_error_codes = true
[[tool.mypy.overrides]] [[tool.mypy.overrides]]
module = [ module = [
"discord.*", "discord.*",
"multiline.*",
"aiohttp.*", "aiohttp.*",
"openai.*", "openai.*",
"tomlkit.*", "tomlkit.*",
@@ -31,50 +70,9 @@ module = [
] ]
ignore_missing_imports = true ignore_missing_imports = true
[tool.flake8]
max-line-length = 140
max-complexity = 10
ignore = [
"E203",
"E266",
"E501",
"W503",
"E306",
]
exclude = [
".git",
".mypy_cache",
".pytest_cache",
"__pycache__",
"build",
"dist",
"venv",
]
[tool.poetry]
name = "fjerkroa_bot"
version = "2.0"
description = ""
authors = ["Oleksandr Kozachuk <ddeus.lp@mailnull.com>"]
[tool.poetry.dependencies]
python = "^3.8"
"discord.py" = "*"
openai = "*"
aiohttp = "*"
mypy = "*"
flake8 = "*"
pre-commit = "*"
pytest = "*"
setuptools = "*"
wheel = "*"
watchdog = "*"
tomlkit = "*"
multiline = "*"
[tool.black] [tool.black]
line-length = 140 line-length = 140
target-version = ['py38'] target-version = ['py311']
include = '\.pyi?$' include = '\.pyi?$'
extend-exclude = ''' extend-exclude = '''
/( /(
@@ -108,7 +106,7 @@ skips = ["B101", "B601", "B301", "B311", "B403", "B113"] # Skip pickle, random,
[tool.pytest.ini_options] [tool.pytest.ini_options]
minversion = "6.0" minversion = "6.0"
addopts = "-ra -q --strict-markers --strict-config" addopts = "-ra -q --strict-markers --strict-config -W ignore::DeprecationWarning"
testpaths = ["tests"] testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"] python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"] python_classes = ["Test*"]
@@ -123,7 +121,6 @@ source = ["fjerkroa_bot"]
omit = [ omit = [
"*/tests/*", "*/tests/*",
"*/test_*", "*/test_*",
"setup.py",
] ]
[tool.coverage.report] [tool.coverage.report]
-2
View File
@@ -1,2 +0,0 @@
[pytest]
addopts = -W ignore::DeprecationWarning
-17
View File
@@ -1,17 +0,0 @@
aiohttp
bandit[toml]
black
discord.py
flake8
isort
multiline
mypy
openai
pre-commit
pytest
pytest-asyncio
pytest-cov
setuptools
tomlkit
watchdog
wheel
-17
View File
@@ -1,17 +0,0 @@
from setuptools import find_packages, setup
setup(
name="fjerkroa-bot",
version="2.0",
packages=find_packages(),
entry_points={"console_scripts": ["fjerkroa_bot = fjerkroa_bot:main"]},
test_suite="tests",
install_requires=["discord.py", "openai"],
author="Oleksandr Kozachuk",
author_email="ddeus.lp@mailnull.com",
description="A simple Discord bot that uses OpenAI's GPT to chat with users",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
url="https://github.com/ok2/fjerkroa-bot",
classifiers=["Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3"],
)
Generated
+2380
View File
File diff suppressed because it is too large Load Diff