Python Packaging & Dependencies
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The flext-target-ldif project is a specialized Singer Target designed for generating LDAP Data Interchange Format (LDIF) output. Its packaging architecture is built on modern Python standards, utilizing hatchling as the build backend and maintaining strict version compatibility with Python 3.13. The project is part of the FLEXT ecosystem, relying heavily on a modular suite of internal libraries to handle core Singer protocol logic, LDIF formatting, and observability.
The dependency management strategy follows a "[MANAGED]" approach where core sections of the configuration are enforced by infrastructure tools (flext_infra), ensuring consistency across the FLEXT project suite. This includes standardized development environments, linting rules, and type-checking configurations.
Sources: pyproject.toml:7-38, README.md:1-10
Project Metadata & Build System
The project uses hatchling to manage the build process. Metadata is defined to position the tool as a production-ready integration library for ETL and data-loading operations.
Core Metadata Attributes
| Attribute | Value |
|---|---|
| Name | flext-target-ldif |
| Version | 0.12.0-dev |
| License | MIT |
| Python Requirement | >=3.13, <3.14 |
| Build Backend | hatchling.build |
Sources: pyproject.toml:7-38, README.md:5
Versioning Logic
Versions are managed via a dedicated FlextTargetLdifVersion class which inherits from the base FlextVersion. Metadata is dynamically extracted from the package environment using importlib.metadata.
class FlextTargetLdifVersion(FlextVersion):
"""flext-target-ldif version — MRO-derived from FlextVersion."""
_metadata: PackageMetadata = metadata("flext-target-ldif")
__version__ = FlextTargetLdifVersion.__version__
Sources: src/flext_target_ldif/version.py:18-24
Dependency Architecture
The project's dependency graph is split into runtime requirements and extensive development/tooling requirements.
Runtime Dependencies
The project follows a "Method Resolution Order" (MRO) style inheritance of functionality, where it depends on several sibling flext-* packages to provide its core capabilities.
The diagram shows the tight coupling with the FLEXT ecosystem and Pydantic for data validation.
Sources: pyproject.toml:25-33, README.md:23-27
Development Dependencies
Development dependencies are consolidated under the dev optional-dependencies group. This group includes a comprehensive suite of tools for:
- Linting/Formatting:
ruff,black,isort,autoflake. - Testing:
pytest,pytest-cov,pytest-xdist,hypothesis. - Static Analysis:
mypy,pyright,pyrefly,bandit,deptry. - Documentation:
mkdocsand various plugins (mermaid2, material, custom extensions). - Type Stubs: Extensive
types-*packages for third-party libraries likeldap3,yaml, andrequests.
Sources: pyproject.toml:44-124
Entry Points & Scripts
The package exposes two command-line interface (CLI) entry points. Both point to the TargetLDIF.cli method, facilitating standard Singer target invocation.
flext-target-ldif: Canonical CLI name.target-ldif: Shorthand alias.
Sources: pyproject.toml:126-128, src/flext_target_ldif/target.py:48-51
Tool Configuration Standards
Packaging and code quality are enforced through strict tool configurations in pyproject.toml.
Type Checking & Static Analysis
The project uses both mypy and pyright for strict type checking. mypy is configured with Pydantic and returns-plugin support, while pyright is set to "strict" mode for the src directory.
Linting and Security
ruff is the primary linter, configured with the ALL rule selection and specific per-file ignores to maintain high code quality without sacrificing development velocity. Security scanning is integrated via bandit and pip-audit.
Performance & Testing
pytest is configured with multiple markers (unit, integration, e2e, performance) and automatically generates coverage reports with a failure threshold of 20% to ensure baseline testing rigor.
Sources: pyproject.toml:153-176, pyproject.toml:225-245, pyproject.toml:351-385, pyproject.toml:604-633
Conclusion
The Python packaging and dependency structure of flext-target-ldif reflects a highly standardized, infrastructure-led approach. By leveraging the flext-core and flext-meltano foundations, the project maintains a lightweight runtime footprint while supporting an extremely robust development and quality assurance pipeline. This architecture ensures that the LDIF target remains compliant with the Singer protocol and the broader FLEXT technical ecosystem.