python-gitmojis 0.1.5__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-gitmojis-0.1.5 → python_gitmojis-1.1.0}/LICENSE +1 -1
- python_gitmojis-1.1.0/PKG-INFO +257 -0
- python_gitmojis-1.1.0/README.md +233 -0
- python_gitmojis-1.1.0/pyproject.toml +172 -0
- python_gitmojis-1.1.0/src/gitmojis/__init__.py +8 -0
- python_gitmojis-1.1.0/src/gitmojis/__main__.py +4 -0
- python_gitmojis-1.1.0/src/gitmojis/cli/__init__.py +37 -0
- python_gitmojis-1.1.0/src/gitmojis/cli/commands.py +24 -0
- python_gitmojis-1.1.0/src/gitmojis/core.py +47 -0
- python_gitmojis-1.1.0/src/gitmojis/defaults.py +10 -0
- python_gitmojis-1.1.0/src/gitmojis/exceptions.py +13 -0
- python_gitmojis-1.1.0/src/gitmojis/model.py +53 -0
- python_gitmojis-1.1.0/src/python_gitmojis.egg-info/PKG-INFO +257 -0
- {python-gitmojis-0.1.5 → python_gitmojis-1.1.0}/src/python_gitmojis.egg-info/SOURCES.txt +10 -10
- python_gitmojis-1.1.0/src/python_gitmojis.egg-info/entry_points.txt +2 -0
- python_gitmojis-1.1.0/src/python_gitmojis.egg-info/requires.txt +2 -0
- python_gitmojis-1.1.0/tests/test_cli.py +79 -0
- python_gitmojis-1.1.0/tests/test_core.py +51 -0
- python_gitmojis-1.1.0/tests/test_defaults.py +32 -0
- python_gitmojis-1.1.0/tests/test_gitmoji.py +36 -0
- python_gitmojis-1.1.0/tests/test_guide.py +62 -0
- python-gitmojis-0.1.5/PKG-INFO +0 -384
- python-gitmojis-0.1.5/README.md +0 -323
- python-gitmojis-0.1.5/pyproject.toml +0 -83
- python-gitmojis-0.1.5/requirements.txt +0 -3
- python-gitmojis-0.1.5/src/gitmojis/__init__.py +0 -3
- python-gitmojis-0.1.5/src/gitmojis/assets/gitmojis.json +0 -586
- python-gitmojis-0.1.5/src/gitmojis/constants.py +0 -19
- python-gitmojis-0.1.5/src/gitmojis/core.py +0 -17
- python-gitmojis-0.1.5/src/gitmojis/dumps.py +0 -66
- python-gitmojis-0.1.5/src/gitmojis/loaders.py +0 -85
- python-gitmojis-0.1.5/src/gitmojis/models.py +0 -146
- python-gitmojis-0.1.5/src/python_gitmojis.egg-info/PKG-INFO +0 -384
- python-gitmojis-0.1.5/src/python_gitmojis.egg-info/entry_points.txt +0 -2
- python-gitmojis-0.1.5/src/python_gitmojis.egg-info/requires.txt +0 -17
- python-gitmojis-0.1.5/tests/test_core.py +0 -27
- python-gitmojis-0.1.5/tests/test_dumps.py +0 -85
- python-gitmojis-0.1.5/tests/test_loaders.py +0 -137
- python-gitmojis-0.1.5/tests/test_models.py +0 -226
- python-gitmojis-0.1.5/tests/test_package.py +0 -6
- {python-gitmojis-0.1.5 → python_gitmojis-1.1.0}/setup.cfg +0 -0
- {python-gitmojis-0.1.5 → python_gitmojis-1.1.0}/src/gitmojis/py.typed +0 -0
- {python-gitmojis-0.1.5 → python_gitmojis-1.1.0}/src/python_gitmojis.egg-info/dependency_links.txt +0 -0
- {python-gitmojis-0.1.5 → python_gitmojis-1.1.0}/src/python_gitmojis.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-gitmojis
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: 😜 The official Gitmoji Guide in Python projects 🐍
|
|
5
|
+
Author-email: Kamil Paduszyński <paduszyk@gmail.com>
|
|
6
|
+
Keywords: emoji,git,gitmoji
|
|
7
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: click<9.0.0,>=8.4.2
|
|
22
|
+
Requires-Dist: requests<3.0.0,>=2.34.2
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# python-gitmojis
|
|
26
|
+
|
|
27
|
+
[][pre-commit.ci]
|
|
28
|
+
[][github-build-workflow]
|
|
29
|
+
[][codecov]
|
|
30
|
+
|
|
31
|
+
[][nox]
|
|
32
|
+
[][ruff]
|
|
33
|
+
[][mypy]
|
|
34
|
+
[][black]
|
|
35
|
+
|
|
36
|
+
[][pypi]
|
|
37
|
+
[][pypi]
|
|
38
|
+
[][pypi]
|
|
39
|
+
[][pypi]
|
|
40
|
+
|
|
41
|
+
## Summary
|
|
42
|
+
|
|
43
|
+
This package provides a few simple utilities to apply the official
|
|
44
|
+
[Gitmoji Guide][gitmoji-website] in Python libraries. It may potentially serve
|
|
45
|
+
as a helper in projects related to version control systems, versioning, and
|
|
46
|
+
automatic changelog generation. Applications in automation tools for validating
|
|
47
|
+
commit and pull request messages seem feasible as well.
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
- Handle individual Gitmojis and their lists using Python classes. 👔
|
|
52
|
+
- Fetch Gitmoji data directly from the official [Gitmoji API][gitmoji-api]. 😜
|
|
53
|
+
- Graceful degradation: If the API is unavailable, fall back to backup data. 🦺
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
It is recommended to install the package directly from PyPI using `pip`:
|
|
58
|
+
|
|
59
|
+
```console
|
|
60
|
+
$ pip install python-gitmojis
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
or any other dependency manager of your preference. After installation, the
|
|
64
|
+
package functionalities can be accessed by importing them from the `gitmojis`
|
|
65
|
+
module:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
import gitmojis
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
### Data model
|
|
74
|
+
|
|
75
|
+
The data model incorporates two classes representing individual Gitmojis and
|
|
76
|
+
their collections ("guides"), namely, `Gitmoji` and `Guide`, respectively.
|
|
77
|
+
|
|
78
|
+
The classes are defined in `gitmojis.model`, but can also be accessed directly
|
|
79
|
+
from `gitmojis` as well:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from gitmojis import Gitmoji, Guide
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### `gitmojis.model.Gitmoji`
|
|
86
|
+
|
|
87
|
+
The `Gitmoji` class is a Python `@dataclass` ([PEP 557][PEP-557]) that uses a
|
|
88
|
+
set of fields consistent with the [JSON schema][gitmoji-schema] proposed in the
|
|
89
|
+
original Gitmoji project, namely:
|
|
90
|
+
|
|
91
|
+
- `emoji: str` – the emoji character representing the Gitmoji;
|
|
92
|
+
- `entity: str` – the HTML entity of the Gitmoji;
|
|
93
|
+
- `code: str` – the emoji's code to be used in rendering Gitmojis in the
|
|
94
|
+
Markdown documents;
|
|
95
|
+
- `description: str` – a short note on the type of changes represented by
|
|
96
|
+
the commits or pull requests marked by the Gitmoji;
|
|
97
|
+
- `name: str` – a text identifier of the Gitmoji;
|
|
98
|
+
- `semver: str | None` – the [Semantic Versioning](https://semver.org)
|
|
99
|
+
level affected by the changes marked with the Gitmoji; the allowed string
|
|
100
|
+
values are `"major"`, `"minor"`, and `"patch"`.
|
|
101
|
+
|
|
102
|
+
The class can be used to create immutable objects representing individual
|
|
103
|
+
Gitmojis, for example:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from gitmojis import Gitmoji
|
|
107
|
+
|
|
108
|
+
gitmoji = Gitmoji(
|
|
109
|
+
emoji="🤖",
|
|
110
|
+
entity="🤖",
|
|
111
|
+
code=":robot:",
|
|
112
|
+
description="Add or update Dependabot configuration.",
|
|
113
|
+
name="robot",
|
|
114
|
+
semver=None,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
assert gitmoji.emoji == "🤖"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
> Note that when creating a new `Gitmoji` instance, all the `@dataclass` fields
|
|
121
|
+
> are required. Furthermore, they all must be passed as keyword arguments.
|
|
122
|
+
|
|
123
|
+
#### `gitmojis.model.Guide`
|
|
124
|
+
|
|
125
|
+
The `Guide` class aims to provide a custom list-like structure to manage a
|
|
126
|
+
collection of Gitmojis. Its instances are created simply by passing an iterable
|
|
127
|
+
of `Gitmoji` objects (as the `gitmojis` keyword argument) to the class
|
|
128
|
+
constructor:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from gitmojis import Gitmoji, Guide
|
|
132
|
+
|
|
133
|
+
gitmojis_json = [
|
|
134
|
+
{
|
|
135
|
+
"emoji" : "🤖",
|
|
136
|
+
"entity" : "🤖",
|
|
137
|
+
"code" : ":robot:",
|
|
138
|
+
"description" : "Add or update Dependabot configuration.",
|
|
139
|
+
"name" : "robot",
|
|
140
|
+
"semver" : None,
|
|
141
|
+
},
|
|
142
|
+
# ...
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
guide = Guide(
|
|
146
|
+
gitmojis=[Gitmoji(**gitmoji_json) for gitmoji_json in gitmojis_json]
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
assert guide[0].emoji == "🤖"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The class is based on `collections.UserList`. Currently, it doesn't override
|
|
153
|
+
any base class methods nor does it implement any custom functionality.
|
|
154
|
+
|
|
155
|
+
### Fetching Gitmojis from the API
|
|
156
|
+
|
|
157
|
+
The main package functionality is implemented as a plain Python function, named
|
|
158
|
+
`fetch_guide`. It can be imported either from `gitmojis` or directly from its
|
|
159
|
+
source, i.e. the `gitmojis.core` module.
|
|
160
|
+
|
|
161
|
+
Usage of the function is extremely easy. In the simplest case, it can be called
|
|
162
|
+
without any arguments:
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from gitmojis import fetch_guide
|
|
166
|
+
|
|
167
|
+
guide = fetch_guide()
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The function uses the `requests` library to return a `Guide` instance containing
|
|
171
|
+
the current state of the official [Gitmoji API][gitmoji-api]. If the API is
|
|
172
|
+
inaccessible, the guide can be populated using the data retrieved from the local
|
|
173
|
+
backup file. Such behavior can be triggered by passing `True` as the value of
|
|
174
|
+
the `use_backup` keyword argument (it defaults to `False`):
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
from gitmojis import fetch_guide
|
|
178
|
+
|
|
179
|
+
guide = fetch_guide(use_backup=True) # will work even if you're offline
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Command-line interface (CLI)
|
|
183
|
+
|
|
184
|
+
The package comes with a simple CLI which can be run using the `gitmojis`
|
|
185
|
+
command:
|
|
186
|
+
|
|
187
|
+
```console
|
|
188
|
+
$ gitmojis
|
|
189
|
+
Usage: gitmojis [OPTIONS] COMMAND [ARGS]...
|
|
190
|
+
|
|
191
|
+
Command-line interface for managing the official Gitmoji guide.
|
|
192
|
+
|
|
193
|
+
Options:
|
|
194
|
+
--use-backup Use the backup to fetch data if the API request fails.
|
|
195
|
+
--version Show the version and exit.
|
|
196
|
+
--help Show this message and exit.
|
|
197
|
+
|
|
198
|
+
Commands:
|
|
199
|
+
sync Synchronize the backup file with the current state of the API.
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
As seen, currently the CLI provides only the `sync` command which can be used
|
|
203
|
+
to update the Gitmoji data backup file to the current state of the official API
|
|
204
|
+
endpoint.
|
|
205
|
+
|
|
206
|
+
> Checking for the updates of the API state is compared to the backup file by
|
|
207
|
+
> executing the `sync` command at GitHub Actions runner every week. The
|
|
208
|
+
> respective workflow automatically applies the updates and opens a pull
|
|
209
|
+
> request introducing them to the codebase. We plan to do the version bump (on
|
|
210
|
+
> a patch level) upon merging each of such pull requests. Therefore, to stay
|
|
211
|
+
> tuned with the Gitmoji API backed up by this library, you should update
|
|
212
|
+
> the package systematically. This particularly concerns the developers, who
|
|
213
|
+
> work with local repositories most of the time.
|
|
214
|
+
|
|
215
|
+
## Contributing
|
|
216
|
+
|
|
217
|
+
This project is open-source and embraces contributions of all types. For
|
|
218
|
+
comprehensive instructions on how to contribute to the project, please refer to
|
|
219
|
+
our [Contributing Guide][contributing-guide].
|
|
220
|
+
|
|
221
|
+
We require all contributors to adhere to our [Code of Conduct][code-of-conduct].
|
|
222
|
+
While it may seem intricate at first glance, the essence is simple: treat
|
|
223
|
+
everyone with kindness! 🙂
|
|
224
|
+
|
|
225
|
+
## Credits
|
|
226
|
+
|
|
227
|
+
The idea of Gitmoji was originally proposed, developed, and maintained by
|
|
228
|
+
Carlos Cuesta ([@carloscuesta][github-carlosquesta]). For more information, see
|
|
229
|
+
the official [repository][gitmoji-repository] and [website][gitmoji-website] of
|
|
230
|
+
the project.
|
|
231
|
+
|
|
232
|
+
## Authors
|
|
233
|
+
|
|
234
|
+
Created by Kamil Paduszyński ([@paduszyk][github-paduszyk]).
|
|
235
|
+
|
|
236
|
+
## License
|
|
237
|
+
|
|
238
|
+
Released under the [MIT License][license].
|
|
239
|
+
|
|
240
|
+
[black]: https://github.com/psf/black
|
|
241
|
+
[code-of-conduct]: https://github.com/paduszyk/python-gitmojis/blob/main/.github/CODE_OF_CONDUCT.md
|
|
242
|
+
[codecov]: https://app.codecov.io/gh/paduszyk/python-gitmojis
|
|
243
|
+
[contributing-guide]: https://github.com/paduszyk/python-gitmojis/blob/main/.github/CONTRIBUTING.md
|
|
244
|
+
[github-build-workflow]: https://github.com/paduszyk/python-gitmojis/actions/workflows/build-package.yml
|
|
245
|
+
[github-carlosquesta]: https://github.com/carloscuesta
|
|
246
|
+
[github-paduszyk]: https://github.com/paduszyk
|
|
247
|
+
[gitmoji-api]: https://github.com/carloscuesta/gitmoji/tree/master/packages/gitmojis#api
|
|
248
|
+
[gitmoji-repository]: https://github.com/carloscuesta/gitmoji
|
|
249
|
+
[gitmoji-schema]: https://github.com/carloscuesta/gitmoji/blob/master/packages/gitmojis/src/schema.json
|
|
250
|
+
[gitmoji-website]: https://gitmoji.dev
|
|
251
|
+
[license]: https://github.com/paduszyk/python-gitmojis/blob/main/LICENSE
|
|
252
|
+
[mypy]: https://github.com/python/mypy
|
|
253
|
+
[nox]: https://github.com/wntrblm/nox
|
|
254
|
+
[pep-557]: https://peps.python.org/pep-0557/
|
|
255
|
+
[pre-commit.ci]: https://results.pre-commit.ci/latest/github/paduszyk/python-gitmojis/main
|
|
256
|
+
[pypi]: https://pypi.org/project/python-gitmojis/
|
|
257
|
+
[ruff]: https://github.com/astral-sh/ruff
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# python-gitmojis
|
|
2
|
+
|
|
3
|
+
[][pre-commit.ci]
|
|
4
|
+
[][github-build-workflow]
|
|
5
|
+
[][codecov]
|
|
6
|
+
|
|
7
|
+
[][nox]
|
|
8
|
+
[][ruff]
|
|
9
|
+
[][mypy]
|
|
10
|
+
[][black]
|
|
11
|
+
|
|
12
|
+
[][pypi]
|
|
13
|
+
[][pypi]
|
|
14
|
+
[][pypi]
|
|
15
|
+
[][pypi]
|
|
16
|
+
|
|
17
|
+
## Summary
|
|
18
|
+
|
|
19
|
+
This package provides a few simple utilities to apply the official
|
|
20
|
+
[Gitmoji Guide][gitmoji-website] in Python libraries. It may potentially serve
|
|
21
|
+
as a helper in projects related to version control systems, versioning, and
|
|
22
|
+
automatic changelog generation. Applications in automation tools for validating
|
|
23
|
+
commit and pull request messages seem feasible as well.
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- Handle individual Gitmojis and their lists using Python classes. 👔
|
|
28
|
+
- Fetch Gitmoji data directly from the official [Gitmoji API][gitmoji-api]. 😜
|
|
29
|
+
- Graceful degradation: If the API is unavailable, fall back to backup data. 🦺
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
It is recommended to install the package directly from PyPI using `pip`:
|
|
34
|
+
|
|
35
|
+
```console
|
|
36
|
+
$ pip install python-gitmojis
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
or any other dependency manager of your preference. After installation, the
|
|
40
|
+
package functionalities can be accessed by importing them from the `gitmojis`
|
|
41
|
+
module:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import gitmojis
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Data model
|
|
50
|
+
|
|
51
|
+
The data model incorporates two classes representing individual Gitmojis and
|
|
52
|
+
their collections ("guides"), namely, `Gitmoji` and `Guide`, respectively.
|
|
53
|
+
|
|
54
|
+
The classes are defined in `gitmojis.model`, but can also be accessed directly
|
|
55
|
+
from `gitmojis` as well:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from gitmojis import Gitmoji, Guide
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### `gitmojis.model.Gitmoji`
|
|
62
|
+
|
|
63
|
+
The `Gitmoji` class is a Python `@dataclass` ([PEP 557][PEP-557]) that uses a
|
|
64
|
+
set of fields consistent with the [JSON schema][gitmoji-schema] proposed in the
|
|
65
|
+
original Gitmoji project, namely:
|
|
66
|
+
|
|
67
|
+
- `emoji: str` – the emoji character representing the Gitmoji;
|
|
68
|
+
- `entity: str` – the HTML entity of the Gitmoji;
|
|
69
|
+
- `code: str` – the emoji's code to be used in rendering Gitmojis in the
|
|
70
|
+
Markdown documents;
|
|
71
|
+
- `description: str` – a short note on the type of changes represented by
|
|
72
|
+
the commits or pull requests marked by the Gitmoji;
|
|
73
|
+
- `name: str` – a text identifier of the Gitmoji;
|
|
74
|
+
- `semver: str | None` – the [Semantic Versioning](https://semver.org)
|
|
75
|
+
level affected by the changes marked with the Gitmoji; the allowed string
|
|
76
|
+
values are `"major"`, `"minor"`, and `"patch"`.
|
|
77
|
+
|
|
78
|
+
The class can be used to create immutable objects representing individual
|
|
79
|
+
Gitmojis, for example:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from gitmojis import Gitmoji
|
|
83
|
+
|
|
84
|
+
gitmoji = Gitmoji(
|
|
85
|
+
emoji="🤖",
|
|
86
|
+
entity="🤖",
|
|
87
|
+
code=":robot:",
|
|
88
|
+
description="Add or update Dependabot configuration.",
|
|
89
|
+
name="robot",
|
|
90
|
+
semver=None,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
assert gitmoji.emoji == "🤖"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
> Note that when creating a new `Gitmoji` instance, all the `@dataclass` fields
|
|
97
|
+
> are required. Furthermore, they all must be passed as keyword arguments.
|
|
98
|
+
|
|
99
|
+
#### `gitmojis.model.Guide`
|
|
100
|
+
|
|
101
|
+
The `Guide` class aims to provide a custom list-like structure to manage a
|
|
102
|
+
collection of Gitmojis. Its instances are created simply by passing an iterable
|
|
103
|
+
of `Gitmoji` objects (as the `gitmojis` keyword argument) to the class
|
|
104
|
+
constructor:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from gitmojis import Gitmoji, Guide
|
|
108
|
+
|
|
109
|
+
gitmojis_json = [
|
|
110
|
+
{
|
|
111
|
+
"emoji" : "🤖",
|
|
112
|
+
"entity" : "🤖",
|
|
113
|
+
"code" : ":robot:",
|
|
114
|
+
"description" : "Add or update Dependabot configuration.",
|
|
115
|
+
"name" : "robot",
|
|
116
|
+
"semver" : None,
|
|
117
|
+
},
|
|
118
|
+
# ...
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
guide = Guide(
|
|
122
|
+
gitmojis=[Gitmoji(**gitmoji_json) for gitmoji_json in gitmojis_json]
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
assert guide[0].emoji == "🤖"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The class is based on `collections.UserList`. Currently, it doesn't override
|
|
129
|
+
any base class methods nor does it implement any custom functionality.
|
|
130
|
+
|
|
131
|
+
### Fetching Gitmojis from the API
|
|
132
|
+
|
|
133
|
+
The main package functionality is implemented as a plain Python function, named
|
|
134
|
+
`fetch_guide`. It can be imported either from `gitmojis` or directly from its
|
|
135
|
+
source, i.e. the `gitmojis.core` module.
|
|
136
|
+
|
|
137
|
+
Usage of the function is extremely easy. In the simplest case, it can be called
|
|
138
|
+
without any arguments:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
from gitmojis import fetch_guide
|
|
142
|
+
|
|
143
|
+
guide = fetch_guide()
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The function uses the `requests` library to return a `Guide` instance containing
|
|
147
|
+
the current state of the official [Gitmoji API][gitmoji-api]. If the API is
|
|
148
|
+
inaccessible, the guide can be populated using the data retrieved from the local
|
|
149
|
+
backup file. Such behavior can be triggered by passing `True` as the value of
|
|
150
|
+
the `use_backup` keyword argument (it defaults to `False`):
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from gitmojis import fetch_guide
|
|
154
|
+
|
|
155
|
+
guide = fetch_guide(use_backup=True) # will work even if you're offline
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Command-line interface (CLI)
|
|
159
|
+
|
|
160
|
+
The package comes with a simple CLI which can be run using the `gitmojis`
|
|
161
|
+
command:
|
|
162
|
+
|
|
163
|
+
```console
|
|
164
|
+
$ gitmojis
|
|
165
|
+
Usage: gitmojis [OPTIONS] COMMAND [ARGS]...
|
|
166
|
+
|
|
167
|
+
Command-line interface for managing the official Gitmoji guide.
|
|
168
|
+
|
|
169
|
+
Options:
|
|
170
|
+
--use-backup Use the backup to fetch data if the API request fails.
|
|
171
|
+
--version Show the version and exit.
|
|
172
|
+
--help Show this message and exit.
|
|
173
|
+
|
|
174
|
+
Commands:
|
|
175
|
+
sync Synchronize the backup file with the current state of the API.
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
As seen, currently the CLI provides only the `sync` command which can be used
|
|
179
|
+
to update the Gitmoji data backup file to the current state of the official API
|
|
180
|
+
endpoint.
|
|
181
|
+
|
|
182
|
+
> Checking for the updates of the API state is compared to the backup file by
|
|
183
|
+
> executing the `sync` command at GitHub Actions runner every week. The
|
|
184
|
+
> respective workflow automatically applies the updates and opens a pull
|
|
185
|
+
> request introducing them to the codebase. We plan to do the version bump (on
|
|
186
|
+
> a patch level) upon merging each of such pull requests. Therefore, to stay
|
|
187
|
+
> tuned with the Gitmoji API backed up by this library, you should update
|
|
188
|
+
> the package systematically. This particularly concerns the developers, who
|
|
189
|
+
> work with local repositories most of the time.
|
|
190
|
+
|
|
191
|
+
## Contributing
|
|
192
|
+
|
|
193
|
+
This project is open-source and embraces contributions of all types. For
|
|
194
|
+
comprehensive instructions on how to contribute to the project, please refer to
|
|
195
|
+
our [Contributing Guide][contributing-guide].
|
|
196
|
+
|
|
197
|
+
We require all contributors to adhere to our [Code of Conduct][code-of-conduct].
|
|
198
|
+
While it may seem intricate at first glance, the essence is simple: treat
|
|
199
|
+
everyone with kindness! 🙂
|
|
200
|
+
|
|
201
|
+
## Credits
|
|
202
|
+
|
|
203
|
+
The idea of Gitmoji was originally proposed, developed, and maintained by
|
|
204
|
+
Carlos Cuesta ([@carloscuesta][github-carlosquesta]). For more information, see
|
|
205
|
+
the official [repository][gitmoji-repository] and [website][gitmoji-website] of
|
|
206
|
+
the project.
|
|
207
|
+
|
|
208
|
+
## Authors
|
|
209
|
+
|
|
210
|
+
Created by Kamil Paduszyński ([@paduszyk][github-paduszyk]).
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
Released under the [MIT License][license].
|
|
215
|
+
|
|
216
|
+
[black]: https://github.com/psf/black
|
|
217
|
+
[code-of-conduct]: https://github.com/paduszyk/python-gitmojis/blob/main/.github/CODE_OF_CONDUCT.md
|
|
218
|
+
[codecov]: https://app.codecov.io/gh/paduszyk/python-gitmojis
|
|
219
|
+
[contributing-guide]: https://github.com/paduszyk/python-gitmojis/blob/main/.github/CONTRIBUTING.md
|
|
220
|
+
[github-build-workflow]: https://github.com/paduszyk/python-gitmojis/actions/workflows/build-package.yml
|
|
221
|
+
[github-carlosquesta]: https://github.com/carloscuesta
|
|
222
|
+
[github-paduszyk]: https://github.com/paduszyk
|
|
223
|
+
[gitmoji-api]: https://github.com/carloscuesta/gitmoji/tree/master/packages/gitmojis#api
|
|
224
|
+
[gitmoji-repository]: https://github.com/carloscuesta/gitmoji
|
|
225
|
+
[gitmoji-schema]: https://github.com/carloscuesta/gitmoji/blob/master/packages/gitmojis/src/schema.json
|
|
226
|
+
[gitmoji-website]: https://gitmoji.dev
|
|
227
|
+
[license]: https://github.com/paduszyk/python-gitmojis/blob/main/LICENSE
|
|
228
|
+
[mypy]: https://github.com/python/mypy
|
|
229
|
+
[nox]: https://github.com/wntrblm/nox
|
|
230
|
+
[pep-557]: https://peps.python.org/pep-0557/
|
|
231
|
+
[pre-commit.ci]: https://results.pre-commit.ci/latest/github/paduszyk/python-gitmojis/main
|
|
232
|
+
[pypi]: https://pypi.org/project/python-gitmojis/
|
|
233
|
+
[ruff]: https://github.com/astral-sh/ruff
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
# Project metadata (PEP 621)
|
|
6
|
+
# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "python-gitmojis"
|
|
10
|
+
version = "1.1.0"
|
|
11
|
+
description = "😜 The official Gitmoji Guide in Python projects 🐍"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Kamil Paduszyński", email = "paduszyk@gmail.com" },
|
|
15
|
+
]
|
|
16
|
+
keywords = ["emoji", "git", "gitmoji"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 5 - Production/Stable",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
29
|
+
]
|
|
30
|
+
requires-python = ">= 3.10"
|
|
31
|
+
dependencies = [
|
|
32
|
+
"click>=8.4.2,<9.0.0",
|
|
33
|
+
"requests>=2.34.2,<3.0.0",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
"gitmojis" = "gitmojis.__main__:main"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
black = [
|
|
41
|
+
"black>=26.5.1,<27.0.0",
|
|
42
|
+
]
|
|
43
|
+
dev = [
|
|
44
|
+
{ include-group = "black" },
|
|
45
|
+
{ include-group = "local" },
|
|
46
|
+
{ include-group = "nox" },
|
|
47
|
+
{ include-group = "mypy" },
|
|
48
|
+
{ include-group = "ruff" },
|
|
49
|
+
{ include-group = "test" },
|
|
50
|
+
]
|
|
51
|
+
local = [
|
|
52
|
+
"pre-commit>=4.6.1,<5.0.0",
|
|
53
|
+
]
|
|
54
|
+
nox = [
|
|
55
|
+
"nox>=2026.7.11,<2027.0.0",
|
|
56
|
+
"nox-uv>=0.8.0",
|
|
57
|
+
]
|
|
58
|
+
ruff = [
|
|
59
|
+
"ruff>=0.15.22,<0.16.0",
|
|
60
|
+
]
|
|
61
|
+
mypy = [
|
|
62
|
+
"mypy>=2.3.0,<3.0.0",
|
|
63
|
+
"types-requests>=2.33.0.20260712,<3.0.0.0",
|
|
64
|
+
]
|
|
65
|
+
test = [
|
|
66
|
+
"pytest>=9.1.1,<10.0.0",
|
|
67
|
+
"pytest-click>=1.1.0,<2.0.0",
|
|
68
|
+
"pytest-cov>=7.1.0,<8.0.0",
|
|
69
|
+
"pytest-custom-exit-code>=0.3.0,<0.4.0",
|
|
70
|
+
"pytest-mock>=3.15.1,<4.0.0",
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[tool.setuptools.packages.find]
|
|
74
|
+
include = ["gitmojis*"]
|
|
75
|
+
where = ["src"]
|
|
76
|
+
|
|
77
|
+
[tool.setuptools.package-data]
|
|
78
|
+
"gitmojis" = ["py.typed", "assets*"]
|
|
79
|
+
|
|
80
|
+
# Black
|
|
81
|
+
# https://black.readthedocs.io/en/stable/usage_and_configuration/
|
|
82
|
+
|
|
83
|
+
[tool.black]
|
|
84
|
+
line-length = 88
|
|
85
|
+
target-version = ["py312", "py311", "py310"]
|
|
86
|
+
|
|
87
|
+
# Mypy
|
|
88
|
+
# https://mypy.readthedocs.io/en/stable/config_file.html
|
|
89
|
+
|
|
90
|
+
[tool.mypy]
|
|
91
|
+
exclude = [
|
|
92
|
+
'^(?:(?!src).)*$',
|
|
93
|
+
]
|
|
94
|
+
show_error_codes = true
|
|
95
|
+
disallow_any_generics = true
|
|
96
|
+
disallow_subclassing_any = true
|
|
97
|
+
disallow_untyped_calls = true
|
|
98
|
+
disallow_untyped_defs = true
|
|
99
|
+
disallow_incomplete_defs = true
|
|
100
|
+
check_untyped_defs = true
|
|
101
|
+
no_implicit_optional = true
|
|
102
|
+
warn_redundant_casts = true
|
|
103
|
+
warn_unused_ignores = true
|
|
104
|
+
warn_no_return = true
|
|
105
|
+
warn_return_any = true
|
|
106
|
+
warn_unreachable = true
|
|
107
|
+
warn_unused_configs = true
|
|
108
|
+
|
|
109
|
+
# Ruff
|
|
110
|
+
# https://docs.astral.sh/ruff/configuration/
|
|
111
|
+
# https://docs.astral.sh/ruff/rules/
|
|
112
|
+
# https://docs.astral.sh/ruff/settings/
|
|
113
|
+
|
|
114
|
+
[tool.ruff]
|
|
115
|
+
select = [
|
|
116
|
+
"F", # pyflakes
|
|
117
|
+
"E", # pycodestyle (errors)
|
|
118
|
+
"W", # pycodestyle (warnings)
|
|
119
|
+
"I", # isort
|
|
120
|
+
"N", # pep8-naming
|
|
121
|
+
"D", # pydocstyle
|
|
122
|
+
"B", # flake8-bugbear
|
|
123
|
+
"A", # flake8-builtins
|
|
124
|
+
"C4", # flake8-comprehensions
|
|
125
|
+
"T20", # flake8-print
|
|
126
|
+
"PT", # flake8-pytest-style
|
|
127
|
+
"Q", # flake8-quotes
|
|
128
|
+
"PTH", # flake8-use-pathlib
|
|
129
|
+
]
|
|
130
|
+
ignore = ["E501", "N818", "D1", "D205", "PT004", "PT016"]
|
|
131
|
+
|
|
132
|
+
[tool.ruff.pydocstyle]
|
|
133
|
+
convention = "google"
|
|
134
|
+
|
|
135
|
+
[tool.ruff.isort]
|
|
136
|
+
known-first-party = ["gitmojis"]
|
|
137
|
+
|
|
138
|
+
# Pytest
|
|
139
|
+
# https://docs.pytest.org/en/latest/reference/reference.html#configuration-options
|
|
140
|
+
|
|
141
|
+
[tool.pytest.ini_options]
|
|
142
|
+
addopts = [
|
|
143
|
+
"-ra",
|
|
144
|
+
"-q",
|
|
145
|
+
"--strict-markers",
|
|
146
|
+
"--cov=src/",
|
|
147
|
+
"--cov-branch",
|
|
148
|
+
"--cov-append",
|
|
149
|
+
"--cov-report=term-missing:skip-covered",
|
|
150
|
+
"--cov-report=xml",
|
|
151
|
+
"--suppress-no-test-exit-code",
|
|
152
|
+
]
|
|
153
|
+
pythonpath = [".", "src"]
|
|
154
|
+
testpaths = ["tests/"]
|
|
155
|
+
|
|
156
|
+
# Coverage.py
|
|
157
|
+
# https://coverage.readthedocs.io/en/latest/config.html
|
|
158
|
+
|
|
159
|
+
[tool.coverage.report]
|
|
160
|
+
exclude_also = [
|
|
161
|
+
"@(abc\\.)?abstractmethod",
|
|
162
|
+
"@overload",
|
|
163
|
+
"class .*\\bProtocol\\):",
|
|
164
|
+
"def __repr__",
|
|
165
|
+
"if __name__ == .__main__.:",
|
|
166
|
+
"if 0:",
|
|
167
|
+
"if self.debug:",
|
|
168
|
+
"if settings.DEBUG",
|
|
169
|
+
"if TYPE_CHECKING:",
|
|
170
|
+
"raise AssertionError",
|
|
171
|
+
"raise NotImplementedError",
|
|
172
|
+
]
|