esuls 0.1.1__tar.gz → 0.1.2__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.4
2
2
  Name: esuls
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Utility library for async database operations, HTTP requests, and parallel execution
5
5
  Author-email: IperGiove <ipergiove@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "esuls"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "Utility library for async database operations, HTTP requests, and parallel execution"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.14"
@@ -9,6 +9,7 @@ from functools import lru_cache
9
9
  import uuid
10
10
  import contextlib
11
11
  import enum
12
+ from loguru import logger
12
13
 
13
14
  T = TypeVar('T')
14
15
  SchemaType = TypeVar('SchemaType', bound='BaseModel')
@@ -64,7 +65,7 @@ class AsyncDB(Generic[SchemaType]):
64
65
 
65
66
  async def _init_schema(self, db: aiosqlite.Connection) -> None:
66
67
  """Generate schema from dataclass structure with support for field additions."""
67
- print(f"Initializing schema for {self.schema_class.__name__} in table {self.table_name}")
68
+ logger.debug(f"Initializing schema for {self.schema_class.__name__} in table {self.table_name}")
68
69
 
69
70
  field_defs = []
70
71
  indexes = []
@@ -85,12 +86,12 @@ class AsyncDB(Generic[SchemaType]):
85
86
 
86
87
  # Process all fields in the dataclass - ONLY THIS SCHEMA CLASS
87
88
  schema_fields = fields(self.schema_class)
88
- print(f"Processing {len(schema_fields)} fields for {self.schema_class.__name__}")
89
+ logger.debug(f"Processing {len(schema_fields)} fields for {self.schema_class.__name__}")
89
90
 
90
91
  for f in schema_fields:
91
92
  field_name = f.name
92
93
  field_type = self._type_hints.get(field_name)
93
- print(f" Field: {field_name} -> {field_type}")
94
+ logger.debug(f" Field: {field_name} -> {field_type}")
94
95
 
95
96
  # Map Python types to SQLite types
96
97
  if field_type in (int, bool):
@@ -123,7 +124,7 @@ class AsyncDB(Generic[SchemaType]):
123
124
  elif field_name not in existing_columns:
124
125
  # Alter table to add the new column without NOT NULL constraint
125
126
  alter_sql = f"ALTER TABLE {self.table_name} ADD COLUMN {field_name} {sql_type}"
126
- print(f" Adding new column: {alter_sql}")
127
+ logger.debug(f" Adding new column: {alter_sql}")
127
128
  await db.execute(alter_sql)
128
129
  await db.commit()
129
130
 
@@ -147,7 +148,7 @@ class AsyncDB(Generic[SchemaType]):
147
148
  {', '.join(field_defs)}{constraints_sql}
148
149
  )
149
150
  """
150
- print(f"Creating table: {create_sql}")
151
+ logger.debug(f"Creating table: {create_sql}")
151
152
  await db.execute(create_sql)
152
153
 
153
154
  # Create indexes
@@ -155,7 +156,7 @@ class AsyncDB(Generic[SchemaType]):
155
156
  await db.execute(idx_stmt)
156
157
 
157
158
  await db.commit()
158
- print(f"Schema initialization complete for {self.schema_class.__name__}")
159
+ logger.debug(f"Schema initialization complete for {self.schema_class.__name__}")
159
160
 
160
161
  @contextlib.asynccontextmanager
161
162
  async def transaction(self):
@@ -279,8 +280,7 @@ class AsyncDB(Generic[SchemaType]):
279
280
 
280
281
  except Exception as e:
281
282
  if skip_errors:
282
- # Optionally log the error for debugging
283
- # print(f"Save error (skipped): {e}")
283
+ logger.warning(f"Save error (skipped): {e}")
284
284
  continue
285
285
  raise
286
286
 
@@ -327,8 +327,7 @@ class AsyncDB(Generic[SchemaType]):
327
327
 
328
328
  except Exception as e:
329
329
  if skip_errors:
330
- # Optionally log the error for debugging
331
- # print(f"Save error (skipped): {e}")
330
+ logger.warning(f"Save error (skipped): {e}")
332
331
  return False
333
332
  raise
334
333
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esuls
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Utility library for async database operations, HTTP requests, and parallel execution
5
5
  Author-email: IperGiove <ipergiove@gmail.com>
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes