Summary
Key classes that users need regularly are not exported from the top-level package, forcing users to know internal module paths. Additionally, the library lacks common Python conventions like environment variable configuration and a __version__ attribute.
Current Problems
1. Missing top-level exports
mapepire_python/__init__.py currently exports:
__all__ = [
"apilevel", "threadsafety", "paramstyle",
"DatabaseError", "DataError", "Error", "InterfaceError",
"InternalError", "NotSupportedError", "OperationalError",
"ProgrammingError", "IntegrityError", "Warning",
"CONNECTION_CLOSED", "convert_runtime_errors",
"connect", "Connection", "Cursor",
]
Missing exports that users need:
DaemonServer — the primary credentials class (users must do from mapepire_python.data_types import DaemonServer)
SQLJob — the core sync client (from mapepire_python.client.sql_job import SQLJob)
PoolJob — the core async client (from mapepire_python.pool.pool_job import PoolJob)
Pool, PoolOptions — connection pooling (from mapepire_python.pool.pool_client import Pool)
QueryOptions — query configuration
QueryState, JobStatus — useful enums for checking state
QueryResult — the result type users work with
2. No __version__ attribute
Version is defined in version.py but not re-exported:
# Users expect this to work:
import mapepire_python
print(mapepire_python.__version__) # AttributeError
3. No environment variable configuration
Most Python database clients support environment variables for connection configuration (psycopg2, asyncpg, etc.). mapepire-python requires explicit credentials in every call.
Proposed environment variables:
MAPEPIRE_HOST — server hostname
MAPEPIRE_PORT — server port (default: 8076)
MAPEPIRE_USER — database user
MAPEPIRE_PASSWORD — database password
MAPEPIRE_CA_PATH — path to CA certificate file
This enables:
# With env vars set, just:
with connect() as conn:
result = conn.execute("SELECT ...").fetchone()
4. No async connect() at the top level
The async connection requires a separate import:
from mapepire_python.asyncio.connection import connect # Not discoverable
Should be accessible as:
from mapepire_python import async_connect
# or
from mapepire_python.asyncio import connect
Proposed Changes
-
Add missing classes to __init__.py __all__:
DaemonServer, SQLJob, PoolJob, Pool, PoolOptions
QueryOptions, QueryResult, QueryState, JobStatus
-
Add __version__ re-exported from version.py
-
Add environment variable support to DaemonServer or connect():
- Fall back to env vars when parameters are not provided
- Document the supported env var names
-
Add async_connect to top-level exports or document the async import path clearly
Files to Modify
mapepire_python/__init__.py — Add exports, __version__, async_connect
mapepire_python/data_types.py — Add env var fallback to DaemonServer
mapepire_python/base_job.py — Support env var config in _parse_connection_input()
Acceptance Criteria
Summary
Key classes that users need regularly are not exported from the top-level package, forcing users to know internal module paths. Additionally, the library lacks common Python conventions like environment variable configuration and a
__version__attribute.Current Problems
1. Missing top-level exports
mapepire_python/__init__.pycurrently exports:Missing exports that users need:
DaemonServer— the primary credentials class (users must dofrom mapepire_python.data_types import DaemonServer)SQLJob— the core sync client (from mapepire_python.client.sql_job import SQLJob)PoolJob— the core async client (from mapepire_python.pool.pool_job import PoolJob)Pool,PoolOptions— connection pooling (from mapepire_python.pool.pool_client import Pool)QueryOptions— query configurationQueryState,JobStatus— useful enums for checking stateQueryResult— the result type users work with2. No
__version__attributeVersion is defined in
version.pybut not re-exported:3. No environment variable configuration
Most Python database clients support environment variables for connection configuration (psycopg2, asyncpg, etc.). mapepire-python requires explicit credentials in every call.
Proposed environment variables:
MAPEPIRE_HOST— server hostnameMAPEPIRE_PORT— server port (default: 8076)MAPEPIRE_USER— database userMAPEPIRE_PASSWORD— database passwordMAPEPIRE_CA_PATH— path to CA certificate fileThis enables:
4. No async
connect()at the top levelThe async connection requires a separate import:
Should be accessible as:
Proposed Changes
Add missing classes to
__init__.py__all__:DaemonServer,SQLJob,PoolJob,Pool,PoolOptionsQueryOptions,QueryResult,QueryState,JobStatusAdd
__version__re-exported fromversion.pyAdd environment variable support to
DaemonServerorconnect():Add
async_connectto top-level exports or document the async import path clearlyFiles to Modify
mapepire_python/__init__.py— Add exports,__version__,async_connectmapepire_python/data_types.py— Add env var fallback toDaemonServermapepire_python/base_job.py— Support env var config in_parse_connection_input()Acceptance Criteria
mapepire_pythondirectlymapepire_python.__version__returns the current version stringconnect()works with no arguments when env vars are set