Skip to content

Commit 6213c76

Browse files
authored
Merge pull request #1 from bybatkhuu/dev
Added utilities and update documentation
2 parents 73f343f + f8524b9 commit 6213c76

57 files changed

Lines changed: 1573 additions & 628 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/1.bump-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Install dependencies
2626
run: |
2727
python -m pip install -U pip
28-
python -m pip install -r ./requirements/requirements.test.txt
28+
python -m pip install .[test]
2929
- name: Test with pytest
3030
run: ./scripts/test.sh -l
3131

.github/workflows/2.build-publish.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ jobs:
3131
python -m pip install -U pip
3232
python -m pip install -r ./requirements/requirements.build.txt
3333
- name: Build and publish package
34+
# run: |
35+
# echo -e "[testpypi]\nusername = __token__\npassword = ${{ secrets.TEST_PYPI_API_TOKEN }}" > ~/.pypirc
36+
# ./scripts/build.sh -c -u
37+
# rm -rfv ~/.pypirc
3438
run: |
35-
echo -e "[testpypi]\nusername = __token__\npassword = ${{ secrets.TEST_PYPI_API_TOKEN }}" > ~/.pypirc
36-
./scripts/build.sh -c -u
39+
echo -e "[pypi]\nusername = __token__\npassword = ${{ secrets.PYPI_API_TOKEN }}" > ~/.pypirc
40+
./scripts/build.sh -c -u -p
3741
rm -rfv ~/.pypirc
38-
# run: |
39-
# echo -e "[pypi]\nusername = __token__\npassword = ${{ secrets.PYPI_API_TOKEN }}" > ~/.pypirc
40-
# ./scripts/build.sh -c -u -p
41-
# rm -rfv ~/.pypirc
42-
# - name: Build the package
43-
# run: |
44-
# ./scripts/build.sh -c
42+
- name: Build the package
43+
run: |
44+
./scripts/build.sh -c
4545
- name: Create release
4646
env:
4747
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 11 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bybatkhuu/module.python-utils/2.build-publish.yml?logo=GitHub)](https://github.com/bybatkhuu/module.python-utils/actions/workflows/2.build-publish.yml)
55
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/bybatkhuu/module.python-utils?logo=GitHub&color=blue)](https://github.com/bybatkhuu/module.python-utils/releases)
66

7-
'potato_utils' is collection of useful utils package for python.
7+
'potato_utils' is collection of simple useful utils package for python.
88

99
## ✨ Features
1010

11-
- Python module/package
12-
- Configuration
13-
- Test
14-
- Build
15-
- Documentation
16-
- Scripts
17-
- Examples
18-
- CI/CD
11+
- Python utilities
12+
- Datetime utilities
13+
- File I/O utilities
14+
- HTTP utilities
15+
- Security utilities
16+
- Sanitation utilities
17+
- Validation utilities
1918

2019
---
2120

@@ -75,11 +74,7 @@ git clone git@github.com:bybatkhuu/module.python-utils.git && \
7574
**OPTION A.** [**RECOMMENDED**] Install from **PyPi**:
7675

7776
```sh
78-
# Install from staging TestPyPi:
79-
pip install -i https://test.pypi.org/simple -U potato_utils
80-
81-
# Or install from production PyPi:
82-
# pip install -U potato_utils
77+
pip install -U potato_utils
8378
```
8479

8580
**OPTION B.** Install latest version directly from **GitHub** repository:
@@ -101,7 +96,7 @@ pip install -e .
10196
**OPTION D.** Install for **DEVELOPMENT** environment:
10297

10398
```sh
104-
pip install -r ./requirements/requirements.dev.txt
99+
pip install -e .[dev]
105100
```
106101

107102
**OPTION E.** Install from **pre-built release** files:
@@ -136,66 +131,12 @@ cp -r ./src/potato_utils /some/path/project/
136131
[**`examples/simple/main.py`**](./examples/simple/main.py):
137132

138133
```python
139-
# Standard libraries
140-
import sys
141-
import logging
142-
143-
# Internal modules
144-
from potato_utils import MyClass
145-
146-
147-
logger = logging.getLogger(__name__)
148-
149-
150-
def main() -> None:
151-
logging.basicConfig(
152-
stream=sys.stdout,
153-
level=logging.INFO,
154-
datefmt="%Y-%m-%d %H:%M:%S %z",
155-
format="[%(asctime)s | %(levelname)s | %(filename)s:%(lineno)d]: %(message)s",
156-
)
157-
158-
# Pre-defined variables (for customizing and testing)
159-
_items = [0.1, 0.2, 0.3, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
160-
_config = {
161-
"min_length": 4,
162-
"max_length": 10,
163-
"min_value": 0.0,
164-
"max_value": 1.0,
165-
"threshold": 0.7,
166-
}
167-
168-
# Main example code
169-
logger.info(f"Items before cleaning: {_items}")
170-
_my_object = MyClass(items=_items, config=_config)
171-
_items = _my_object()
172-
logger.info(f"Items after cleaning: {_items}")
173-
174-
logger.info("Done!\n")
175-
return
176-
177-
178-
if __name__ == "__main__":
179-
main()
180134
```
181135

182136
👍
183137

184138
---
185139

186-
## ⚙️ Configuration
187-
188-
[**`templates/configs/config.yml`**](./templates/configs/config.yml):
189-
190-
```yaml
191-
potato_utils:
192-
min_length: 2
193-
max_length: 100
194-
min_value: 0.0
195-
max_value: 1.0
196-
threshold: 0.5
197-
```
198-
199140
### 🌎 Environment Variables
200141

201142
[**`.env.example`**](./.env.example):
@@ -214,7 +155,7 @@ To run tests, run the following command:
214155

215156
```sh
216157
# Install python test dependencies:
217-
pip install -r ./requirements/requirements.test.txt
158+
pip install .[test]
218159

219160
# Run tests:
220161
python -m pytest -sv -o log_cli=true

docs/.nav.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ nav:
55
- Development: dev/
66
- Research: research/
77
# - "*"
8-
- Blog: blog/
98
- Release Notes: release-notes.md
109
- About: about/

docs/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ hide:
77

88
# Introduction
99

10-
'potato_utils' is collection of useful utils package for python.
10+
'potato_utils' is collection of simple useful utils package for python.
1111

1212
## ✨ Features
1313

14-
- Python module/package
15-
- Configuration
16-
- Test
17-
- Build
18-
- Documentation
19-
- Scripts
20-
- Examples
21-
- CI/CD
14+
- Python utilities
15+
- Datetime utilities
16+
- File I/O utilities
17+
- HTTP utilities
18+
- Security utilities
19+
- Sanitation utilities
20+
- Validation utilities

docs/api-docs/.nav.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
nav:
2-
- MyClass: MyClass.md
3-
# - "*"
2+
- "*"

docs/api-docs/MyClass.md

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

docs/api-docs/dt.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Datetime Utilities
3+
---
4+
5+
# Datetime Utilities
6+
7+
::: src.potato_utils.dt

docs/api-docs/http.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: HTTP Utilities
3+
---
4+
5+
# HTTP Utilities
6+
7+
::: src.potato_utils.http

docs/api-docs/io.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: IO Utilities
3+
---
4+
5+
# IO Utilities
6+
7+
::: src.potato_utils.io

0 commit comments

Comments
 (0)