2025-08-12 13:12:39 +03:00
|
|
|
# Discours Core
|
2025-02-10 18:04:08 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
Core backend for Discours.io platform
|
2025-02-10 18:04:08 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
## Requirements
|
2024-12-12 01:04:11 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
- Python 3.11+
|
|
|
|
|
- uv (Python package manager)
|
2025-02-10 18:04:08 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
## Installation
|
2025-02-10 18:04:08 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
### Install uv
|
2024-08-09 09:37:06 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
```bash
|
|
|
|
|
# macOS/Linux
|
|
|
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
2024-08-09 09:37:06 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Windows
|
|
|
|
|
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
|
|
|
```
|
2025-07-03 12:23:06 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
### Setup project
|
2024-11-20 23:59:11 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
```bash
|
|
|
|
|
# Clone repository
|
|
|
|
|
git clone <repository-url>
|
|
|
|
|
cd discours-core
|
2024-11-20 23:59:11 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Install dependencies
|
|
|
|
|
uv sync --dev
|
2025-07-31 18:55:59 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Activate virtual environment
|
|
|
|
|
source .venv/bin/activate # Linux/macOS
|
|
|
|
|
# or
|
|
|
|
|
.venv\Scripts\activate # Windows
|
|
|
|
|
```
|
2024-11-20 23:59:11 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
## Development
|
2025-05-16 09:23:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
### Install dependencies
|
2024-08-09 09:37:06 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
```bash
|
|
|
|
|
# Install all dependencies (including dev)
|
|
|
|
|
uv sync --dev
|
2024-11-20 23:59:11 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Install only production dependencies
|
|
|
|
|
uv sync
|
2024-11-20 23:59:11 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Install specific group
|
|
|
|
|
uv sync --group test
|
|
|
|
|
uv sync --group lint
|
|
|
|
|
```
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
### Run tests
|
2024-11-20 23:59:11 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
```bash
|
|
|
|
|
# Run all tests
|
|
|
|
|
uv run pytest
|
2024-11-20 23:59:11 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Run specific test file
|
|
|
|
|
uv run pytest tests/test_auth_fixes.py
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Run with coverage
|
|
|
|
|
uv run pytest --cov=services,utils,orm,resolvers
|
|
|
|
|
```
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
### Code quality
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
```bash
|
|
|
|
|
# Run ruff linter
|
|
|
|
|
uv run ruff check .
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Run ruff formatter
|
|
|
|
|
uv run ruff format .
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Run mypy type checker
|
|
|
|
|
uv run mypy .
|
|
|
|
|
```
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
### Run application
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
```bash
|
|
|
|
|
# Run main application
|
|
|
|
|
uv run python main.py
|
2025-07-02 22:30:21 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
# Run development server
|
|
|
|
|
uv run python dev.py
|
|
|
|
|
```
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
## Project structure
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
```
|
|
|
|
|
discours-core/
|
|
|
|
|
├── auth/ # Authentication and authorization
|
|
|
|
|
├── cache/ # Caching system
|
|
|
|
|
├── orm/ # Database models
|
|
|
|
|
├── resolvers/ # GraphQL resolvers
|
|
|
|
|
├── services/ # Business logic services
|
|
|
|
|
├── utils/ # Utility functions
|
|
|
|
|
├── schema/ # GraphQL schema
|
|
|
|
|
├── tests/ # Test suite
|
|
|
|
|
└── docs/ # Documentation
|
|
|
|
|
```
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
## Configuration
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
The project uses `pyproject.toml` for configuration:
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
- **Dependencies**: Defined in `[project.dependencies]` and `[project.optional-dependencies]`
|
|
|
|
|
- **Build system**: Uses `hatchling` for building packages
|
|
|
|
|
- **Code quality**: Configured with `ruff` and `mypy`
|
|
|
|
|
- **Testing**: Configured with `pytest`
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
## CI/CD
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
The project includes GitHub Actions workflows for:
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
- Automated testing
|
|
|
|
|
- Code quality checks
|
|
|
|
|
- Deployment to staging and production servers
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
## License
|
2025-06-19 11:28:48 +03:00
|
|
|
|
2025-08-12 13:12:39 +03:00
|
|
|
MIT License
|