- Python 3.11.3
- Linter: Ruff
- Formatter: Black
make
make run
docker-compose -f ./docker/docker-compose.yml up
For development, recommend using one local database between multiple projects. Before running the application, make sure the volumes are created.
- Volume for Postgres
docker volume create pgdata
- Volume for Redis
docker volume create redisdata
- Generate new migration file
make generate-migration
- Checkout the migration history
alembic history
- Upgrade to the latest revision
make upgrade
- Downgrade to a specific revision
alembic downgrade <revision>
Or downgrade to the previous revision
make rollback
Easy using transaction with Transactional
decorator
from core.db import Transactional
class NewsController(BaseController[News]):
@Transactional()
async def seed(self):
...
from core.cache import Cache
@Cache.cached(prefix="user", ttl=30 * 24 * 60 * 60)
async foo() {
}
from core.cache import Cache
@Cache.cached(prefix="user", ttl=30 * 24 * 60 * 60)
async def scrape(url: str) {
return await fetch(url)
}
async def main() {
data = await Cache.attempt(
key="linkedin-scraper",
ttl=60,
fn=scrape_linkedin,
url="https://www.linkedin.com/"
)
}
- Check format the code
make check-format
- Lint the code
make lint