feat: migrate to uv package manager

- Add pyproject.toml with project configuration
- Update requirements.txt and requirements.dev.txt with versions
- Add .uv configuration file
- Update .gitignore for uv
- Update README with uv instructions
- Configure hatchling build system
- Add mypy configuration
- Test uv sync and pytest integration
This commit is contained in:
2025-08-12 13:12:39 +03:00
parent 333dc19020
commit 663942c41e
7 changed files with 2168 additions and 183 deletions

View File

@@ -1,3 +1,105 @@
[project]
name = "discours-core"
version = "0.1.0"
description = "Core backend for Discours.io platform"
authors = [
{name = "Discours Team", email = "team@discours.io"}
]
readme = "README.md"
requires-python = ">=3.11"
license = {text = "MIT"}
keywords = ["discours", "backend", "api", "graphql", "social-media"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"bcrypt",
"PyJWT>=2.10",
"authlib",
"google-analytics-data",
"colorlog",
"psycopg2-binary",
"httpx",
"redis[hiredis]",
"sentry-sdk[starlette,sqlalchemy]",
"starlette",
"gql",
"ariadne",
"granian",
"sqlalchemy>=2.0.0",
"orjson",
"pydantic",
"types-requests",
"types-Authlib",
"types-orjson",
"types-PyYAML",
"types-python-dateutil",
"types-redis",
"types-PyJWT",
]
[project.optional-dependencies]
dev = [
"fakeredis",
"pytest",
"pytest-asyncio",
"pytest-cov",
"mypy",
"ruff",
"playwright",
"python-dotenv",
]
test = [
"fakeredis",
"pytest",
"pytest-asyncio",
"pytest-cov",
"playwright",
]
lint = [
"ruff",
"mypy",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["."]
include = [
"auth/**/*",
"cache/**/*",
"orm/**/*",
"resolvers/**/*",
"services/**/*",
"utils/**/*",
"schema/**/*",
"*.py",
]
exclude = [
"tests/**/*",
"alembic/**/*",
"panel/**/*",
"venv/**/*",
".venv/**/*",
"*.md",
"*.yml",
"*.yaml",
".git/**/*",
]
[tool.ruff]
line-length = 120 # Максимальная длина строки кода
fix = true # Автоматическое исправление ошибок где возможно
@@ -236,3 +338,44 @@ exclude_lines = [
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
[tool.mypy]
# Конфигурация mypy
python_version = "3.11"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
# Игнорируем некоторые файлы
exclude = [
"venv/",
".venv/",
"alembic/",
"tests/",
"*/migrations/*",
]
# Настройки для конкретных модулей
[[tool.mypy.overrides]]
module = [
"alembic.*",
"tests.*",
]
ignore_missing_imports = true
disallow_untyped_defs = false
[tool.ruff.format]
# Настройки форматирования
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"