Skip to content

Commit 1fde73a

Browse files
author
obervinov
authored
Merge pull request #17 from obervinov/release/v1.0.1
## v1.0.1 - 2024-01-20 ### What's Changed **full changelog**: v1.0.0...v1.0.1 by @ obervinov #17 #### 🐛 Bug Fixes * [Update Test](#6) * [Update GitHub Actions workflow](#7) #### 📚 Documentation * [Update PR template](#10) * [Update README.md](#4) #### 💥 Breaking Changes * [Migration from pip to poetry](#3) #### 🚀 Features * [Update GitHub Actions workflow](#7) * [Add support for the environment variable `MESSAGES_CONFIG`](#15)
2 parents 483d5f1 + 687f099 commit 1fde73a

17 files changed

+217
-154
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
2-
max-line-length=100
2+
max-line-length=125
33
exclude = .git,__pycache__
44
extend-ignore =

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# PR-1: NAME
2+
**full changelog**: https://github.com/obervinov/messages-package/compare/v1.0.0...v1.0.1 by @ obervinov https://github.com/obervinov/messages-package/pull/1
23
## VERSION - YYYY-MM-DD
34
### What's Changed
45
#### 🐛 Bug Fixes

.github/workflows/pr.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Tests and checks
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
- '*/*'
8+
- '**'
9+
- '!main'
10+
11+
jobs:
12+
changelog:
13+
uses: obervinov/_templates/.github/workflows/[email protected]
14+
15+
pylint:
16+
uses: obervinov/_templates/.github/workflows/[email protected]
17+
18+
pytest:
19+
uses: obervinov/_templates/.github/workflows/[email protected]
20+
21+
pyproject:
22+
uses: obervinov/_templates/.github/workflows/[email protected]

.github/workflows/release.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- closed
9+
10+
jobs:
11+
changelog:
12+
uses: obervinov/_templates/.github/workflows/[email protected]
13+
14+
pylint:
15+
uses: obervinov/_templates/.github/workflows/[email protected]
16+
17+
pytest:
18+
uses: obervinov/_templates/.github/workflows/[email protected]
19+
20+
pyproject:
21+
uses: obervinov/_templates/.github/workflows/[email protected]
22+
23+
create-release:
24+
uses: obervinov/_templates/.github/workflows/[email protected]
25+
needs: [changelog, pylint, pytest, pyproject]

.github/workflows/release.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.vscode/
2+
13
# Byte-compiled / optimized / DLL files
24
__pycache__/
35
*.py[cod]

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ indent-after-paren=4
330330
indent-string=' '
331331

332332
# Maximum number of characters on a single line.
333-
max-line-length=100
333+
max-line-length=125
334334

335335
# Maximum number of lines in a module.
336336
max-module-lines=1000

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,23 @@ All notable changes to this project will be documented in this file.
33
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
44

55

6-
## v1.0.0 - 2023-13-15
6+
## v1.0.1 - 2024-01-20
7+
### What's Changed
8+
**full changelog**: https://github.com/obervinov/messages-package/compare/v1.0.0...v1.0.1 by @ obervinov https://github.com/obervinov/messages-package/pull/17
9+
#### 🐛 Bug Fixes
10+
* [Update Test](https://github.com/obervinov/messages-package/issues/6)
11+
* [Update GitHub Actions workflow](https://github.com/obervinov/messages-package/issues/7)
12+
#### 📚 Documentation
13+
* [Update PR template](https://github.com/obervinov/messages-package/issues/10)
14+
* [Update README.md](https://github.com/obervinov/messages-package/issues/4)
15+
#### 💥 Breaking Changes
16+
* [Migration from pip to poetry](https://github.com/obervinov/messages-package/issues/3)
17+
#### 🚀 Features
18+
* [Update GitHub Actions workflow](https://github.com/obervinov/messages-package/issues/7)
19+
* [Add support for the environment variable `MESSAGES_CONFIG`](https://github.com/obervinov/messages-package/issues/15)
20+
21+
22+
## v1.0.0 - 2023-03-15
723
### What's Changed
824
**Full Changelog**: https://github.com/obervinov/messages-package/commits/v1.0.0
925
#### 💥 Breaking Changes

README.md

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Messages Package
2-
[![Release](https://github.com/obervinov/messages-package/actions/workflows/release.yml/badge.svg)](https://github.com/obervinov/messages-package/actions/workflows/release.yml)
2+
[![Release](https://github.com/obervinov/messages-package/actions/workflows/release.yaml/badge.svg)](https://github.com/obervinov/messages-package/actions/workflows/release.yaml)
33
[![CodeQL](https://github.com/obervinov/messages-package/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/obervinov/messages-package/actions/workflows/github-code-scanning/codeql)
4-
[![Tests and checks](https://github.com/obervinov/messages-package/actions/workflows/tests.yml/badge.svg?branch=main&event=pull_request)](https://github.com/obervinov/messages-package/actions/workflows/tests.yml)
4+
[![PR](https://github.com/obervinov/messages-package/actions/workflows/pr.yaml/badge.svg?branch=main&event=pull_request)](https://github.com/obervinov/messages-package/actions/workflows/pr.yaml)
55

66
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/obervinov/messages-package?style=for-the-badge)
77
![GitHub last commit](https://img.shields.io/github/last-commit/obervinov/messages-package?style=for-the-badge)
@@ -15,43 +15,59 @@ This package helps to easily and quickly generate beautiful messages for telegra
1515
## <img src="https://github.com/obervinov/_templates/blob/main/icons/github-actions.png" width="25" title="github-actions"> GitHub Actions
1616
| Name | Version |
1717
| ------------------------ | ----------- |
18-
| GitHub Actions Templates | [v1.0.2](https://github.com/obervinov/_templates/tree/v1.0.2) |
18+
| GitHub Actions Templates | [v1.0.12](https://github.com/obervinov/_templates/tree/v1.0.12) |
1919

2020

2121
## <img src="https://github.com/obervinov/_templates/blob/main/icons/requirements.png" width="25" title="functions"> Supported functions
2222
- Rendering a line with progress bar
2323
- Rendering a line with emoji
2424
- Rendering a simple string
2525

26-
## <img src="https://github.com/obervinov/_templates/blob/main/icons/stack2.png" width="20" title="install"> Installing
26+
## <img src="https://github.com/obervinov/_templates/blob/v1.0.5/icons/build.png" width="25" title="build"> Environment variables
27+
| Variable | Description | Default value |
28+
| ------------- | ------------- | ------------- |
29+
| `MESSAGES_CONFIG` | Json file with templates for rendering messages. (Example)[tests/configs/messages.json] | `configs/messages.json` |
30+
31+
32+
## <img src="https://github.com/obervinov/_templates/blob/main/icons/stack2.png" width="20" title="install"> Installing with Poetry
2733
```bash
28-
# Install current version
29-
pip3 install git+https://github.com/obervinov/messages-package.git#egg=vault
30-
# Install version by branch
31-
pip3 install git+https://github.com/obervinov/messages-package.git@main#egg=vault
32-
# Install version by tag
33-
pip3 install git+https://github.com/obervinov/[email protected]#egg=vault
34+
tee -a pyproject.toml <<EOF
35+
[tool.poetry]
36+
name = myproject"
37+
version = "1.0.0"
38+
39+
[tool.poetry.dependencies]
40+
python = "^3.10"
41+
messages = { git = "https://github.com/obervinov/messages-package.git", tag = "v1.0.1" }
42+
43+
[build-system]
44+
requires = ["poetry-core"]
45+
build-backend = "poetry.core.masonry.api"
46+
EOF
47+
48+
poetry install
3449
```
3550

36-
## <img src="https://github.com/obervinov/_templates/blob/main/icons/config.png" width="25" title="usage"> Usage example
51+
## <img src="https://github.com/obervinov/_templates/blob/main/icons/config.png" width="25" title="usage"> Usage examples
52+
### Simple message with emoji
3753
1. Creating _configs/messages.json_ and adding an example template
3854
- all emojis should be wrapped in `:`
3955
- all variables must be specified in the same form as in your code
4056
```json
41-
{ "templates":{"hello_message": {"text": "Hi, <b>{0}</b>! {1}\nAccess for your account - allowed {2}", "args": ["username", ":raised_hand:", ":unlocked:"]}}}
57+
{ "templates": {"hello_message": {"text": "Hi, <b>{0}</b>! {1}\nAccess for your account - allowed {2}", "args": ["username", ":raised_hand:", ":unlocked:"]}}}
4258
```
4359

4460
```python
4561
# Import module
46-
import messages
62+
from messages import Messages
4763

4864
# Create instance
4965
messages = Messages()
5066

5167
# Rendering and getting messages
5268
print(
5369
messages.render_template(
54-
'hello_message',
70+
template_alias='hello_message',
5571
username="obervinov"
5672
)
5773
)
@@ -63,3 +79,31 @@ Hi, <b>obervinov</b>! ✋
6379
Access for your account - allowed 🔓
6480
```
6581

82+
### Simple message with progress bar
83+
1. Creating _configs/messages.json_ and adding an example template
84+
- all emojis should be wrapped in `:`
85+
- all variables must be specified in the same form as in your code
86+
```json
87+
{"templates": {"progressbar_message": {"text": "{0} Messages from the queue have already been processed", "args": [":framed_picture:", "progressbar"]}}
88+
```
89+
90+
```python
91+
# Import module
92+
from messages import Messages
93+
94+
# Create instance
95+
messages = Messages()
96+
97+
# Rendering and getting messages
98+
print(
99+
messages.render_progressbar(
100+
total_count=100,
101+
current_count=19
102+
)
103+
)
104+
```
105+
106+
_output result_
107+
```python
108+
[◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️◻️]19%🔓
109+
```

0 commit comments

Comments
 (0)