python-gitmojis


Namepython-gitmojis JSON
Version 0.1.5 PyPI version JSON
download
home_page
Summary😜 A helper package to apply Gitmojis in Python projects 🐍
upload_time2023-09-14 14:50:27
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2023 Kamil Paduszyński Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords emoji emojis git gitmoji gitmojis python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # python-gitmojis

[![](https://img.shields.io/badge/pre--commit-enabled-brightgreen?style=flat-square&logo=pre-commit)][pre-commit.ci]
[![](https://img.shields.io/github/actions/workflow/status/paduszyk/python-gitmojis/lint-package.yml?style=flat-square&label=lint&logo=github)][github-lint-package]
[![](https://img.shields.io/github/actions/workflow/status/paduszyk/python-gitmojis/test-package.yml?style=flat-square&label=test&logo=github)][github-test-package]
[![](https://img.shields.io/codecov/c/github/paduszyk/python-gitmojis?style=flat-square&logo=codecov&label=codecov)][codecov]
[![](https://img.shields.io/codefactor/grade/github/paduszyk/python-gitmojis?style=flat-square&logo=codefactor)][codefactor]
[![](https://img.shields.io/codeclimate/maintainability/paduszyk/python-gitmojis?style=flat-square&logo=code-climate)][code-climate]

[![](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg?style=flat-square)][nox]
[![](https://img.shields.io/endpoint?style=flat-square&url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)][ruff]
[![](https://img.shields.io/badge/type--checked-mypy-blue&?style=flat-square)][mypy]
[![](https://img.shields.io/badge/code%20style-black-black&?style=flat-square)][black]
[![](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square)][gitmoji-website]

The project provides a handy way to manage the set of [Gitmojis][gitmoji-website] (available via the public [API][gitmoji-api]) in Python packages.
It may potentially serve as a helper in projects related to versioning and automatic changelog generation, as well as automation tools for validating commit and pull request titles.

## Installation

To install the package, use `pip`:

```console
$ pip install python-gitmojis
```

or any other dependency management tool you like.

## Usage

The package provides two main functionalities:

* `Gitmoji` and `GitmojiList` classes (from `gitmojis.models` module);
* `gitmojis` object (from `gitmojis.core` module).

The latter can be imported directly from the `gitmojis` package:

```python
from gitmojis import gitmojis
```

The classes represent a Pythonic interface to create and manage immutable `Gitmoji` objects and their lists, with some extra features regarding indexing, slicing, and iteration.
On the other hand, `gitmojis` is simply an instance of `GitmojiList` representing the current state of the Gitmoji [API][gitmoji-api], or its local backup if any issues hindering communication with the API are found.

### `gitmojis.models.Gitmoji` class

The `Gitmoji` is based on a regular Python `@dataclass` (see [PEP 557][pep-557]).
To create a `Gitmoji` object, just call the constructor and pass the field values as the parameters (either as positional or keyword parameters):

```python
from gitmojis.models import Gitmoji

dependabot_gitmoji = Gitmoji(
    emoji="🤖",
    entity="&#x1f916",
    code=":robot:",
    description="Add or update Dependabot configuration.",
    name="robot",
    semver=None,
)

assert isinstance(dependabot_gitmoji, Gitmoji)
```

The meaning of the respective fields is as follows:

- `emoji` – the actual emoji character representing the Gitmoji;
- `entity` – the HTML entity of the Gitmoji;
- `code` – the emoji's code, to be eventually used when rendering Gitmojis in markdown documents (see: the official [GitHub API][github-emoji-api], 3rd party projects like [`emoji`][emoji], or less official [`emoji-cheat-sheet`][emoji-cheat-sheet]);
- `description` – a short note on the type of changes the Gitmoji represents;
- `name` – the text identifier of the Gitmoji;
- `semver` – the level of the [Semantic Version](https://semver.org) affected by the changes marked with the Gitmoji.

> All the fields listed in the example above are optional except `emoji`.

Except for the standard way presented above, `Gitmoji` objects can be created from Python dictionaries and converted to them by using the `from_dict` class method and the `to_dict` instance method, respectively:

```python
from gitmojis.models import Gitmoji

gitmoji_dict = {
    "emoji": "🤖",
    "entity": "&#x1f916",
    "code": ":robot:",
    "description": "Add or update Dependabot configuration.",
    "name": "robot",
    "semver": None,
}

gitmoji = Gitmoji(**gitmoji_dict)

assert Gitmoji.from_dict(gitmoji_dict) == gitmoji
assert gitmoji.to_dict() == gitmoji_dict
```

By default, the `from_dict` method filters out all the irrelevant items from the source `dict`.
Passing `strict=True` disables this behavior, which results in raising `TypeError` if keys not representing the data class fields are found.
Besides, this method raises `TypeError` if the `dict` doesn't contain the key-value pairs needed to create all the required fields.

On the other hand, `to_dict` is a thin wrapper around the `dataclasses.asdict` function.
It accepts the optional keyword argument `skip_defaults`.
If `skip_defaults=True`, the output dictionary doesn't account for the fields with default values.

```python
from gitmojis.models import Gitmoji

gitmoji = Gitmoji(emoji="🤖", semver="patch")

# Including all the fields
assert gitmoji.to_dict(skip_defaults=False) == {
    "emoji": "🤖",
    "entity": None,
    "code": None,
    "description": None,
    "name": None,
    "semver": "patch",
}

# Skipping defaults
assert gitmoji.to_dict(skip_defaults=True) == {
    "emoji": "🤖",
    "semver": "patch",
}
```

### `gitmojis.models.GitmojiList` class

`GitmojiList` is a subclass of `collections.UserList` designed to store and manage sequences of the `Gitmoji` objects.
Compared to plain Python lists, `GitmojiList` instances can be:

* indexed by using all the fields of the constituting `Gitmoji` objects except `semver` – this imposes those fields to have unique values within a list;
* iterated over a selected `Gitmoji` class field or a subset of the fields at once using the `iter_field` and `iter_fields` methods, respectively.

For example:

```python
from dataclasses import astuple

from gitmojis.models import Gitmoji, GitmojiList

gitmoji_dicts = [
    {
        "emoji": "💥",
        "entity": "💥",
        "code": ":boom:",
        "description": "Introduce breaking changes.",
        "name": "boom",
        "semver": "major",
    },
    {
        "emoji": "✨",
        "entity": "✨",
        "code": ":sparkles:",
        "description": "Introduce new features.",
        "name": "sparkles",
        "semver": "minor",
    },
    {
        "emoji": "🐛",
        "entity": "🐛",
        "code": ":bug:",
        "description": "Fix a bug.",
        "name": "bug",
        "semver": "patch",
    },
]

gitmoji_list = GitmojiList([Gitmoji.from_dict(gitmoji) for gitmoji in gitmoji_dicts])

# Indexing using `index_fields`
for index, gitmoji in enumerate(gitmoji_list):
    assert gitmoji_list[index] == gitmoji
    for index_field in GitmojiList.index_fields:
        assert gitmoji_list[getattr(gitmoji, index_field)] == gitmoji

# Iterating over a selected field
assert list(gitmoji_list.iter_field("emoji")) == ["💥", "✨", "🐛"]

# Iterating over a subset of fields
assert list(gitmoji_list.iter_fields("emoji", "code")) == [
    ("💥", ":boom:"),
    ("✨", ":sparkles:"),
    ("🐛", ":bug:"),
]

# Iterating over all fields
for item, gitmoji in zip(gitmoji_list.iter_fields(), gitmoji_list):
    assert item == astuple(gitmoji)
```

> The `Gitmoji` class fields to be used in indexing of `GitmojiList` objects can be modified by overriding the latter's `index_fields` attribute.

### `gitmojis.gitmojis` object

`gitmojis.gitmojis` refers to an instance of `GitmojiList` class with the `data` containing `Gitmoji` objects fetched from the official Gitmoji [API][gitmoji-api].
If there are some issues with connection or API access, the backup data is loaded from the [JSON file][gitmojis-json] installed along with the package.

The data is loaded on the fly as the package is imported.
If you want to load it at your code's runtime, use the implemented loader class (see `gitmojis.loaders` module for more information) or the core loading function (from the `gitmojis.core` module):

```python
from gitmojis.core import get_gitmojis
from gitmojis.loaders import ApiGitmojiLoader

get_gitmojis_api = ApiGitmojiLoader()

# Loading at runtime
# (may fail due to connection errors)
gitmojis = get_gitmojis_api()

# Loading from the API or the backup file
gitmojis = get_gitmojis()
```

## Utilities

### `dump-gitmojis-api` command

The backup file can be kept up-to-date with the official API by using the `dump-gitmojis-api` command:

```console
$ dump-gitmojis-api --help

Usage: dump-gitmojis-api [OPTIONS]

  Make a dump of the Gitmojis API to the backup file.

Options:
  --dry-run  Don't make the dump, just show the backup update summary.
  --dev      Dump the API to the repo's, not the package's, backup.
  --help     Show this message and exit.
```

If no updates are available, the command echoes about that:

```console
$ dump-gitmojis-api
😎 The backup file is up-to-date with the Gitmoji API. ✅
```

If there are some changes (let's say that "🦺" is added to and "🤖" is discarded from the API), the command prints the summary message in the markdown format and actually updates the backup JSON file:

```console
$ dump-gitmojis-api
## Gitmoji API dumped! 🎉

The latest version of the official Gitmoji [API][gitmoji-api] has been dumped to the repo's backup file. 🗃️

### ➕ Added

* 🦺 `:safety_vest:` – Add or update code related to validation.

### ➖ Removed

* 🤖 `:robot:` – Add or update Dependabot configuration.

[gitmoji-api]: https://github.com/carloscuesta/gitmoji/tree/master/packages/gitmojis#api
```

Note that the command updates the JSON file which is a part of package *installed* in your environment.
So, if you (for some reason) want to experiment with it, make sure that you know what you're doing and check whether you have the appropriate permissions.

Alternatively, if you want to just check whether the API has been changed, run the command with the `--dry-run` flag.
This will echo the notifications without touching the files.
Finally, if you work with a clone of this repository, you can add the `--dev` flag to update NOT the backup file in the installed package but the backup file, which is an asset of the clone.
If the API is dumped, except for notification, you should see the changes in the backup file as you call `git status`.

## Automation

The official Gitmoji API state is `cron`-scheduled at the GitHub Actions runner to be periodically compared to the backup file.
The respective [workflow][github-dump-gitmojis-api] automatically applies the update and opens a pull request commented using the `dump-gitmojis-api` command output message.

Every update to the backup file is going to be followed by a version bump.
Therefore, to stay tuned with the Gitmoji API backed up by this library, you should update `python-gitmojis` systematically.
This particularly concerns the developers, who work with local repositories most of the time.

## Contributing

This is an open-source project, so it welcomes all kinds of contributions.
Feel free to open an issue by filing a bug or proposing new (or enhancing existing) functionality.
Check out the [Contributing Guide][contributing-guide] for detailed instructions.

All contributors must follow the project's [Code of Conduct][code-of-conduct].
It's not as complicated as it looks; just be kind and understanding to others! 🙂

## Credits

The idea of Gitmoji was originally proposed, developed, and maintained by [@carloscuesta][github-carlosquesta].

For more information, see the official [repository][gitmoji-repo] and [website][gitmoji-website] of the project.

## Authors

Created by [@paduszyk][github-paduszyk].

## License

Released under the [MIT License][license].

[black]: https://github.com/psf/black
[code-climate]: https://codeclimate.com/github/paduszyk/python-gitmojis
[codefactor]: https://www.codefactor.io/repository/github/paduszyk/python-gitmojis
[code-of-conduct]: https://github.com/paduszyk/python-gitmojis/blob/main/.github/CODE_OF_CONDUCT.md
[codecov]: https://codecov.io/gh/paduszyk/python-gitmojis
[contributing-guide]: https://github.com/paduszyk/python-gitmojis/blob/main/.github/CONTRIBUTING.md
[emoji]: https://github.com/carpedm20/emoji/
[emoji-cheat-sheet]: https://github.com/ikatyang/emoji-cheat-sheet
[github-carlosquesta]: https://github.com/carloscuesta
[github-dump-gitmojis-api]: https://github.com/paduszyk/python-gitmojis/actions/workflows/dump-gitmojis-api.yml
[github-emoji-api]: https://docs.github.com/en/rest/emojis
[github-lint-package]: https://github.com/paduszyk/python-gitmojis/actions/workflows/lint-package.yml
[github-paduszyk]: https://github.com/paduszyk
[github-test-package]: https://github.com/paduszyk/python-gitmojis/actions/workflows/test-package.yml
[gitmoji-api]: https://github.com/carloscuesta/gitmoji/tree/master/packages/gitmojis#api
[gitmoji-repo]: https://github.com/carloscuesta/gitmoji
[gitmoji-website]: https://gitmoji.dev
[gitmojis-json]: https://github.com/paduszyk/python-gitmojis/blob/main/src/gitmoji/assets/gitmojis.json
[license]: https://github.com/paduszyk/python-gitmojis/blob/main/LICENSE
[mypy]: https://github.com/python/mypy
[nox]: https://github.com/wntrblm/nox
[pep-557]: https://peps.python.org/pep-0557/
[pre-commit.ci]: https://results.pre-commit.ci/latest/github/paduszyk/python-gitmojis/main
[ruff]: https://github.com/astral-sh/ruff

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "python-gitmojis",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "emoji,emojis,git,gitmoji,gitmojis,python",
    "author": "",
    "author_email": "Kamil Paduszy\u0144ski <paduszyk@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8e/d1/f53679aef4749fc3155a228830a0ae3aab1d6cac24252bd7d6962aa1e4e7/python-gitmojis-0.1.5.tar.gz",
    "platform": null,
    "description": "# python-gitmojis\n\n[![](https://img.shields.io/badge/pre--commit-enabled-brightgreen?style=flat-square&logo=pre-commit)][pre-commit.ci]\n[![](https://img.shields.io/github/actions/workflow/status/paduszyk/python-gitmojis/lint-package.yml?style=flat-square&label=lint&logo=github)][github-lint-package]\n[![](https://img.shields.io/github/actions/workflow/status/paduszyk/python-gitmojis/test-package.yml?style=flat-square&label=test&logo=github)][github-test-package]\n[![](https://img.shields.io/codecov/c/github/paduszyk/python-gitmojis?style=flat-square&logo=codecov&label=codecov)][codecov]\n[![](https://img.shields.io/codefactor/grade/github/paduszyk/python-gitmojis?style=flat-square&logo=codefactor)][codefactor]\n[![](https://img.shields.io/codeclimate/maintainability/paduszyk/python-gitmojis?style=flat-square&logo=code-climate)][code-climate]\n\n[![](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg?style=flat-square)][nox]\n[![](https://img.shields.io/endpoint?style=flat-square&url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)][ruff]\n[![](https://img.shields.io/badge/type--checked-mypy-blue&?style=flat-square)][mypy]\n[![](https://img.shields.io/badge/code%20style-black-black&?style=flat-square)][black]\n[![](https://img.shields.io/badge/gitmoji-%20\ud83d\ude1c%20\ud83d\ude0d-FFDD67.svg?style=flat-square)][gitmoji-website]\n\nThe project provides a handy way to manage the set of [Gitmojis][gitmoji-website] (available via the public [API][gitmoji-api]) in Python packages.\nIt may potentially serve as a helper in projects related to versioning and automatic changelog generation, as well as automation tools for validating commit and pull request titles.\n\n## Installation\n\nTo install the package, use `pip`:\n\n```console\n$ pip install python-gitmojis\n```\n\nor any other dependency management tool you like.\n\n## Usage\n\nThe package provides two main functionalities:\n\n* `Gitmoji` and `GitmojiList` classes (from `gitmojis.models` module);\n* `gitmojis` object (from `gitmojis.core` module).\n\nThe latter can be imported directly from the `gitmojis` package:\n\n```python\nfrom gitmojis import gitmojis\n```\n\nThe classes represent a Pythonic interface to create and manage immutable `Gitmoji` objects and their lists, with some extra features regarding indexing, slicing, and iteration.\nOn the other hand, `gitmojis` is simply an instance of `GitmojiList` representing the current state of the Gitmoji [API][gitmoji-api], or its local backup if any issues hindering communication with the API are found.\n\n### `gitmojis.models.Gitmoji` class\n\nThe `Gitmoji` is based on a regular Python `@dataclass` (see [PEP 557][pep-557]).\nTo create a `Gitmoji` object, just call the constructor and pass the field values as the parameters (either as positional or keyword parameters):\n\n```python\nfrom gitmojis.models import Gitmoji\n\ndependabot_gitmoji = Gitmoji(\n    emoji=\"\ud83e\udd16\",\n    entity=\"&#x1f916\",\n    code=\":robot:\",\n    description=\"Add or update Dependabot configuration.\",\n    name=\"robot\",\n    semver=None,\n)\n\nassert isinstance(dependabot_gitmoji, Gitmoji)\n```\n\nThe meaning of the respective fields is as follows:\n\n- `emoji` &ndash; the actual emoji character representing the Gitmoji;\n- `entity` &ndash; the HTML entity of the Gitmoji;\n- `code` &ndash; the emoji's code, to be eventually used when rendering Gitmojis in markdown documents (see: the official [GitHub API][github-emoji-api], 3rd party projects like [`emoji`][emoji], or less official [`emoji-cheat-sheet`][emoji-cheat-sheet]);\n- `description` &ndash; a short note on the type of changes the Gitmoji represents;\n- `name` &ndash; the text identifier of the Gitmoji;\n- `semver` &ndash; the level of the [Semantic Version](https://semver.org) affected by the changes marked with the Gitmoji.\n\n> All the fields listed in the example above are optional except `emoji`.\n\nExcept for the standard way presented above, `Gitmoji` objects can be created from Python dictionaries and converted to them by using the `from_dict` class method and the `to_dict` instance method, respectively:\n\n```python\nfrom gitmojis.models import Gitmoji\n\ngitmoji_dict = {\n    \"emoji\": \"\ud83e\udd16\",\n    \"entity\": \"&#x1f916\",\n    \"code\": \":robot:\",\n    \"description\": \"Add or update Dependabot configuration.\",\n    \"name\": \"robot\",\n    \"semver\": None,\n}\n\ngitmoji = Gitmoji(**gitmoji_dict)\n\nassert Gitmoji.from_dict(gitmoji_dict) == gitmoji\nassert gitmoji.to_dict() == gitmoji_dict\n```\n\nBy default, the `from_dict` method filters out all the irrelevant items from the source `dict`.\nPassing `strict=True` disables this behavior, which results in raising `TypeError` if keys not representing the data class fields are found.\nBesides, this method raises `TypeError` if the `dict` doesn't contain the key-value pairs needed to create all the required fields.\n\nOn the other hand, `to_dict` is a thin wrapper around the `dataclasses.asdict` function.\nIt accepts the optional keyword argument `skip_defaults`.\nIf `skip_defaults=True`, the output dictionary doesn't account for the fields with default values.\n\n```python\nfrom gitmojis.models import Gitmoji\n\ngitmoji = Gitmoji(emoji=\"\ud83e\udd16\", semver=\"patch\")\n\n# Including all the fields\nassert gitmoji.to_dict(skip_defaults=False) == {\n    \"emoji\": \"\ud83e\udd16\",\n    \"entity\": None,\n    \"code\": None,\n    \"description\": None,\n    \"name\": None,\n    \"semver\": \"patch\",\n}\n\n# Skipping defaults\nassert gitmoji.to_dict(skip_defaults=True) == {\n    \"emoji\": \"\ud83e\udd16\",\n    \"semver\": \"patch\",\n}\n```\n\n### `gitmojis.models.GitmojiList` class\n\n`GitmojiList` is a subclass of `collections.UserList` designed to store and manage sequences of the `Gitmoji` objects.\nCompared to plain Python lists, `GitmojiList` instances can be:\n\n* indexed by using all the fields of the constituting `Gitmoji` objects except `semver` &ndash; this imposes those fields to have unique values within a list;\n* iterated over a selected `Gitmoji` class field or a subset of the fields at once using the `iter_field` and `iter_fields` methods, respectively.\n\nFor example:\n\n```python\nfrom dataclasses import astuple\n\nfrom gitmojis.models import Gitmoji, GitmojiList\n\ngitmoji_dicts = [\n    {\n        \"emoji\": \"\ud83d\udca5\",\n        \"entity\": \"&#x1f4a5;\",\n        \"code\": \":boom:\",\n        \"description\": \"Introduce breaking changes.\",\n        \"name\": \"boom\",\n        \"semver\": \"major\",\n    },\n    {\n        \"emoji\": \"\u2728\",\n        \"entity\": \"&#x2728;\",\n        \"code\": \":sparkles:\",\n        \"description\": \"Introduce new features.\",\n        \"name\": \"sparkles\",\n        \"semver\": \"minor\",\n    },\n    {\n        \"emoji\": \"\ud83d\udc1b\",\n        \"entity\": \"&#x1f41b;\",\n        \"code\": \":bug:\",\n        \"description\": \"Fix a bug.\",\n        \"name\": \"bug\",\n        \"semver\": \"patch\",\n    },\n]\n\ngitmoji_list = GitmojiList([Gitmoji.from_dict(gitmoji) for gitmoji in gitmoji_dicts])\n\n# Indexing using `index_fields`\nfor index, gitmoji in enumerate(gitmoji_list):\n    assert gitmoji_list[index] == gitmoji\n    for index_field in GitmojiList.index_fields:\n        assert gitmoji_list[getattr(gitmoji, index_field)] == gitmoji\n\n# Iterating over a selected field\nassert list(gitmoji_list.iter_field(\"emoji\")) == [\"\ud83d\udca5\", \"\u2728\", \"\ud83d\udc1b\"]\n\n# Iterating over a subset of fields\nassert list(gitmoji_list.iter_fields(\"emoji\", \"code\")) == [\n    (\"\ud83d\udca5\", \":boom:\"),\n    (\"\u2728\", \":sparkles:\"),\n    (\"\ud83d\udc1b\", \":bug:\"),\n]\n\n# Iterating over all fields\nfor item, gitmoji in zip(gitmoji_list.iter_fields(), gitmoji_list):\n    assert item == astuple(gitmoji)\n```\n\n> The `Gitmoji` class fields to be used in indexing of `GitmojiList` objects can be modified by overriding the latter's `index_fields` attribute.\n\n### `gitmojis.gitmojis` object\n\n`gitmojis.gitmojis` refers to an instance of `GitmojiList` class with the `data` containing `Gitmoji` objects fetched from the official Gitmoji [API][gitmoji-api].\nIf there are some issues with connection or API access, the backup data is loaded from the [JSON file][gitmojis-json] installed along with the package.\n\nThe data is loaded on the fly as the package is imported.\nIf you want to load it at your code's runtime, use the implemented loader class (see `gitmojis.loaders` module for more information) or the core loading function (from the `gitmojis.core` module):\n\n```python\nfrom gitmojis.core import get_gitmojis\nfrom gitmojis.loaders import ApiGitmojiLoader\n\nget_gitmojis_api = ApiGitmojiLoader()\n\n# Loading at runtime\n# (may fail due to connection errors)\ngitmojis = get_gitmojis_api()\n\n# Loading from the API or the backup file\ngitmojis = get_gitmojis()\n```\n\n## Utilities\n\n### `dump-gitmojis-api` command\n\nThe backup file can be kept up-to-date with the official API by using the `dump-gitmojis-api` command:\n\n```console\n$ dump-gitmojis-api --help\n\nUsage: dump-gitmojis-api [OPTIONS]\n\n  Make a dump of the Gitmojis API to the backup file.\n\nOptions:\n  --dry-run  Don't make the dump, just show the backup update summary.\n  --dev      Dump the API to the repo's, not the package's, backup.\n  --help     Show this message and exit.\n```\n\nIf no updates are available, the command echoes about that:\n\n```console\n$ dump-gitmojis-api\n\ud83d\ude0e The backup file is up-to-date with the Gitmoji API. \u2705\n```\n\nIf there are some changes (let's say that \"\ud83e\uddba\" is added to and \"\ud83e\udd16\" is discarded from the API), the command prints the summary message in the markdown format and actually updates the backup JSON file:\n\n```console\n$ dump-gitmojis-api\n## Gitmoji API dumped! \ud83c\udf89\n\nThe latest version of the official Gitmoji [API][gitmoji-api] has been dumped to the repo's backup file. \ud83d\uddc3\ufe0f\n\n### \u2795 Added\n\n* \ud83e\uddba `:safety_vest:` &ndash; Add or update code related to validation.\n\n### \u2796 Removed\n\n* \ud83e\udd16 `:robot:` &ndash; Add or update Dependabot configuration.\n\n[gitmoji-api]: https://github.com/carloscuesta/gitmoji/tree/master/packages/gitmojis#api\n```\n\nNote that the command updates the JSON file which is a part of package *installed* in your environment.\nSo, if you (for some reason) want to experiment with it, make sure that you know what you're doing and check whether you have the appropriate permissions.\n\nAlternatively, if you want to just check whether the API has been changed, run the command with the `--dry-run` flag.\nThis will echo the notifications without touching the files.\nFinally, if you work with a clone of this repository, you can add the `--dev` flag to update NOT the backup file in the installed package but the backup file, which is an asset of the clone.\nIf the API is dumped, except for notification, you should see the changes in the backup file as you call `git status`.\n\n## Automation\n\nThe official Gitmoji API state is `cron`-scheduled at the GitHub Actions runner to be periodically compared to the backup file.\nThe respective [workflow][github-dump-gitmojis-api] automatically applies the update and opens a pull request commented using the `dump-gitmojis-api` command output message.\n\nEvery update to the backup file is going to be followed by a version bump.\nTherefore, to stay tuned with the Gitmoji API backed up by this library, you should update `python-gitmojis` systematically.\nThis particularly concerns the developers, who work with local repositories most of the time.\n\n## Contributing\n\nThis is an open-source project, so it welcomes all kinds of contributions.\nFeel free to open an issue by filing a bug or proposing new (or enhancing existing) functionality.\nCheck out the [Contributing Guide][contributing-guide] for detailed instructions.\n\nAll contributors must follow the project's [Code of Conduct][code-of-conduct].\nIt's not as complicated as it looks; just be kind and understanding to others! \ud83d\ude42\n\n## Credits\n\nThe idea of Gitmoji was originally proposed, developed, and maintained by [@carloscuesta][github-carlosquesta].\n\nFor more information, see the official [repository][gitmoji-repo] and [website][gitmoji-website] of the project.\n\n## Authors\n\nCreated by [@paduszyk][github-paduszyk].\n\n## License\n\nReleased under the [MIT License][license].\n\n[black]: https://github.com/psf/black\n[code-climate]: https://codeclimate.com/github/paduszyk/python-gitmojis\n[codefactor]: https://www.codefactor.io/repository/github/paduszyk/python-gitmojis\n[code-of-conduct]: https://github.com/paduszyk/python-gitmojis/blob/main/.github/CODE_OF_CONDUCT.md\n[codecov]: https://codecov.io/gh/paduszyk/python-gitmojis\n[contributing-guide]: https://github.com/paduszyk/python-gitmojis/blob/main/.github/CONTRIBUTING.md\n[emoji]: https://github.com/carpedm20/emoji/\n[emoji-cheat-sheet]: https://github.com/ikatyang/emoji-cheat-sheet\n[github-carlosquesta]: https://github.com/carloscuesta\n[github-dump-gitmojis-api]: https://github.com/paduszyk/python-gitmojis/actions/workflows/dump-gitmojis-api.yml\n[github-emoji-api]: https://docs.github.com/en/rest/emojis\n[github-lint-package]: https://github.com/paduszyk/python-gitmojis/actions/workflows/lint-package.yml\n[github-paduszyk]: https://github.com/paduszyk\n[github-test-package]: https://github.com/paduszyk/python-gitmojis/actions/workflows/test-package.yml\n[gitmoji-api]: https://github.com/carloscuesta/gitmoji/tree/master/packages/gitmojis#api\n[gitmoji-repo]: https://github.com/carloscuesta/gitmoji\n[gitmoji-website]: https://gitmoji.dev\n[gitmojis-json]: https://github.com/paduszyk/python-gitmojis/blob/main/src/gitmoji/assets/gitmojis.json\n[license]: https://github.com/paduszyk/python-gitmojis/blob/main/LICENSE\n[mypy]: https://github.com/python/mypy\n[nox]: https://github.com/wntrblm/nox\n[pep-557]: https://peps.python.org/pep-0557/\n[pre-commit.ci]: https://results.pre-commit.ci/latest/github/paduszyk/python-gitmojis/main\n[ruff]: https://github.com/astral-sh/ruff\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Kamil Paduszy\u0144ski  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "\ud83d\ude1c A helper package to apply Gitmojis in Python projects \ud83d\udc0d",
    "version": "0.1.5",
    "project_urls": {
        "Documentation": "https://github.com/paduszyk/python-gitmojis#readme",
        "Repository": "https://github.com/paduszyk/python-gitmojis"
    },
    "split_keywords": [
        "emoji",
        "emojis",
        "git",
        "gitmoji",
        "gitmojis",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "62b843eac17a5c45e0446e8c6be416bb6580677da74d049378c84c0fbd3b2fe1",
                "md5": "b5a98087e249d07118a7c4576beabc32",
                "sha256": "076179a3a0417dd377672b16caff71a3efa83d9f0eac0f6e52cb108e09988e88"
            },
            "downloads": -1,
            "filename": "python_gitmojis-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b5a98087e249d07118a7c4576beabc32",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 15783,
            "upload_time": "2023-09-14T14:50:26",
            "upload_time_iso_8601": "2023-09-14T14:50:26.147603Z",
            "url": "https://files.pythonhosted.org/packages/62/b8/43eac17a5c45e0446e8c6be416bb6580677da74d049378c84c0fbd3b2fe1/python_gitmojis-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ed1f53679aef4749fc3155a228830a0ae3aab1d6cac24252bd7d6962aa1e4e7",
                "md5": "e00b3aefcac67a0360351f269409d60e",
                "sha256": "cd282deadacbfb9f52fb8cf772501025bc13563ef5c8d0198153044ba33dc040"
            },
            "downloads": -1,
            "filename": "python-gitmojis-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "e00b3aefcac67a0360351f269409d60e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 22572,
            "upload_time": "2023-09-14T14:50:27",
            "upload_time_iso_8601": "2023-09-14T14:50:27.709436Z",
            "url": "https://files.pythonhosted.org/packages/8e/d1/f53679aef4749fc3155a228830a0ae3aab1d6cac24252bd7d6962aa1e4e7/python-gitmojis-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-14 14:50:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "paduszyk",
    "github_project": "python-gitmojis#readme",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "python-gitmojis"
}
        
Elapsed time: 0.11790s