Skip to main content

Assimilator - the best Python patterns for the best projects

PyAssimilator

License Stars Last commit

Install now

  • pip install py-assimilator
  • pip install py-assimilator[alchemy] - Optional SQLAlchemy support
  • pip install py-assimilator[kafka] - Optional Kafka support
  • pip install py-assimilator[redis] - Optional Redis support
  • pip install py-assimilator[mongo] - Optional MongoDB support

Simple example

Example usage of the code to create a user using all the DDD patterns:

from assimilator.alchemy.database import AlchemyUnitOfWork, AlchemyRepository
from assimilator.core.database import UnitOfWork

def create_user(username: str, email: str, uow: UnitOfWork):
    with uow:
        repository = uow.repository     # Get Repository pattern
        new_user = repository.save(username=username, email=email, balance=0)
        uow.commit()    # Securely save the data

    return new_user


user_repository = AlchemyRepository(
    session=alchemy_session,    # alchemy db session
    model=User,     # alchemy user model 
)
user_uow = AlchemyUnitOfWork(repository=user_repository)

create_user(
    username="Andrey", 
    email="python.on.papyrus@gmail.com",
    uow=user_uow,
)

Why do I need it?

Patterns are very useful for good code, but only to some extent. Most of them are not suitable for real life applications. DDD(Domain-driven design) is one of the most popular ways of development today, but nobody explains how to write most of DDD patterns in Python. Even if they do, life gives you another issue that cannot be solved with a simple algorithm. That is why Andrey created a library for the patterns that he uses in his projects daily.

Watch our Demo to find out more about pyAssimilator capabilities.

Source

Stars history

Star History Chart

Types of patterns

These are different use cases for the patterns implemented:

  • Database - patterns for database/data layer interactions.
  • Events(in development) - projects with events or event-driven architecture.
  • Unidentified - patterns that are useful for different purposes.

Available providers

Providers are different patterns for external modules like SQLAlchemy or FastAPI.

  • Alchemy(Database, Events) - patterns for SQLAlchemy for both database and events.
  • Kafka(Events) - patterns in Kafka related to events.
  • Internal(Database, Events) - internal is the type of provider that saves everything in memory(dict, list and all the tools within your app).
  • Redis(Database, Events) - redis_ allows us to work with Redis memory database.
  • MongoDB(Database) - mongo allows us to work with MongoDB database.

Release files for py-assimilator 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-assimilator 1.1.1
File Size Uploaded
py_assimilator-1.1.1.tar.gz 22.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-assimilator 1.1.1
File Interpreter ABI Platform
py_assimilator-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 66.3 kB

Release files / py_assimilator-1.1.1.tar.gz

Download URL py_assimilator-1.1.1.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b430df2d3c7f1c8595e0a5d08d0928a11bc4c0ed60b7c33a3c0ab69f43515d72
BLAKE2b-256 checksum
How to use checksums
03eabedd6e92935a5ec0ba33f87c0359b339e55d51f92fe1a3de784827e83f22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / py_assimilator-1.1.1-py3-none-any.whl

Download URL py_assimilator-1.1.1-py3-none-any.whl
Size 43.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2eaea1e2711831cf92d13bdc83f36c65acc1669a696c0aa1d2898bd2b32364db
BLAKE2b-256 checksum
How to use checksums
e137e5b58a8ad0626d9c1df4b056695ea292ac2106946d0905a1df0876c09e38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release history Release notifications | RSS feed

1.3.1

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.1

1 release file

0.3.0

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page