Logo

dev-resources.site

for different kinds of informations.

Cookiecutter for fast starting with polylith

Published at
11/29/2024
Categories
python
polylith
monorepo
programming
Author
ybenitezf
Author
9 person written this
ybenitezf
open
Cookiecutter for fast starting with polylith

Presenting to you a Python cookiecutter for fast starting with polylith in Python. If you do not know what polylith is read the documentation , for the impatient reader:

Polylith is a software architecture that aims to build simple, maintainable, testable, and scalable backend systems. It does this by applying functional thinking at the system scale, treating code as building blocks that can be combined into features.

And python-polylith is the tool that allow us to implement this in Python.

I won't go into details about the advantages of this approach. In this article I introduce you to poetry-poly-cc, a highly opinionated cookiecutter for starting a project with python-polylith.

You can start by installing cookiecutter and generating a project with:

cookiecutter https://github.com/ybenitezf/poetry-poly-cc.git
Enter fullscreen mode Exit fullscreen mode

Answer the questions and you are good. You should endup with something like:

.
ā”œā”€ā”€ LICENSE
ā”œā”€ā”€ README.md
ā”œā”€ā”€ bases
ā”œā”€ā”€ build-packages.sh
ā”œā”€ā”€ components
ā”œā”€ā”€ development
ā”‚Ā Ā  ā””ā”€ā”€ __init__.py
ā”œā”€ā”€ poetry.toml
ā”œā”€ā”€ projects
ā”œā”€ā”€ pyproject.toml
ā”œā”€ā”€ update-locks.sh
ā””ā”€ā”€ workspace.toml
Enter fullscreen mode Exit fullscreen mode

The firsts steps are included in the README.md:

Run

git init
poetry install
# install pre-commit hook
poetry run pre-commit install
# install pre-commit dependencies
poetry run pre-commit run -a
Enter fullscreen mode Exit fullscreen mode

What is included

  1. Poetry is configured to create the virtualenv in the project folder (see poetry.toml)
  2. pytest is added as a test dependency, also includes some goodies for pytest: pytest-mock, pytest-cov and pytest-asyncio
  3. pre-commit & ruff as dev dependencies.
  4. mypy for static typing check, integrated with pre-commit
  5. The support scripts build-packages.sh and update-locks.sh
  6. Recommended vscode extensions
monorepo Article's
30 articles in total
Favicon
Creating a scalable Monorepo for Vue - Workspaces
Favicon
Creating a scalable Monorepo for Vue - Intro
Favicon
Unlocking the Power of Modern Web Architecture: Monorepos, Micro-Frontends, and Vite šŸš€āœØ
Favicon
Emerging Trends in Git: GitOps, Monorepos, Distributed Repositories, and AI Integration
Favicon
Using Node's built-in test runner with Turborepo
Favicon
Building a Scalable Monorepo with TurboRepo
Favicon
Cookiecutter for fast starting with polylith
Favicon
Monorepo vs Microservices: Finding the Perfect Fit for Your Project
Favicon
Nx + TypeORM + NestJS + Migrations
Favicon
How to Build a Changelog Feature in React for Your App
Favicon
Convert a ReactJS app from Vite to Nx
Favicon
How to deploy Google Cloud Functions with PNPM workspaces
Favicon
How CodeMirror v6 dev setup installs packages without a monorepo
Favicon
How CodeMirror v6 dev setup retrieves packages without a monorepo
Favicon
Nx 20: Exploring the new TS preset and TypeScript project references
Favicon
Simple hello world program using Bazel and Go lang
Favicon
A practical example of shared libraries in a monorepo
Favicon
šŸ—‚ļø Monorepo vs. Polyrepo: Choosing the Right Strategy for Your Projects šŸš€
Favicon
Turborepo vs Nx: Mana yang Terbaik untuk Monorepo?
Favicon
Turborepo vs Nx: Which Monorepo Tool is Right for You?
Favicon
Optimizing +200 Pipelines of a Monorepo
Favicon
GitHub Actions: run a job only if a package has changed
Favicon
Building a Solid Foundation: Bootstrapping with Turbo Repo
Favicon
Nestjs Workspaces to build Monorepo
Favicon
Installing EmberJS v2 addons from GitHub forks using PNPM
Favicon
Understanding Monorepo
Favicon
Build Containerized MERN App with Lerna Monorepo
Favicon
Advanced monorepo management with Turborepo 2.0
Favicon
Vite config reuse
Favicon
Monorepo VS Polyrepo

Featured ones: