GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - DavidVujic/python-polylith-example: Example Polylith setup for Python

BranchesTags
Open more actions menu

Latest commit

 

History

76 Commits
76 Commits

Folders and files

NameName
Last commit message
Last commit date
.circleci
.circleci
 
 
_kubernetes
_kubernetes
 
 
bases/example
bases/example
 
 
components/example
components/example
 
 
development
development
 
 
projects
projects
 
 
test
test
 
 
.flake8
.flake8
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
mypy.ini
mypy.ini
 
 
poetry.lock
poetry.lock
 
 
poetry.toml
poetry.toml
 
 
pyproject.toml
pyproject.toml
 
 
workspace.toml
workspace.toml
 
 

Repository files navigation

Python Polylith Example

This is a repository with an example Python setup of the Polylith Architecture. Here you will find examples of code being shared between different kind of projects, and the developer tooling setup.

Developer experience

Mypy

Have a look at the mypy.ini configuration file, to make Mypy work really well with this type of architecture.

[mypy]
mypy_path = components, bases
namespace_packages = True
explicit_package_bases = True

The "loose" theme

This repository is setup with the loose theme, a Python exclusive addition to the architecture. The theme is about the folder structure of components:

components/<namespace>/<name>, and a separate tests top folder.

Currently, there is poor support in Mypy for the original Polylith component structure:

components/<name>/<src or test>/<namespace>/<name>/

With the original Polylith structure, you will have to explicitly add each component path to the mypy_path. There is a feature request in the mypy repo about adding regex support to the mypy_path property. Hopefully it will be implemented in the future. 🙏

.venv

It is recommended to create the virtual environment locally, for a great code editor experience. By default, Poetry will create a venv outside of the repo. You can override that behaviour by adding a configuration in a poetry.toml file:

[virtualenvs]
path = ".venv"
in-project = true

Tooling support

There's tooling support for using Polylith in Python. Have a look at this repository: Python tools for the Polylith Architecture

Tests

Run tests with:

poetry run pytest

Deployment

The projects contain examples for packaging and deploying APIs and handlers with docker, AWS Lambdas and GCP functions.

Kubernetes

The "My FastAPI project" includes an example setup for deploying into a Kubernetes cluser, by using kustomize to configure the deployments.

Have a look at the project-specific and the shared configurations.

The configuration is structured as:

  • basic setup for all types of deployments
    • with overlays for different environments (development, staging, production)
  • service-specific setup, with overlays
    • APIs
    • handlers
  • project-specific setup, with overlays

About

Example Polylith setup for Python

Resources

Readme
MIT license
Activity

Stars

59 stars

Watchers

2 watching

Forks

7 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.