potato-util 0.0.1__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.
- potato_util-0.0.1/.python-version +1 -0
- potato_util-0.0.1/LICENSE.txt +21 -0
- potato_util-0.0.1/PKG-INFO +287 -0
- potato_util-0.0.1/README.md +208 -0
- potato_util-0.0.1/pyproject.toml +71 -0
- potato_util-0.0.1/requirements/requirements.async.txt +3 -0
- potato_util-0.0.1/requirements/requirements.build.txt +4 -0
- potato_util-0.0.1/requirements/requirements.dev.txt +6 -0
- potato_util-0.0.1/requirements/requirements.docs.txt +5 -0
- potato_util-0.0.1/requirements/requirements.fastapi.txt +1 -0
- potato_util-0.0.1/requirements/requirements.test.txt +5 -0
- potato_util-0.0.1/requirements.txt +3 -0
- potato_util-0.0.1/setup.cfg +7 -0
- potato_util-0.0.1/setup.py +3 -0
- potato_util-0.0.1/src/potato_util/__init__.py +6 -0
- potato_util-0.0.1/src/potato_util/__version__.py +1 -0
- potato_util-0.0.1/src/potato_util/_base.py +117 -0
- potato_util-0.0.1/src/potato_util/constants/__init__.py +5 -0
- potato_util-0.0.1/src/potato_util/constants/_base.py +5 -0
- potato_util-0.0.1/src/potato_util/constants/_enum.py +31 -0
- potato_util-0.0.1/src/potato_util/constants/_regex.py +23 -0
- potato_util-0.0.1/src/potato_util/dt.py +240 -0
- potato_util-0.0.1/src/potato_util/http/__init__.py +12 -0
- potato_util-0.0.1/src/potato_util/http/_async.py +42 -0
- potato_util-0.0.1/src/potato_util/http/_base.py +46 -0
- potato_util-0.0.1/src/potato_util/http/_sync.py +45 -0
- potato_util-0.0.1/src/potato_util/http/fastapi.py +26 -0
- potato_util-0.0.1/src/potato_util/io/__init__.py +11 -0
- potato_util-0.0.1/src/potato_util/io/_async.py +274 -0
- potato_util-0.0.1/src/potato_util/io/_sync.py +264 -0
- potato_util-0.0.1/src/potato_util/sanitizer.py +85 -0
- potato_util-0.0.1/src/potato_util/secure.py +90 -0
- potato_util-0.0.1/src/potato_util/validator.py +150 -0
- potato_util-0.0.1/src/potato_util.egg-info/PKG-INFO +287 -0
- potato_util-0.0.1/src/potato_util.egg-info/SOURCES.txt +44 -0
- potato_util-0.0.1/src/potato_util.egg-info/dependency_links.txt +1 -0
- potato_util-0.0.1/src/potato_util.egg-info/requires.txt +61 -0
- potato_util-0.0.1/src/potato_util.egg-info/top_level.txt +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Batkhuu Byambajav
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: potato_util
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: 'potato_util' is collection of simple useful utils package for python.
|
|
5
|
+
Author-email: Batkhuu Byambajav <batkhuu10@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/bybatkhuu/module.python-utils
|
|
7
|
+
Project-URL: Documentation, https://pyutils-docs.bybatkhuu.dev
|
|
8
|
+
Project-URL: Repository, https://github.com/bybatkhuu/module.python-utils.git
|
|
9
|
+
Project-URL: Issues, https://github.com/bybatkhuu/module.python-utils/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/bybatkhuu/module.python-utils/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: potato_util,utils,utilities,tools,helpers
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Requires-Python: <4.0,>=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE.txt
|
|
24
|
+
Requires-Dist: python-dotenv<2.0.0,>=1.0.1
|
|
25
|
+
Requires-Dist: pydantic[email,timezone]<3.0.0,>=2.0.3
|
|
26
|
+
Requires-Dist: pydantic-settings<3.0.0,>=2.2.1
|
|
27
|
+
Provides-Extra: async
|
|
28
|
+
Requires-Dist: aiofiles<25.0.0,>=24.1.0; extra == "async"
|
|
29
|
+
Requires-Dist: aioshutil<2.0.0,>=1.5; extra == "async"
|
|
30
|
+
Requires-Dist: aiohttp<4.0.0,>=3.11.18; extra == "async"
|
|
31
|
+
Provides-Extra: fastapi
|
|
32
|
+
Requires-Dist: fastapi<1.0.0,>=0.109.2; extra == "fastapi"
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: aiofiles<25.0.0,>=24.1.0; extra == "all"
|
|
35
|
+
Requires-Dist: aioshutil<2.0.0,>=1.5; extra == "all"
|
|
36
|
+
Requires-Dist: aiohttp<4.0.0,>=3.11.18; extra == "all"
|
|
37
|
+
Requires-Dist: fastapi<1.0.0,>=0.109.2; extra == "all"
|
|
38
|
+
Provides-Extra: test
|
|
39
|
+
Requires-Dist: aiofiles<25.0.0,>=24.1.0; extra == "test"
|
|
40
|
+
Requires-Dist: aioshutil<2.0.0,>=1.5; extra == "test"
|
|
41
|
+
Requires-Dist: aiohttp<4.0.0,>=3.11.18; extra == "test"
|
|
42
|
+
Requires-Dist: fastapi<1.0.0,>=0.109.2; extra == "test"
|
|
43
|
+
Requires-Dist: pytest<9.0.0,>=8.0.2; extra == "test"
|
|
44
|
+
Requires-Dist: pytest-cov<8.0.0,>=5.0.0; extra == "test"
|
|
45
|
+
Requires-Dist: pytest-xdist<4.0.0,>=3.6.1; extra == "test"
|
|
46
|
+
Requires-Dist: pytest-benchmark<6.0.0,>=5.0.1; extra == "test"
|
|
47
|
+
Provides-Extra: build
|
|
48
|
+
Requires-Dist: setuptools<81.0.0,>=70.3.0; extra == "build"
|
|
49
|
+
Requires-Dist: wheel<1.0.0,>=0.43.0; extra == "build"
|
|
50
|
+
Requires-Dist: build<2.0.0,>=1.1.1; extra == "build"
|
|
51
|
+
Requires-Dist: twine<7.0.0,>=6.0.1; extra == "build"
|
|
52
|
+
Provides-Extra: docs
|
|
53
|
+
Requires-Dist: pylint<4.0.0,>=3.0.4; extra == "docs"
|
|
54
|
+
Requires-Dist: mkdocs-material<10.0.0,>=9.5.50; extra == "docs"
|
|
55
|
+
Requires-Dist: mkdocs-awesome-nav<4.0.0,>=3.0.0; extra == "docs"
|
|
56
|
+
Requires-Dist: mkdocstrings[python]<1.0.0,>=0.24.3; extra == "docs"
|
|
57
|
+
Requires-Dist: mike<3.0.0,>=2.1.3; extra == "docs"
|
|
58
|
+
Provides-Extra: dev
|
|
59
|
+
Requires-Dist: aiofiles<25.0.0,>=24.1.0; extra == "dev"
|
|
60
|
+
Requires-Dist: aioshutil<2.0.0,>=1.5; extra == "dev"
|
|
61
|
+
Requires-Dist: aiohttp<4.0.0,>=3.11.18; extra == "dev"
|
|
62
|
+
Requires-Dist: fastapi<1.0.0,>=0.109.2; extra == "dev"
|
|
63
|
+
Requires-Dist: pytest<9.0.0,>=8.0.2; extra == "dev"
|
|
64
|
+
Requires-Dist: pytest-cov<8.0.0,>=5.0.0; extra == "dev"
|
|
65
|
+
Requires-Dist: pytest-xdist<4.0.0,>=3.6.1; extra == "dev"
|
|
66
|
+
Requires-Dist: pytest-benchmark<6.0.0,>=5.0.1; extra == "dev"
|
|
67
|
+
Requires-Dist: setuptools<81.0.0,>=70.3.0; extra == "dev"
|
|
68
|
+
Requires-Dist: wheel<1.0.0,>=0.43.0; extra == "dev"
|
|
69
|
+
Requires-Dist: build<2.0.0,>=1.1.1; extra == "dev"
|
|
70
|
+
Requires-Dist: twine<7.0.0,>=6.0.1; extra == "dev"
|
|
71
|
+
Requires-Dist: pylint<4.0.0,>=3.0.4; extra == "dev"
|
|
72
|
+
Requires-Dist: mkdocs-material<10.0.0,>=9.5.50; extra == "dev"
|
|
73
|
+
Requires-Dist: mkdocs-awesome-nav<4.0.0,>=3.0.0; extra == "dev"
|
|
74
|
+
Requires-Dist: mkdocstrings[python]<1.0.0,>=0.24.3; extra == "dev"
|
|
75
|
+
Requires-Dist: mike<3.0.0,>=2.1.3; extra == "dev"
|
|
76
|
+
Requires-Dist: pyright<2.0.0,>=1.1.392; extra == "dev"
|
|
77
|
+
Requires-Dist: pre-commit<5.0.0,>=4.0.1; extra == "dev"
|
|
78
|
+
Dynamic: license-file
|
|
79
|
+
|
|
80
|
+
# Potato Utils (Python Utils)
|
|
81
|
+
|
|
82
|
+
[](https://choosealicense.com/licenses/mit)
|
|
83
|
+
[](https://github.com/bybatkhuu/module.python-utils/actions/workflows/2.build-publish.yml)
|
|
84
|
+
[](https://github.com/bybatkhuu/module.python-utils/releases)
|
|
85
|
+
|
|
86
|
+
'potato_util' is collection of simple useful utils package for python.
|
|
87
|
+
|
|
88
|
+
## ✨ Features
|
|
89
|
+
|
|
90
|
+
- Python utilities
|
|
91
|
+
- Datetime utilities
|
|
92
|
+
- File I/O utilities
|
|
93
|
+
- HTTP utilities
|
|
94
|
+
- Security utilities
|
|
95
|
+
- Sanitation utilities
|
|
96
|
+
- Validation utilities
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🛠 Installation
|
|
101
|
+
|
|
102
|
+
### 1. 🚧 Prerequisites
|
|
103
|
+
|
|
104
|
+
- Install **Python (>= v3.10)** and **pip (>= 23)**:
|
|
105
|
+
- **[RECOMMENDED] [Miniconda (v3)](https://www.anaconda.com/docs/getting-started/miniconda/install)**
|
|
106
|
+
- *[arm64/aarch64] [Miniforge (v3)](https://github.com/conda-forge/miniforge)*
|
|
107
|
+
- *[Python virutal environment] [venv](https://docs.python.org/3/library/venv.html)*
|
|
108
|
+
|
|
109
|
+
[OPTIONAL] For **DEVELOPMENT** environment:
|
|
110
|
+
|
|
111
|
+
- Install [**git**](https://git-scm.com/downloads)
|
|
112
|
+
- Setup an [**SSH key**](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh) ([video tutorial](https://www.youtube.com/watch?v=snCP3c7wXw0))
|
|
113
|
+
|
|
114
|
+
### 2. 📥 Download or clone the repository
|
|
115
|
+
|
|
116
|
+
[TIP] Skip this step, if you're going to install the package directly from **PyPi** or **GitHub** repository.
|
|
117
|
+
|
|
118
|
+
**2.1.** Prepare projects directory (if not exists):
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
# Create projects directory:
|
|
122
|
+
mkdir -pv ~/workspaces/projects
|
|
123
|
+
|
|
124
|
+
# Enter into projects directory:
|
|
125
|
+
cd ~/workspaces/projects
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**2.2.** Follow one of the below options **[A]**, **[B]** or **[C]**:
|
|
129
|
+
|
|
130
|
+
**OPTION A.** Clone the repository:
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
git clone https://github.com/bybatkhuu/module.python-utils.git && \
|
|
134
|
+
cd module.python-utils
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**OPTION B.** Clone the repository (for **DEVELOPMENT**: git + ssh key):
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
git clone git@github.com:bybatkhuu/module.python-utils.git && \
|
|
141
|
+
cd module.python-utils
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**OPTION C.** Download source code:
|
|
145
|
+
|
|
146
|
+
1. Download archived **zip** file from [**releases**](https://github.com/bybatkhuu/module.python-utils/releases).
|
|
147
|
+
2. Extract it into the projects directory.
|
|
148
|
+
|
|
149
|
+
### 3. 📦 Install the package
|
|
150
|
+
|
|
151
|
+
[NOTE] Choose one of the following methods to install the package **[A ~ F]**:
|
|
152
|
+
|
|
153
|
+
**OPTION A.** [**RECOMMENDED**] Install from **PyPi**:
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
pip install -U potato_util
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**OPTION B.** Install latest version directly from **GitHub** repository:
|
|
160
|
+
|
|
161
|
+
```sh
|
|
162
|
+
pip install git+https://github.com/bybatkhuu/module.python-utils.git
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**OPTION C.** Install from the downloaded **source code**:
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
# Install directly from the source code:
|
|
169
|
+
pip install .
|
|
170
|
+
|
|
171
|
+
# Or install with editable mode:
|
|
172
|
+
pip install -e .
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**OPTION D.** Install for **DEVELOPMENT** environment:
|
|
176
|
+
|
|
177
|
+
```sh
|
|
178
|
+
pip install -e .[dev]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**OPTION E.** Install from **pre-built release** files:
|
|
182
|
+
|
|
183
|
+
1. Download **`.whl`** or **`.tar.gz`** file from [**releases**](https://github.com/bybatkhuu/module.python-utils/releases)
|
|
184
|
+
2. Install with pip:
|
|
185
|
+
|
|
186
|
+
```sh
|
|
187
|
+
# Install from .whl file:
|
|
188
|
+
pip install ./potato_util-[VERSION]-py3-none-any.whl
|
|
189
|
+
|
|
190
|
+
# Or install from .tar.gz file:
|
|
191
|
+
pip install ./potato_util-[VERSION].tar.gz
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**OPTION F.** Copy the **module** into the project directory (for **testing**):
|
|
195
|
+
|
|
196
|
+
```sh
|
|
197
|
+
# Install python dependencies:
|
|
198
|
+
pip install -r ./requirements.txt
|
|
199
|
+
|
|
200
|
+
# Copy the module source code into the project:
|
|
201
|
+
cp -r ./src/potato_util [PROJECT_DIR]
|
|
202
|
+
# For example:
|
|
203
|
+
cp -r ./src/potato_util /some/path/project/
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## 🚸 Usage/Examples
|
|
207
|
+
|
|
208
|
+
### Simple
|
|
209
|
+
|
|
210
|
+
[**`examples/simple/main.py`**](./examples/simple/main.py):
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
👍
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
### 🌎 Environment Variables
|
|
220
|
+
|
|
221
|
+
[**`.env.example`**](./.env.example):
|
|
222
|
+
|
|
223
|
+
```sh
|
|
224
|
+
# ENV=LOCAL
|
|
225
|
+
# DEBUG=false
|
|
226
|
+
# TZ=UTC
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## 🧪 Running Tests
|
|
232
|
+
|
|
233
|
+
To run tests, run the following command:
|
|
234
|
+
|
|
235
|
+
```sh
|
|
236
|
+
# Install python test dependencies:
|
|
237
|
+
pip install .[test]
|
|
238
|
+
|
|
239
|
+
# Run tests:
|
|
240
|
+
python -m pytest -sv -o log_cli=true
|
|
241
|
+
# Or use the test script:
|
|
242
|
+
./scripts/test.sh -l -v -c
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## 🏗️ Build Package
|
|
246
|
+
|
|
247
|
+
To build the python package, run the following command:
|
|
248
|
+
|
|
249
|
+
```sh
|
|
250
|
+
# Install python build dependencies:
|
|
251
|
+
pip install -r ./requirements/requirements.build.txt
|
|
252
|
+
|
|
253
|
+
# Build python package:
|
|
254
|
+
python -m build
|
|
255
|
+
# Or use the build script:
|
|
256
|
+
./scripts/build.sh
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## 📝 Generate Docs
|
|
260
|
+
|
|
261
|
+
To build the documentation, run the following command:
|
|
262
|
+
|
|
263
|
+
```sh
|
|
264
|
+
# Install python documentation dependencies:
|
|
265
|
+
pip install -r ./requirements/requirements.docs.txt
|
|
266
|
+
|
|
267
|
+
# Serve documentation locally (for development):
|
|
268
|
+
mkdocs serve -a 0.0.0.0:8000
|
|
269
|
+
# Or use the docs script:
|
|
270
|
+
./scripts/docs.sh
|
|
271
|
+
|
|
272
|
+
# Or build documentation:
|
|
273
|
+
mkdocs build
|
|
274
|
+
# Or use the docs script:
|
|
275
|
+
./scripts/docs.sh -b
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## 📚 Documentation
|
|
279
|
+
|
|
280
|
+
- [Docs](./docs)
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## 📑 References
|
|
285
|
+
|
|
286
|
+
- <https://packaging.python.org/en/latest/tutorials/packaging-projects>
|
|
287
|
+
- <https://python-packaging.readthedocs.io/en/latest>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Potato Utils (Python Utils)
|
|
2
|
+
|
|
3
|
+
[](https://choosealicense.com/licenses/mit)
|
|
4
|
+
[](https://github.com/bybatkhuu/module.python-utils/actions/workflows/2.build-publish.yml)
|
|
5
|
+
[](https://github.com/bybatkhuu/module.python-utils/releases)
|
|
6
|
+
|
|
7
|
+
'potato_util' is collection of simple useful utils package for python.
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
- Python utilities
|
|
12
|
+
- Datetime utilities
|
|
13
|
+
- File I/O utilities
|
|
14
|
+
- HTTP utilities
|
|
15
|
+
- Security utilities
|
|
16
|
+
- Sanitation utilities
|
|
17
|
+
- Validation utilities
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🛠 Installation
|
|
22
|
+
|
|
23
|
+
### 1. 🚧 Prerequisites
|
|
24
|
+
|
|
25
|
+
- Install **Python (>= v3.10)** and **pip (>= 23)**:
|
|
26
|
+
- **[RECOMMENDED] [Miniconda (v3)](https://www.anaconda.com/docs/getting-started/miniconda/install)**
|
|
27
|
+
- *[arm64/aarch64] [Miniforge (v3)](https://github.com/conda-forge/miniforge)*
|
|
28
|
+
- *[Python virutal environment] [venv](https://docs.python.org/3/library/venv.html)*
|
|
29
|
+
|
|
30
|
+
[OPTIONAL] For **DEVELOPMENT** environment:
|
|
31
|
+
|
|
32
|
+
- Install [**git**](https://git-scm.com/downloads)
|
|
33
|
+
- Setup an [**SSH key**](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh) ([video tutorial](https://www.youtube.com/watch?v=snCP3c7wXw0))
|
|
34
|
+
|
|
35
|
+
### 2. 📥 Download or clone the repository
|
|
36
|
+
|
|
37
|
+
[TIP] Skip this step, if you're going to install the package directly from **PyPi** or **GitHub** repository.
|
|
38
|
+
|
|
39
|
+
**2.1.** Prepare projects directory (if not exists):
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
# Create projects directory:
|
|
43
|
+
mkdir -pv ~/workspaces/projects
|
|
44
|
+
|
|
45
|
+
# Enter into projects directory:
|
|
46
|
+
cd ~/workspaces/projects
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**2.2.** Follow one of the below options **[A]**, **[B]** or **[C]**:
|
|
50
|
+
|
|
51
|
+
**OPTION A.** Clone the repository:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
git clone https://github.com/bybatkhuu/module.python-utils.git && \
|
|
55
|
+
cd module.python-utils
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**OPTION B.** Clone the repository (for **DEVELOPMENT**: git + ssh key):
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
git clone git@github.com:bybatkhuu/module.python-utils.git && \
|
|
62
|
+
cd module.python-utils
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**OPTION C.** Download source code:
|
|
66
|
+
|
|
67
|
+
1. Download archived **zip** file from [**releases**](https://github.com/bybatkhuu/module.python-utils/releases).
|
|
68
|
+
2. Extract it into the projects directory.
|
|
69
|
+
|
|
70
|
+
### 3. 📦 Install the package
|
|
71
|
+
|
|
72
|
+
[NOTE] Choose one of the following methods to install the package **[A ~ F]**:
|
|
73
|
+
|
|
74
|
+
**OPTION A.** [**RECOMMENDED**] Install from **PyPi**:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
pip install -U potato_util
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**OPTION B.** Install latest version directly from **GitHub** repository:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
pip install git+https://github.com/bybatkhuu/module.python-utils.git
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**OPTION C.** Install from the downloaded **source code**:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
# Install directly from the source code:
|
|
90
|
+
pip install .
|
|
91
|
+
|
|
92
|
+
# Or install with editable mode:
|
|
93
|
+
pip install -e .
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**OPTION D.** Install for **DEVELOPMENT** environment:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
pip install -e .[dev]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**OPTION E.** Install from **pre-built release** files:
|
|
103
|
+
|
|
104
|
+
1. Download **`.whl`** or **`.tar.gz`** file from [**releases**](https://github.com/bybatkhuu/module.python-utils/releases)
|
|
105
|
+
2. Install with pip:
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
# Install from .whl file:
|
|
109
|
+
pip install ./potato_util-[VERSION]-py3-none-any.whl
|
|
110
|
+
|
|
111
|
+
# Or install from .tar.gz file:
|
|
112
|
+
pip install ./potato_util-[VERSION].tar.gz
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**OPTION F.** Copy the **module** into the project directory (for **testing**):
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
# Install python dependencies:
|
|
119
|
+
pip install -r ./requirements.txt
|
|
120
|
+
|
|
121
|
+
# Copy the module source code into the project:
|
|
122
|
+
cp -r ./src/potato_util [PROJECT_DIR]
|
|
123
|
+
# For example:
|
|
124
|
+
cp -r ./src/potato_util /some/path/project/
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 🚸 Usage/Examples
|
|
128
|
+
|
|
129
|
+
### Simple
|
|
130
|
+
|
|
131
|
+
[**`examples/simple/main.py`**](./examples/simple/main.py):
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
👍
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### 🌎 Environment Variables
|
|
141
|
+
|
|
142
|
+
[**`.env.example`**](./.env.example):
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
# ENV=LOCAL
|
|
146
|
+
# DEBUG=false
|
|
147
|
+
# TZ=UTC
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🧪 Running Tests
|
|
153
|
+
|
|
154
|
+
To run tests, run the following command:
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
# Install python test dependencies:
|
|
158
|
+
pip install .[test]
|
|
159
|
+
|
|
160
|
+
# Run tests:
|
|
161
|
+
python -m pytest -sv -o log_cli=true
|
|
162
|
+
# Or use the test script:
|
|
163
|
+
./scripts/test.sh -l -v -c
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 🏗️ Build Package
|
|
167
|
+
|
|
168
|
+
To build the python package, run the following command:
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
# Install python build dependencies:
|
|
172
|
+
pip install -r ./requirements/requirements.build.txt
|
|
173
|
+
|
|
174
|
+
# Build python package:
|
|
175
|
+
python -m build
|
|
176
|
+
# Or use the build script:
|
|
177
|
+
./scripts/build.sh
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## 📝 Generate Docs
|
|
181
|
+
|
|
182
|
+
To build the documentation, run the following command:
|
|
183
|
+
|
|
184
|
+
```sh
|
|
185
|
+
# Install python documentation dependencies:
|
|
186
|
+
pip install -r ./requirements/requirements.docs.txt
|
|
187
|
+
|
|
188
|
+
# Serve documentation locally (for development):
|
|
189
|
+
mkdocs serve -a 0.0.0.0:8000
|
|
190
|
+
# Or use the docs script:
|
|
191
|
+
./scripts/docs.sh
|
|
192
|
+
|
|
193
|
+
# Or build documentation:
|
|
194
|
+
mkdocs build
|
|
195
|
+
# Or use the docs script:
|
|
196
|
+
./scripts/docs.sh -b
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## 📚 Documentation
|
|
200
|
+
|
|
201
|
+
- [Docs](./docs)
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 📑 References
|
|
206
|
+
|
|
207
|
+
- <https://packaging.python.org/en/latest/tutorials/packaging-projects>
|
|
208
|
+
- <https://python-packaging.readthedocs.io/en/latest>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=70.3.0,<81.0.0", "setuptools-scm>=8.0.4,<10.0.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "potato_util"
|
|
7
|
+
authors = [{ name = "Batkhuu Byambajav", email = "batkhuu10@gmail.com" }]
|
|
8
|
+
description = "'potato_util' is collection of simple useful utils package for python."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10,<4.0"
|
|
11
|
+
keywords = ["potato_util", "utils", "utilities", "tools", "helpers"]
|
|
12
|
+
license-files = ["LICEN[CS]E*"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Topic :: Software Development :: Libraries",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
]
|
|
24
|
+
dynamic = ["version", "dependencies", "optional-dependencies"]
|
|
25
|
+
|
|
26
|
+
# [tool.setuptools.packages.find]
|
|
27
|
+
# where = ["src"]
|
|
28
|
+
# include = ["potato_util*"]
|
|
29
|
+
# namespaces = false
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.dynamic]
|
|
32
|
+
version = { attr = "potato_util.__version__.__version__" }
|
|
33
|
+
dependencies = { file = "./requirements.txt" }
|
|
34
|
+
optional-dependencies.async = { file = [
|
|
35
|
+
"./requirements/requirements.async.txt",
|
|
36
|
+
] }
|
|
37
|
+
optional-dependencies.fastapi = { file = [
|
|
38
|
+
"./requirements/requirements.fastapi.txt",
|
|
39
|
+
] }
|
|
40
|
+
optional-dependencies.all = { file = [
|
|
41
|
+
"./requirements/requirements.async.txt",
|
|
42
|
+
"./requirements/requirements.fastapi.txt",
|
|
43
|
+
] }
|
|
44
|
+
optional-dependencies.test = { file = [
|
|
45
|
+
"./requirements/requirements.async.txt",
|
|
46
|
+
"./requirements/requirements.fastapi.txt",
|
|
47
|
+
"./requirements/requirements.test.txt",
|
|
48
|
+
] }
|
|
49
|
+
optional-dependencies.build = { file = [
|
|
50
|
+
"./requirements/requirements.build.txt",
|
|
51
|
+
] }
|
|
52
|
+
optional-dependencies.docs = { file = ["./requirements/requirements.docs.txt"] }
|
|
53
|
+
optional-dependencies.dev = { file = [
|
|
54
|
+
"./requirements/requirements.async.txt",
|
|
55
|
+
"./requirements/requirements.fastapi.txt",
|
|
56
|
+
"./requirements/requirements.test.txt",
|
|
57
|
+
"./requirements/requirements.build.txt",
|
|
58
|
+
"./requirements/requirements.docs.txt",
|
|
59
|
+
"./requirements/requirements.dev.txt",
|
|
60
|
+
] }
|
|
61
|
+
|
|
62
|
+
# [tool.pyright]
|
|
63
|
+
# venvPath = "."
|
|
64
|
+
# venv = ".venv"
|
|
65
|
+
|
|
66
|
+
[project.urls]
|
|
67
|
+
Homepage = "https://github.com/bybatkhuu/module.python-utils"
|
|
68
|
+
Documentation = "https://pyutils-docs.bybatkhuu.dev"
|
|
69
|
+
Repository = "https://github.com/bybatkhuu/module.python-utils.git"
|
|
70
|
+
Issues = "https://github.com/bybatkhuu/module.python-utils/issues"
|
|
71
|
+
Changelog = "https://github.com/bybatkhuu/module.python-utils/blob/main/CHANGELOG.md"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fastapi>=0.109.2,<1.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.1"
|