Metadata-Version: 2.1
Name: impresso
Version: 0.9.8
Summary: A Library to interact with the Impresso API
Home-page: https://github.com/impresso/impresso-py
License: AGPL-3.0-or-later
Author: Daniele Guido
Author-email: daniele.guido@uni.lu
Requires-Python: >=3.10.0,<4.0.0
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Dist: PyJWT (>=2.8.0,<3.0.0)
Requires-Dist: PyYAML (>=6.0.2,<7.0.0)
Requires-Dist: attrs (>=23.2.0,<24.0.0)
Requires-Dist: httpx (>=0.27.0,<0.28.0)
Requires-Dist: matplotlib (>=3.7.0,<4.0.0)
Requires-Dist: pandas (>=2.1.0,<3.0.0)
Requires-Dist: pandas-stubs (>=2.2.1.240316,<3.0.0.0)
Requires-Dist: protobuf (>=5.27.2,<6.0.0)
Requires-Dist: pydantic (>=2.6.4,<3.0.0)
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
Requires-Dist: types-PyYAML (>=6.0.12.20240311,<7.0.0.0)
Requires-Dist: types-protobuf (>=5.27.0.20240626,<6.0.0.0)
Project-URL: Endpoint, https://impresso-project.ch/public-api
Project-URL: Issues, https://github.com/impresso/impresso-py/issues
Project-URL: Repository, https://github.com/impresso/impresso-py
Description-Content-Type: text/markdown

# Impresso Python Library

[![PyPI version](https://badge.fury.io/py/impresso.svg)](https://badge.fury.io/py/impresso)
![PyPI - License](https://img.shields.io/pypi/l/impresso)

Impresso is a library to interact with the [Impresso](https://impresso-project.ch/app) dataset. It provides a set of classes to interact with the API and a set of tools that make working with the data easier.

## Installation

With `pip`:

```bash
pip install impresso
```

## Usage

See sample notebooks in the [examples/notebooks](https://github.com/impresso/impresso-py/tree/main/examples/notebooks) directory or examples available in the [Impresso Datalab](https://impresso-project.ch/datalab/).

## Extending the library

We use [Poetry](https://python-poetry.org/) for dependency management. To install the package in development mode, run the following command in the root directory of the project:

```shell
poetry install
```

This will create and activate a virtual environment with all the dependencies installed.

### Testing

```shell
poetry run pytest
```

### Linting

```shell
poetry run pytest
poetry run flake8 impresso tests
poetry run mypy impresso tests
```

### OpenAPI client generation

The OpenAPI client is generated using the OpenAPI Generator. Pydantic models from the OpenAPI spec are generated too. The following command generates both the client code and the pydantic models:

```shell
poetry run generate-client
```

Whenever the OpenAPI spec of the Impresso Public API changes, the client code and the pydantic models must be regenerated.

### Protobuf

Filters used in some endpoints are serialized as a protobuf message. The protobuf message is defined in the [impresso-jscommons](https://github.com/impresso/impresso-jscommons) project. The python code is generated using the `protoc` compiler (must be [installed](https://google.github.io/proto-lens/installing-protoc.html) separately). The following command generates the python code for the protobuf message:

```shell
poetry run generate-protobuf
```

## About Impresso

### Impresso project

[Impresso - Media Monitoring of the Past](https://impresso-project.ch) is an interdisciplinary research project that aims to develop and consolidate tools for processing and exploring large collections of media archives across modalities, time, languages and national borders. The first project (2017-2021) was funded by the Swiss National Science Foundation under grant No. [CRSII5_173719](http://p3.snf.ch/project-173719) and the second project (2023-2027) by the SNSF under grant No. [CRSII5_213585](https://data.snf.ch/grants/grant/213585) and the Luxembourg National Research Fund under grant No. 17498891.

### Copyright

Copyright (C) 2024 The Impresso team.

### License

This program is provided as open source under the [GNU Affero General Public License](https://github.com/impresso/impresso-pyindexation/blob/master/LICENSE) v3 or later.

---

<p align="center">
  <img src="https://github.com/impresso/impresso.github.io/blob/master/assets/images/3x1--Yellow-Impresso-Black-on-White--transparent.png?raw=true" width="350" alt="Impresso Project Logo"/>
</p>

