semvec/pypi-packages huggingface dataset:
eche 0.2.1
Little helper for handling entity clusters
License: MIT
Requires Python: <4.0,>=3.8
Keywords: entity resolution, record linkage, clustering, connected components, transitive closure

<p align="center">
<img src="https://github.com/dobraczka/eche/raw/main/docs/assets/logo.png" alt="eche logo", width=200/>
</p>

<p align="center">
<a href="https://github.com/dobraczka/eche/actions/workflows/main.yml"><img alt="Actions Status" src="https://github.com/dobraczka/eche/actions/workflows/main.yml/badge.svg?branch=main"></a>
<a href='https://eche.readthedocs.io/en/latest/?badge=latest'><img src='https://readthedocs.org/projects/eche/badge/?version=latest' alt='Documentation Status' /></a>
<a href="https://pypi.org/project/eche"/><img alt="Stable python versions" src="https://img.shields.io/pypi/pyversions/eche"></a>
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff" style="max-width:100%;"></a>
</p>

Usage
=====
Eche provides a `ClusterHelper` class to conveniently handle entity clusters.

```python
  from eche import ClusterHelper
  ch = ClusterHelper([{"a1", "b1"}, {"a2", "b2"}])
  print(ch.clusters)
  {0: {'a1', 'b1'}, 1: {'a2', 'b2'}}
```

Add an element to a cluster

```python
  ch.add_to_cluster(0, "c1")
  print(ch.clusters)
  {0: {'a1', 'b1', 'c1'}, 1: {'a2', 'b2'}}
```

Add a new cluster

```python
  ch.add({"e2", "f1", "c3"})
  print(ch.clusters)
  {0: {'a1', 'b1', 'c1'}, 1: {'a2', 'b2'}, 2: {'f1', 'e2', 'c3'}}
```

Remove an element from a cluster

```python
  ch.remove("b1")
  print(ch.clusters)
  {0: {'a1', 'c1'}, 1: {'a2', 'b2'}, 2: {'f1', 'e2', 'c3'}}
```

The ``__contains__`` function is smartly overloaded. You can check if an entity is in the `ClusterHelper`:

```python
  "a1" in ch
  # True
```

If a cluster is present

```python
  {"c1","a1"} in ch
  # True
```

And even if a link exists or not

```python
  ("f1","e2") in ch
  # True
  ("a1","e2") in ch
  # False
```

To know the cluster id of an entity you can look it up with

```python
  print(ch.elements["a1"])
  0
```

To get members of a cluster either use

```python
  print(ch.members(0))
  {'a1', 'b1', 'c1'}
```

or simply

```python
  print(ch[0])
  {'a1', 'b1', 'c1'}
```

More functions can be found in the [Documentation](https://eche.readthedocs.io).

Installation
============
Simply use `pip` for installation:
```
pip install eche
```
coordextract 0.1.3
coordextract is a Python library and CLI tool for converting data from GPX files into pydantic models and adding MGRS coordinates to the data. The CLI will return the data in JSON format.
License: MIT
Requires Python: <3.12,>=3.10

![Code Coverage](https://gitlab.com/smcleaish/coordextract/badges/main/coverage.svg)
![Gitlab CI](https://gitlab.com/smcleaish/coordextract/badges/main/pipeline.svg)
![PyPI](https://img.shields.io/pypi/v/coordextract)
# coordextract
coordextract is a Python library and CLI tool for converting data from 
GPX files into pydantic models for further processesing. It was designed 
to be used as a FastAPI service. 

While building the pydantic model it verifies that the points are legitimate 
and does MGRS conversion which is added to the model as a new field.

The CLI tool will output the model as a JSON string or file. 

## Features

- Batch process GPX files asynchronously with asyncio.
- Use CPU concurrency if datasets are large.
- Command-line interface (CLI).

## Installation
```shell
poetry add coordextract
```
or
```shell
pip install coordextract
```
 
coordextract uses Poetry for dependency management.
[Poetry website](https://python-poetry.org/docs/)

To install the development version of coordextract, clone the repository and
install the dependencies with Poetry.

```shell
git clone https://github.com/SMcLeaish/coordextract/
cd coordextract
poetry install
```
### As a library

The main entry point for the library is the CoordExtract.process_coords()
```python
from coordextract import process_coords

"""

process_coords() takes five arguments:

- input_file(s): Path - The path to the input GPX file(s).

- output_file: Optional(Path) - The path to the output file.

- indent: Optional(int) - The number of spaces to indent JSON output. 
    Default 2.

- concurrency: Optional(bool) - Will attempt to spawn multiple processes
    for batch requests. Default False.

- context: Optional(str) - If None a the PointModel will be returned. 
    If set to cli, output will be JSON to stdout if no output file is 
    specified. Default None.

"""
process_coords('path/to/file.gpx', 'path/to/output.csv', 2, True, 'cli')
```

### As a CLI tool

coordextract on the command line takes gpx file(s) as its first input and
supports the following options:

`--output-file` - The path to the output file.

`--indent` - The number of spaces to indent JSON output. Default 2.

`--concurrency` - Will attempt to spawn multiple processes for batch requests.

`--help` - Display the help message.

### License

This project is licensed under the MIT License - see the LICENSE file for details.


 *This repository is mirrored at [https://github.com/SMcLeaish/coordextract/](https://github.com/SMcLeaish/coordextract/) 
from [https://gitlab.com/smcleaish/coordextract](https://gitlab.com/smcleaish/coordextract) and uses gitlab CI*