Metadata-Version: 2.4
Name: xmas-core
Version: 2.0.0rc1
Summary: Model, encode, migrate and store XLeitstelle application schema data
License: EUPL-1.2-or-later
License-File: LICENSE.md
Author: Tobias Kraft
Author-email: tobias.kraft@gv.hamburg.de
Requires-Python: >=3.13,<3.14
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Pydantic :: 2
Classifier: License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Dist: alembic (>=1.16.4,<2)
Requires-Dist: asyncpg (>=0.29)
Requires-Dist: gdal (>=3.6.3)
Requires-Dist: geoalchemy2 (>=0.16)
Requires-Dist: httpx2 (>=2.4.0,<3)
Requires-Dist: lxml (>=5.3.0)
Requires-Dist: psycopg[binary] (>=3.2)
Requires-Dist: pydantic (>=2.10.3)
Requires-Dist: pydantic-extra-types[semver]
Requires-Dist: pydantic-settings (>=2.12.0,<3)
Requires-Dist: pyyaml (>=6)
Requires-Dist: sqlalchemy (>=2.0.36)
Requires-Dist: typer (>=0.15.0)
Project-URL: Homepage, https://gitlab.opencode.de/xleitstelle/xmas-core
Project-URL: Issues, https://gitlab.opencode.de/xleitstelle/xmas-core/-/issues
Description-Content-Type: text/markdown

# xmas-core

*Formerly `xplan-tools`: from 2.0 the distribution is `xmas-core`. The `xplan_tools` import and the `xplan-tools` CLI are unchanged for now.*

[![coverage report](https://gitlab.opencode.de/xleitstelle/xmas-core/badges/main/coverage.svg)](https://gitlab.opencode.de/xleitstelle/xmas-core/-/commits/main)
[![pipeline status](https://gitlab.opencode.de/xleitstelle/xmas-core/badges/main/pipeline.svg)](https://gitlab.opencode.de/xleitstelle/xmas-core/-/commits/main)
[![Latest Release](https://gitlab.opencode.de/xleitstelle/xmas-core/-/badges/release.svg)](https://gitlab.opencode.de/xleitstelle/xmas-core/-/releases)

**[Documentation](https://xplan-tools-xleitstelle-xplanung-8446a974e8119a851af45bf94e0717.usercontent.opencode.de/)** | **[Repository](https://gitlab.opencode.de/xleitstelle/xmas-core)**


A Python library to provide some useful means when working with XPlanung, XTrasse and XWaermeplan data, e.g. format conversion, version migration and database setup. Relies on [Pydantic](https://pydantic.dev) for a Python representation of the XPlanung/XTrasse/XWaermeplan model as well as serialization/de-serialization and validation.

While it comes with a CLI, its modules are also meant to provide other applications a Python representation as well as an interface for XPlanung/XTrasse/XWaermeplan data.

## Features

* Conversion between GML, JSON-FG and DB encodings of XPlanung/XTrasse/XWaermeplan data.
* Migration from older versions of XPlanung to the latest one.
* Set up a [PostgreSQL](https://www.postgresql.org)/[PostGIS](https://postgis.net) database to store XPlanung data.
* Adding style properties (stylesheetId, schriftinhalt) to XPlanung presentational objects based on [defined rules](https://xplan-tools-xleitstelle-xplanung-8446a974e8119a851af45bf94e0717.usercontent.opencode.de/style_defs/).
* Typed: the package ships a `py.typed` marker ([PEP 561](https://peps.python.org/pep-0561/)), so its annotations reach a type checker in your own code. The few members typed with `lxml` (e.g. `GMLRepository.content`) stay `Any` unless you install [`lxml-stubs`](https://github.com/lxml/lxml-stubs).

## Installation

### Pixi
This project uses [Pixi](https://pixi.sh) for package management. To install this repo with a self-contained environment, run

```shell
git clone https://gitlab.opencode.de/xleitstelle/xmas-core.git
cd xmas-core
pixi install
```
### Python >= v3.10

[GDAL](https://gdal.org) and its Python bindings are required, so you need to make sure the GDAL system library and Python package versions match.

Download the repository:

```shell
git clone https://gitlab.opencode.de/xleitstelle/xmas-core.git
cd xmas-core
pip install .
```
Or install from PyPI:
```shell
pip install xmas-core
```

### Docker
Images are provided in the [container registry](https://gitlab.opencode.de/xleitstelle/xmas-core/container_registry) (see [docs](https://xplan-tools-xleitstelle-xplanung-8446a974e8119a851af45bf94e0717.usercontent.opencode.de/how-to-guides/#container-image-usage)).


## Development
Make sure [Pixi](https://pixi.sh) is installed and run

```shell
git clone https://gitlab.opencode.de/xleitstelle/xmas-core.git
cd xmas-core
make dev
```

## Developer Guides

For work on development, architecture, or internal workflows, refer to the [Developer Guide Overview](https://gitlab.opencode.de/xleitstelle/xmas-core/-/blob/main/developer_guides/developer_guide.md)

## License

The code in this repository is licensed under the [EUPL-1.2-or-later](https://joinup.ec.europa.eu/collection/eupl)

&copy; [XLeitstelle](https://xleitstelle.de), 2025

