Versioning and Initialization
Relevant source files
The following files were used as context for generating this wiki page:
Versioning and initialization in flext-tap-oracle are managed through a combination of automated metadata extraction and lazy loading mechanisms. The project adheres to FLEXT framework standards, ensuring that package metadata, such as versioning and authorship, is derived programmatically from the environment, while the initialization process optimizes startup performance by deferring the import of heavy components until they are explicitly required.
This system establishes the foundation for the tap's operational lifecycle, defining how configuration is validated and how the client environment is prepared for Oracle database interactions. Key integration points include the FlextVersion MRO chain for metadata and install_lazy_exports for namespace management.
Package Versioning and Metadata
The versioning system is centered on the FlextTapOracleVersion class, which inherits from flext_core.__version__.FlextVersion. This approach uses the Python importlib.metadata API to automatically populate package attributes.
Metadata Resolution Flow
The following diagram illustrates how metadata is resolved from the package environment:
The versioning logic is encapsulated in src/flext_tap_oracle/__version__.py, where the _metadata attribute is overridden to target the flext-tap-oracle package. Sources: src/flext_tap_oracle/__version__.py:1-25
Core Versioning Attributes
The following table summarizes the primary metadata attributes exported by the package:
| Attribute | Source | Description |
|---|---|---|
__version__ | PackageMetadata | Current semantic version (e.g., 0.12.0-dev) |
__title__ | PackageMetadata | Human-readable project name |
__author__ | PackageMetadata | FLEXT Team |
__license__ | PackageMetadata | MIT License |
Sources: src/flext_tap_oracle/__version__.py:27-46, pyproject.toml:44-50
Package Initialization and Lazy Loading
To maintain a responsive CLI and library interface, flext-tap-oracle utilizes a lazy-loading architecture for its public exports. This prevents the immediate import of large dependencies (like Pydantic or database drivers) during initial package discovery.
Lazy Export Mechanism
The package uses install_lazy_exports from flext_core.lazy to manage its namespace. The _LAZY_IMPORTS map defines the relationship between public symbols and their internal file locations.
Initialization is handled in src/flext_tap_oracle/__init__.py, which distinguishes between _EAGER_EXPORTS (metadata) and _PUBLIC_EXPORTS (functional components like c, m, s, t, u). Sources: src/flext_tap_oracle/__init__.py:13-68
Export Map Configuration
The specific mapping of modules to symbols is defined across specialized export files, ensuring that submodules like models and settings are only loaded when their respective facade symbols (e.g., m or FlextTapOracleSettings) are accessed.
| Module Path | Symbols Exported | Facade Alias |
|---|---|---|
.constants | FlextTapOracleConstants | c |
.models | FlextTapOracleModels | m |
.settings | FlextTapOracleSettings | s |
.typings | FlextTapOracleTypes | t |
.utilities | FlextTapOracleUtilities | u |
Sources: src/flext_tap_oracle/_exports_lazy_part_01.py:10-53
Runtime Initialization and Validation
Beyond package imports, runtime initialization involves setting up the connection environment and validating the configuration against established rules.
Client Initialization Flow
The FlextTapOracleUtilitiesClientMixin defines the procedural steps for preparing the tap for data operations. This includes connection testing and schema discovery.
Configuration Rules for Initialization
Initialization requires adherence to strict schema rules defined in rules.json. These rules govern how the FlextTapOracleSettings object is validated during startup.
| Category | Requirement | Source |
|---|---|---|
| Required Fields | host, username, password | rules.json:76-78 |
| Conditional | Either service_name or sid | rules.json:79-85 |
| Defaults | port: 1521, batch_size: 1000 | rules.json:86-104 |
| Validation | Pydantic v2 with FLEXT_TAP_ORACLE_ prefix | rules.json:62-67 |
Validation is triggered via validate_business_rules() within the FlextTapOracleSettings class, ensuring that crucial parameters like oracle_host and oracle_service_name are present before the tap begins extraction. Sources: src/flext_tap_oracle/settings.py:58-65
Conclusion
Versioning and initialization in the flext-tap-oracle project provide a robust framework for managing package identity and lifecycle. By combining importlib.metadata for versioning, a sophisticated lazy-loading system for initialization, and strict Pydantic-based validation rules, the tap ensures high performance and reliable configuration handling within the Singer and FLEXT ecosystems.