Metadata-Version: 2.1
Name: crosstech-py-tools
Version: 0.2.8
Summary: Common functions, classes and interfaces that CrossTech uses in its python development.
License: MIT
Author: Fedor Sulitskiy
Author-email: fedor@crosstech.co.uk
Requires-Python: >=3.11,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: SQLAlchemy (>=2.0.31,<3.0.0)
Requires-Dist: cloud-sql-python-connector[pg8000] (>=1.10.0,<2.0.0)
Requires-Dist: cryptography (>=42.0.8,<43.0.0)
Requires-Dist: fiona (>=1.9.6,<2.0.0)
Requires-Dist: flask (>=3.0.3,<4.0.0)
Requires-Dist: folium (>=0.17.0,<0.18.0)
Requires-Dist: geopandas (>=1.0.0,<2.0.0)
Requires-Dist: google-cloud-storage (>=2.17.0,<3.0.0)
Requires-Dist: mapclassify (>=2.6.1,<3.0.0)
Requires-Dist: matplotlib (>=3.9.0,<4.0.0)
Requires-Dist: pandas (>=2.2.2,<3.0.0)
Requires-Dist: pydantic (>=2.7.4,<3.0.0)
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Requires-Dist: tqdm (>=4.66.4,<5.0.0)
Description-Content-Type: text/markdown

# CrossTech-Py-Tools

Commonly used python functions and interfaces for CrossTech python development. If you are a _developer_ of this library check out [this documentation](docs/dev.md).

- [📥 Install](#install)
  - [pip](#pip)
  - [poetry](#poetry)
- [🏭 Modules](#modules)
  - [☁️ Cloud Funcs](#cloud-funcs)
  - [💽 Database](#database)
  - [🗺️ Location](#location)
  - [🚂 Mileage](#mileage)
  - [👷 ELRs](#elrs)

## Install

To install the library use the commands provided below.

### pip:
```shell
pip install crosstech-py-tools
```

### poetry:
```shell
poetry add crosstech-py-tools
```

> [!WARNING]
> When trying to add this library to an existing project using poetry, be aware that it is reliant on a large number of dependencies, meaning adding it will require some labour to sort out any conflicts. Hence, it is recommended to start your project by adding this library **first**.

## Modules

### Cloud Funcs

[☁️ Cloud Funcs documentation.](docs/cloud_funcs.md) This module focuses on simplifying the process of testing cloud functions by simulated calls in-code. It provides a wrapper `make_request` around Flask call, which removes the boilerplate code needed to call the cloud function normally.

```python
from crosstech.clound_funcs import make_request
```

### Database

[💽 Database documentation.](docs/database.md) This module provides a database interface that is proven to work in cloud functions. The `BaseDB` object can be used in an inheritance relationship or be injected into a function. Either way, this will save time on setting up the boilerplate necessary to connect to the database.

```python
from crosstech.database import BaseDB
```

### Location

[🗺️ Location documentation.](docs/location.md) This module contains an array of tools useful for analysing and manipulating location data. 

The `explore` function can take in geopandas GeoDataFrames and plot them all on a single map. The `LocTools` object helps with converiting between shapely points and latitude & longitude pairs and vice versa, as well as extracting points from mileages for an ELR. Finally, `TrackGeoJSON` object serves to assist in downloading track geojsons using a single function.

```python
from crosstech.location import explore, LocTools, TrackGeoJSON
```

### Mileage

[🚂 Mileage documentation.](docs/mileage.md) This module contains an object which helps in converting mileages from _Miles.Yards_ to decimal miles, or _Miles.Chains_ to decimal miles, and vice versa.

```python
from crosstech.mileage import MilesYards
```

### ELRs

[👷 ELRs documentation](docs/elrs.md) This module contains objects that help with downloading our Network Models. For more extensive documentation about the Network Model see [this article.](https://docs.crosstech.co.uk/doc/network-model-kfGqIB0lxL)

```python
from crosstech.elrs import FullModel, SimplifiedModel
```

