Metadata-Version: 2.3
Name: moj-data-loader
Version: 2.2.0
Summary: MoJ Data Loader (MoDaL) provides an easy-to-use, config-driven way to load files from S3 into Athena.
Requires-Dist: awswrangler>=3.17.0
Requires-Dist: charset-normalizer>=3.4.9
Requires-Dist: click>=8.4.2
Requires-Dist: cloudpathlib>=0.24.0
Requires-Dist: cryptography>=50.0.0
Requires-Dist: dlt[athena,pyiceberg]>=1.29.1
Requires-Dist: duckdb>=1.5.5
Requires-Dist: fsspec>=2026.7.0
Requires-Dist: gitpython>=3.1.58
Requires-Dist: loguru>=0.7.3
Requires-Dist: msoffcrypto-tool>=5.4.2
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: pandas>=3.0.5
Requires-Dist: pathlib>=1.0.1
Requires-Dist: psutil>=7.2.2
Requires-Dist: pyarrow>=24.0.0
Requires-Dist: pydantic>=2.13.4
Requires-Dist: pydantic-settings>=2.14.2
Requires-Dist: pyiceberg>=0.9.0
Requires-Dist: python-calamine>=0.8.2
Requires-Dist: python-gnupg>=0.5.6
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: setuptools>=83.0.0
Requires-Dist: sqlalchemy>=2.0.51
Requires-Dist: tornado>=6.6.1
Requires-Dist: xlrd>=2.0.2
Requires-Dist: ruff ; extra == 'linting'
Requires-Python: >=3.12
Provides-Extra: linting
Description-Content-Type: text/markdown

# MoJ Data Loader (MoDaL)
MoJ Data Loader provides an easy to use, config-driven way to load files from S3 into Athena.

## Install in Your Project

MoDaL is distributed as the `moj-data-loader` Python package on PyPI. It requires Python 3.12 or newer. Install it in the repository that owns your pipelines; you do not need to clone this repository.

For a project managed with [uv](https://docs.astral.sh/uv/), run from your project root:

```bash
uv add moj-data-loader
uv run moj-data-loader --help
```

Alternatively, install it in a virtual environment with pip:

```bash
python -m venv .venv
source .venv/bin/activate
python -m pip install moj-data-loader
moj-data-loader --help
```

The package name and CLI command are `moj-data-loader`, not `modal`.

## Use Your Own Pipeline Repository

Keep your pipeline YAMLs in your own repository:

```text
your-project/
	pyproject.toml
	pipelines/
		your_domain/
			your_database/
				your_table.yml
```

Run from that repository's root:

```bash
uv run moj-data-loader load your_table --env test
```

With an activated pip environment, omit `uv run`. Configure AWS credentials and permissions for the source S3 data and Athena destination before loading data.

By default, MoDaL searches `./pipelines/`, not the installed package's directory. Use `--configs-dir /path/to/pipelines` or `MODAL_CONFIG_DIR` to select another config root, retaining the `domain/database/table.yml` layout.

Existing pipelines in this repository can continue to use the monorepo and its Airflow image during the transition. New pipelines will soon no longer be accepted here: create them in your own repository using the PyPI package, and plan to migrate existing pipelines there too. See the [migration guide](docs/migration_v2.md#move-pipelines-to-your-own-repository).

## Releases

The Airflow container workflow runs on pushed tags without `/`. A monorepo tag such as `monorepo-v2.1.25` builds the container without publishing to PyPI; use this for interim pipeline-only releases.

For a package release, update the version in `pyproject.toml` and the lockfile, then push a version tag such as `v2.1.25` matching the package version. This publishes to PyPI and also builds the container. A manually dispatched PyPI workflow publishes to TestPyPI only. Configure the GitHub `release` environment and PyPI trusted publisher for production publishing.

## Usage guidance

You can find usage guidance in [`docs/user_guide`](docs/user_guide.md)

Pipeline YAML specification is documented in [`docs/pipeline_config.md`](docs/pipeline_config.md).

## Migration notes

v2.0 is a breaking release.

- Supported CLI: `moj-data-loader`
- Supported environment variables: `MODAL_*`
- Removed in v2.0: `airflow-file` command alias and `AFFILE_*` environment variables

For migration steps and old-to-new mappings, see:

- [`docs/migration_v2.md`](docs/migration_v2.md)
- [`docs/release_notes.md`](docs/release_notes.md)

## Useful links
- Documentation can be found at the Data and Analytics Engineering internal Pages site [here]: TBC
- Development of this repo is managed via this [Project Board](https://github.com/orgs/moj-analytical-services/projects/262/views/1)

## Contributing

To develop MoDaL itself, clone this repository and run:

```bash
uv sync
uv run pytest tests/unit
```

`uv sync` installs MoDaL in editable mode for development. Users should add the released package to their own project's dependencies instead. Commit your project's dependency manifest and lockfile to keep local, CI, and deployment environments consistent.
