DEV Community

Cover image for Cookiecutter for fast starting with polylith
Yoel Benítez Fonseca
Yoel Benítez Fonseca

Posted on

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

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay