architectonics 0.0.23__tar.gz → 0.0.25__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: architectonics
3
- Version: 0.0.23
3
+ Version: 0.0.25
4
4
  Summary:
5
5
  Author: Your Name
6
6
  Author-email: you@example.com
@@ -0,0 +1,5 @@
1
+ import datetime
2
+
3
+
4
+ def get_current_datetime():
5
+ return datetime.datetime.utcnow()
@@ -0,0 +1,20 @@
1
+ from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine
2
+ from sqlalchemy.orm import sessionmaker
3
+
4
+ from architectonics.infrastructure.config.database_settings import database_settings
5
+
6
+
7
+ def get_engine() -> AsyncEngine:
8
+ return create_async_engine(
9
+ database_settings.DATABASE_CONNECTION_STRING,
10
+ future=True,
11
+ echo=False,
12
+ )
13
+
14
+
15
+ def get_session(engine: AsyncEngine) -> sessionmaker:
16
+ return sessionmaker(
17
+ bind=engine,
18
+ class_=AsyncSession,
19
+ expire_on_commit=False,
20
+ )
@@ -0,0 +1,23 @@
1
+ import os
2
+
3
+ from dotenv import load_dotenv
4
+ from pydantic import BaseModel
5
+
6
+ load_dotenv()
7
+
8
+
9
+ class DatabaseSettings(BaseModel):
10
+ DATABASE_PREFIX: str = "postgresql+asyncpg"
11
+
12
+ POSTGRES_USER: str = os.getenv("POSTGRES_USER")
13
+ POSTGRES_PASSWORD: str = os.getenv("POSTGRES_PASSWORD")
14
+ POSTGRES_HOST: str = os.getenv("POSTGRES_HOST")
15
+ POSTGRES_PORT: int = os.getenv("POSTGRES_PORT")
16
+ POSTGRES_DATABASE_NAME: str = os.getenv("POSTGRES_DATABASE_NAME")
17
+
18
+ DATABASE_CONNECTION_STRING: str = (
19
+ f"{DATABASE_PREFIX}://{POSTGRES_USER}:" f"{POSTGRES_PASSWORD}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DATABASE_NAME}"
20
+ )
21
+
22
+
23
+ database_settings = DatabaseSettings()
@@ -0,0 +1,30 @@
1
+ import uuid
2
+
3
+ from sqlalchemy import Column, DateTime, String
4
+ from sqlalchemy.orm import as_declarative
5
+
6
+ from architectonics.common.utils.utils import get_current_datetime
7
+
8
+
9
+ @as_declarative()
10
+ class BaseEntity:
11
+ __abstract__ = True
12
+
13
+ id = Column(
14
+ String,
15
+ primary_key=True,
16
+ default=lambda: str(uuid.uuid4()),
17
+ )
18
+
19
+ created_at = Column(
20
+ DateTime,
21
+ default=get_current_datetime,
22
+ )
23
+
24
+ updated_at = Column(
25
+ DateTime,
26
+ default=get_current_datetime,
27
+ onupdate=get_current_datetime,
28
+ )
29
+
30
+ PK_FIELD = "id"
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "architectonics"
3
- version = "0.0.23"
3
+ version = "0.0.25"
4
4
  description = ""
5
5
  authors = ["Your Name <you@example.com>"]
6
6
 
@@ -3,9 +3,14 @@ from setuptools import setup
3
3
 
4
4
  packages = \
5
5
  ['architectonics',
6
+ 'architectonics.common',
7
+ 'architectonics.common.utils',
6
8
  'architectonics.core',
7
9
  'architectonics.core.config',
8
- 'architectonics.core.factory']
10
+ 'architectonics.core.factory',
11
+ 'architectonics.infrastructure',
12
+ 'architectonics.infrastructure.config',
13
+ 'architectonics.infrastructure.entities']
9
14
 
10
15
  package_data = \
11
16
  {'': ['*']}
@@ -22,7 +27,7 @@ install_requires = \
22
27
 
23
28
  setup_kwargs = {
24
29
  'name': 'architectonics',
25
- 'version': '0.0.23',
30
+ 'version': '0.0.25',
26
31
  'description': '',
27
32
  'long_description': None,
28
33
  'author': 'Your Name',