/py-unite-db

Unofficial Python wrapper for the unite-db.com REST API.

Primary LanguagePythonGNU General Public License v2.0GPL-2.0

py-unite-db

GPL-2 Licensed .github/workflows/ci.yml PyPI Docs: MkDocs Code style: black pdm-managed

Unofficial Python wrapper for the unite-db.com REST API.

Introduction

unite-db is a website dedicated to maintaining a database on various stats in the game Pokemon Unite including stats for Pokemon, Battle Items and Held Items.

This wrapper provides a simple, Pythonic interface to those stats via a REST API, with automatic result caching.

Please be warned that this is an unofficial wrapper and the REST API is a private one, so please do not abuse it.

If you are publishing any of the data collected with this API, please give credit to unite-db. They spend many hours collecting this data.

Installation

The package is installable via pip.

pip install py-unite-db

Usage

Import the UniteDb object:

from py_unite_db import UniteDb

unite_db = UniteDb()

Let's get the names of all supporter Pokemon:

>>> [pokemon.name for pokemon in unite_db.pokemon if pokemon.role == "Supporter"]
['Blissey', 'Eldegoss', 'Mr.Mime', 'Wigglytuff']

Contributing

This project uses pdm.

$ pdm install

Running the tests

The project uses pytest.

$ pdm run pytest

Type Checking

The project must pass mypy type checking.

$ pdm run typecheck

If you are using mypy with an IDE like VS Code make sure you have run

$ pdm run stubs

To work around mypy not supporting PEP582 yet. See python/mypy#10633 for more info on this.

Formatting

Imports are sorted with isort and source files are formatted with black.

$ pdm run format
$ pdm run formatcheck

If you are using VS Code this will be automatically done on save.

Linting

Linting is provided by flake8.

$ pdm run lint

Conventional Commits

The project follows the conventional commit style.

Docs

This project uses mkdocs, mkdocstrings, mkdocs-material for its documentation.

$ pdm run fetch_charm
$ pdm run mkdocs serve