GJDutils 0.2.2__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.
- gjdutils-0.2.2/.gitignore +120 -0
- gjdutils-0.2.2/LICENSE +21 -0
- gjdutils-0.2.2/PKG-INFO +101 -0
- gjdutils-0.2.2/README.md +37 -0
- gjdutils-0.2.2/__VERSION__.py +1 -0
- gjdutils-0.2.2/docs/CODING_SHELL_SCRIPTS.md +30 -0
- gjdutils-0.2.2/planning/250215_publishing_to_pypi.md +101 -0
- gjdutils-0.2.2/planning/250215_rename_gdutils_to_gjdutils.md +97 -0
- gjdutils-0.2.2/pyproject.toml +96 -0
- gjdutils-0.2.2/scripts/check_locally.py +74 -0
- gjdutils-0.2.2/scripts/check_pypiprod.py +36 -0
- gjdutils-0.2.2/scripts/check_pypitest.py +37 -0
- gjdutils-0.2.2/scripts/deploy_all.py +27 -0
- gjdutils-0.2.2/scripts/deploy_pypiprod.py +47 -0
- gjdutils-0.2.2/scripts/deploy_pypitest.py +39 -0
- gjdutils-0.2.2/src/gjdutils/__init__.py +12 -0
- gjdutils-0.2.2/src/gjdutils/audios.py +39 -0
- gjdutils-0.2.2/src/gjdutils/cacheing.py +237 -0
- gjdutils-0.2.2/src/gjdutils/cmd.py +149 -0
- gjdutils-0.2.2/src/gjdutils/colab.py +39 -0
- gjdutils-0.2.2/src/gjdutils/collections.py +36 -0
- gjdutils-0.2.2/src/gjdutils/decorators.py +34 -0
- gjdutils-0.2.2/src/gjdutils/dicts.py +216 -0
- gjdutils-0.2.2/src/gjdutils/dsci.py +202 -0
- gjdutils-0.2.2/src/gjdutils/dt.py +296 -0
- gjdutils-0.2.2/src/gjdutils/env.py +64 -0
- gjdutils-0.2.2/src/gjdutils/errors.py +12 -0
- gjdutils-0.2.2/src/gjdutils/files.py +140 -0
- gjdutils-0.2.2/src/gjdutils/functions.py +6 -0
- gjdutils-0.2.2/src/gjdutils/google_translate.py +80 -0
- gjdutils-0.2.2/src/gjdutils/hashing.py +32 -0
- gjdutils-0.2.2/src/gjdutils/html.py +87 -0
- gjdutils-0.2.2/src/gjdutils/indexing.py +97 -0
- gjdutils-0.2.2/src/gjdutils/iterfunc.py +99 -0
- gjdutils-0.2.2/src/gjdutils/jsons.py +70 -0
- gjdutils-0.2.2/src/gjdutils/lists.py +13 -0
- gjdutils-0.2.2/src/gjdutils/llm_utils.py +167 -0
- gjdutils-0.2.2/src/gjdutils/llms_claude.py +131 -0
- gjdutils-0.2.2/src/gjdutils/llms_openai.py +299 -0
- gjdutils-0.2.2/src/gjdutils/misc.py +30 -0
- gjdutils-0.2.2/src/gjdutils/num.py +77 -0
- gjdutils-0.2.2/src/gjdutils/obsolete/google_text_to_speech.py +46 -0
- gjdutils-0.2.2/src/gjdutils/obsolete/llms_obsolete.py +298 -0
- gjdutils-0.2.2/src/gjdutils/outloud_text_to_speech.py +230 -0
- gjdutils-0.2.2/src/gjdutils/prompt_templates.py +20 -0
- gjdutils-0.2.2/src/gjdutils/pypi_build.py +112 -0
- gjdutils-0.2.2/src/gjdutils/pytest_utils.py +24 -0
- gjdutils-0.2.2/src/gjdutils/rand.py +65 -0
- gjdutils-0.2.2/src/gjdutils/regex.py +78 -0
- gjdutils-0.2.2/src/gjdutils/requirements_dev.txt +2 -0
- gjdutils-0.2.2/src/gjdutils/runtime.py +19 -0
- gjdutils-0.2.2/src/gjdutils/sets.py +5 -0
- gjdutils-0.2.2/src/gjdutils/shell.py +69 -0
- gjdutils-0.2.2/src/gjdutils/sorteddict.py +34 -0
- gjdutils-0.2.2/src/gjdutils/stopwatch.py +79 -0
- gjdutils-0.2.2/src/gjdutils/strings.py +218 -0
- gjdutils-0.2.2/src/gjdutils/todo/convert_parquet.py +28 -0
- gjdutils-0.2.2/src/gjdutils/typ.py +37 -0
- gjdutils-0.2.2/src/gjdutils/voice_speechrecognition.py +29 -0
- gjdutils-0.2.2/src/gjdutils/web.py +68 -0
- gjdutils-0.2.2/tests/__init__.py +0 -0
- gjdutils-0.2.2/tests/test_indexing.py +118 -0
- gjdutils-0.2.2/tests/test_rand.py +24 -0
- gjdutils-0.2.2/tests/test_strings.py +3 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
.hypothesis/
|
|
49
|
+
.pytest_cache/
|
|
50
|
+
|
|
51
|
+
# Translations
|
|
52
|
+
*.mo
|
|
53
|
+
*.pot
|
|
54
|
+
|
|
55
|
+
# Django stuff:
|
|
56
|
+
*.log
|
|
57
|
+
local_settings.py
|
|
58
|
+
db.sqlite3
|
|
59
|
+
|
|
60
|
+
# Flask stuff:
|
|
61
|
+
instance/
|
|
62
|
+
.webassets-cache
|
|
63
|
+
|
|
64
|
+
# Scrapy stuff:
|
|
65
|
+
.scrapy
|
|
66
|
+
|
|
67
|
+
# Sphinx documentation
|
|
68
|
+
docs/_build/
|
|
69
|
+
|
|
70
|
+
# PyBuilder
|
|
71
|
+
target/
|
|
72
|
+
|
|
73
|
+
# Jupyter Notebook
|
|
74
|
+
.ipynb_checkpoints
|
|
75
|
+
|
|
76
|
+
# IPython
|
|
77
|
+
profile_default/
|
|
78
|
+
ipython_config.py
|
|
79
|
+
|
|
80
|
+
# pyenv
|
|
81
|
+
.python-version
|
|
82
|
+
|
|
83
|
+
# celery beat schedule file
|
|
84
|
+
celerybeat-schedule
|
|
85
|
+
|
|
86
|
+
# SageMath parsed files
|
|
87
|
+
*.sage.py
|
|
88
|
+
|
|
89
|
+
# Environments
|
|
90
|
+
.env
|
|
91
|
+
.venv
|
|
92
|
+
env/
|
|
93
|
+
venv/
|
|
94
|
+
ENV/
|
|
95
|
+
env.bak/
|
|
96
|
+
venv.bak/
|
|
97
|
+
|
|
98
|
+
# Spyder project settings
|
|
99
|
+
.spyderproject
|
|
100
|
+
.spyproject
|
|
101
|
+
|
|
102
|
+
# Rope project settings
|
|
103
|
+
.ropeproject
|
|
104
|
+
|
|
105
|
+
# mkdocs documentation
|
|
106
|
+
/site
|
|
107
|
+
|
|
108
|
+
# mypy
|
|
109
|
+
.mypy_cache/
|
|
110
|
+
.dmypy.json
|
|
111
|
+
dmypy.json
|
|
112
|
+
|
|
113
|
+
# Pyre type checker
|
|
114
|
+
.pyre/
|
|
115
|
+
|
|
116
|
+
# added by GD
|
|
117
|
+
.#*
|
|
118
|
+
.DS_Store
|
|
119
|
+
.pypirc
|
|
120
|
+
|
gjdutils-0.2.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Greg Detre
|
|
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.
|
gjdutils-0.2.2/PKG-INFO
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: GJDutils
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: A collection of useful utility functions (basics, data science/AI, web development, etc)
|
|
5
|
+
Project-URL: Homepage, https://github.com/gregdetre/gjdutils
|
|
6
|
+
Project-URL: Repository, https://github.com/gregdetre/gjdutils
|
|
7
|
+
Author-email: Greg Detre <greg@gregdetre.com>
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: ai,data science,dates,llm,strings,utilities,web development
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Utilities
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Requires-Dist: ipython
|
|
18
|
+
Requires-Dist: jinja2
|
|
19
|
+
Requires-Dist: pydantic
|
|
20
|
+
Requires-Dist: python-dotenv
|
|
21
|
+
Provides-Extra: all-no-dev
|
|
22
|
+
Requires-Dist: azure-cognitiveservices-speech; extra == 'all-no-dev'
|
|
23
|
+
Requires-Dist: bs4; extra == 'all-no-dev'
|
|
24
|
+
Requires-Dist: cachetools; extra == 'all-no-dev'
|
|
25
|
+
Requires-Dist: elevenlabs; extra == 'all-no-dev'
|
|
26
|
+
Requires-Dist: google-cloud-texttospeech; extra == 'all-no-dev'
|
|
27
|
+
Requires-Dist: google-cloud-translate; extra == 'all-no-dev'
|
|
28
|
+
Requires-Dist: humanize; extra == 'all-no-dev'
|
|
29
|
+
Requires-Dist: openai; extra == 'all-no-dev'
|
|
30
|
+
Requires-Dist: pendulum; extra == 'all-no-dev'
|
|
31
|
+
Requires-Dist: pillow; extra == 'all-no-dev'
|
|
32
|
+
Requires-Dist: playsound; extra == 'all-no-dev'
|
|
33
|
+
Requires-Dist: pygame; extra == 'all-no-dev'
|
|
34
|
+
Requires-Dist: python-vlc; extra == 'all-no-dev'
|
|
35
|
+
Requires-Dist: speechrecognition; extra == 'all-no-dev'
|
|
36
|
+
Provides-Extra: audio-lang
|
|
37
|
+
Requires-Dist: azure-cognitiveservices-speech; extra == 'audio-lang'
|
|
38
|
+
Requires-Dist: cachetools; extra == 'audio-lang'
|
|
39
|
+
Requires-Dist: elevenlabs; extra == 'audio-lang'
|
|
40
|
+
Requires-Dist: google-cloud-texttospeech; extra == 'audio-lang'
|
|
41
|
+
Requires-Dist: google-cloud-translate; extra == 'audio-lang'
|
|
42
|
+
Requires-Dist: playsound; extra == 'audio-lang'
|
|
43
|
+
Requires-Dist: pygame; extra == 'audio-lang'
|
|
44
|
+
Requires-Dist: python-vlc; extra == 'audio-lang'
|
|
45
|
+
Requires-Dist: speechrecognition; extra == 'audio-lang'
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: black; extra == 'dev'
|
|
48
|
+
Requires-Dist: build; extra == 'dev'
|
|
49
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
50
|
+
Requires-Dist: rich; extra == 'dev'
|
|
51
|
+
Requires-Dist: twine; extra == 'dev'
|
|
52
|
+
Requires-Dist: typer; extra == 'dev'
|
|
53
|
+
Requires-Dist: wheel; extra == 'dev'
|
|
54
|
+
Provides-Extra: dt
|
|
55
|
+
Requires-Dist: humanize; extra == 'dt'
|
|
56
|
+
Requires-Dist: pendulum; extra == 'dt'
|
|
57
|
+
Provides-Extra: html-web
|
|
58
|
+
Requires-Dist: bs4; extra == 'html-web'
|
|
59
|
+
Provides-Extra: llm
|
|
60
|
+
Requires-Dist: cachetools; extra == 'llm'
|
|
61
|
+
Requires-Dist: openai; extra == 'llm'
|
|
62
|
+
Requires-Dist: pillow; extra == 'llm'
|
|
63
|
+
Description-Content-Type: text/markdown
|
|
64
|
+
|
|
65
|
+
# gjdutils
|
|
66
|
+
|
|
67
|
+
A collection of useful utility functions (strings, dates, data science/AI, web development, types, etc).
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install gjdutils
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
For optional features:
|
|
76
|
+
```bash
|
|
77
|
+
pip install "gjdutils[dt]" # Date/time utilities
|
|
78
|
+
pip install "gjdutils[llm]" # AI/LLM integrations
|
|
79
|
+
pip install "gjdutils[audio_lang]" # Speech/translation, language-related
|
|
80
|
+
pip install "gjdutils[html_web]" # Web scraping
|
|
81
|
+
pip install "gjdutils[dev]" # Development tools (for tweaking `gjdutils` itself, e.g. pytest)
|
|
82
|
+
|
|
83
|
+
# Install all optional dependencies at once (except `dev`, which is used for developing `gjdutils` itself)
|
|
84
|
+
pip install "gjdutils[all_no_dev]"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Development Setup
|
|
88
|
+
|
|
89
|
+
If you're developing `gjdutils` itself:
|
|
90
|
+
```bash
|
|
91
|
+
# From the gjdutils root directory
|
|
92
|
+
pip install -e ".[dev]" # Install in editable mode with development dependencies
|
|
93
|
+
pip install -e ".[all_no_dev]" # Install all optional dependencies (except dev)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Adding to requirements.txt
|
|
97
|
+
|
|
98
|
+
To add to your `requirements.txt` in editable mode, e.g. to install all optional dependencies:
|
|
99
|
+
```text
|
|
100
|
+
-e "git+https://github.com/gregdetre/gjdutils.git#egg=gjdutils[all_no_dev]"
|
|
101
|
+
```
|
gjdutils-0.2.2/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# gjdutils
|
|
2
|
+
|
|
3
|
+
A collection of useful utility functions (strings, dates, data science/AI, web development, types, etc).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install gjdutils
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For optional features:
|
|
12
|
+
```bash
|
|
13
|
+
pip install "gjdutils[dt]" # Date/time utilities
|
|
14
|
+
pip install "gjdutils[llm]" # AI/LLM integrations
|
|
15
|
+
pip install "gjdutils[audio_lang]" # Speech/translation, language-related
|
|
16
|
+
pip install "gjdutils[html_web]" # Web scraping
|
|
17
|
+
pip install "gjdutils[dev]" # Development tools (for tweaking `gjdutils` itself, e.g. pytest)
|
|
18
|
+
|
|
19
|
+
# Install all optional dependencies at once (except `dev`, which is used for developing `gjdutils` itself)
|
|
20
|
+
pip install "gjdutils[all_no_dev]"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Development Setup
|
|
24
|
+
|
|
25
|
+
If you're developing `gjdutils` itself:
|
|
26
|
+
```bash
|
|
27
|
+
# From the gjdutils root directory
|
|
28
|
+
pip install -e ".[dev]" # Install in editable mode with development dependencies
|
|
29
|
+
pip install -e ".[all_no_dev]" # Install all optional dependencies (except dev)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Adding to requirements.txt
|
|
33
|
+
|
|
34
|
+
To add to your `requirements.txt` in editable mode, e.g. to install all optional dependencies:
|
|
35
|
+
```text
|
|
36
|
+
-e "git+https://github.com/gregdetre/gjdutils.git#egg=gjdutils[all_no_dev]"
|
|
37
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.2"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Shell Script Guidelines
|
|
2
|
+
|
|
3
|
+
## General Principles
|
|
4
|
+
|
|
5
|
+
- Keep things simple and readable
|
|
6
|
+
- Prefer Python scripts over shell scripts
|
|
7
|
+
- Keep scripts minimal, concise, and focused on a single task
|
|
8
|
+
- Break long main functions into sub-functions to make it easy to follow the logic
|
|
9
|
+
- Prefer to show the full tracebacks & error messages, to give the user full information. Minimise try/except.
|
|
10
|
+
- Fail explicitly and loudly, e.g. , and use `set -e` in bash scripts to exit on error
|
|
11
|
+
|
|
12
|
+
## Coding details
|
|
13
|
+
- Scripts live in `scripts/`
|
|
14
|
+
- Make scripts executable with `chmod +x`
|
|
15
|
+
- Use `#!/bin/bash` or `#!/usr/bin/env python3` shebang lines
|
|
16
|
+
- Use python `Typer` if command-line arguments are needed
|
|
17
|
+
- Use `cmd.py` functionality, e.g. `run_cmd()`
|
|
18
|
+
- If there is overlapping functionality, maybe move it into `src/shell.py` or somewhere else reusable
|
|
19
|
+
- Use colors for better readability (green for success, yellow for warnings, red for errors)
|
|
20
|
+
- Show progress for long-running operations
|
|
21
|
+
- If it will make it easier to see what the Python is doing in a script, include a comment showing the equivalent shell commands, e.g.:
|
|
22
|
+
```python
|
|
23
|
+
# i.e. rm -rf dist/
|
|
24
|
+
shutil.rmtree("dist", ignore_errors=True)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
See `scripts/check_locally.py` for an example following most of these guidelines.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Publishing gjdutils to PyPI
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
- First release of gjdutils to PyPI
|
|
5
|
+
- Version 0.2.0 (after rename from gdutils)
|
|
6
|
+
- Package contains utility functions for strings, dates, data science/AI, web development
|
|
7
|
+
|
|
8
|
+
## Prerequisites
|
|
9
|
+
- Python >=3.10
|
|
10
|
+
- Build tools: `pip install build twine`
|
|
11
|
+
- PyPI account with 2FA configured
|
|
12
|
+
- .pypirc file configured with test and prod PyPI credentials
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
1. Build and test package locally:
|
|
17
|
+
```bash
|
|
18
|
+
# Option 1: Automated testing script (recommended)
|
|
19
|
+
./scripts/check_locally.sh
|
|
20
|
+
|
|
21
|
+
# Option 2: Manual steps
|
|
22
|
+
# Clean any existing builds
|
|
23
|
+
rm -rf dist/ build/
|
|
24
|
+
|
|
25
|
+
# Build the package
|
|
26
|
+
python -m build
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
2. Test PyPI Deployment:
|
|
30
|
+
```bash
|
|
31
|
+
# Option 1: Automated testing script (recommended)
|
|
32
|
+
./scripts/check_test_pypi.sh
|
|
33
|
+
|
|
34
|
+
# Option 2: Manual steps
|
|
35
|
+
# Upload to test.pypi.org
|
|
36
|
+
twine upload -r testpypi dist/*
|
|
37
|
+
|
|
38
|
+
# Create a fresh virtualenv for testing
|
|
39
|
+
python -m venv /tmp/test-gjdutils
|
|
40
|
+
source /tmp/test-gjdutils/bin/activate
|
|
41
|
+
|
|
42
|
+
# Test installation from test.pypi.org (with dependencies from PyPI)
|
|
43
|
+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ gjdutils
|
|
44
|
+
|
|
45
|
+
# Test basic functionality
|
|
46
|
+
python -c "import gjdutils; print(gjdutils.__version__)"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. Production PyPI Deployment:
|
|
50
|
+
```bash
|
|
51
|
+
# Upload to PyPI
|
|
52
|
+
twine upload dist/*
|
|
53
|
+
|
|
54
|
+
# Create a fresh virtualenv for testing
|
|
55
|
+
python -m venv /tmp/prod-gjdutils
|
|
56
|
+
source /tmp/prod-gjdutils/bin/activate
|
|
57
|
+
|
|
58
|
+
# Test installation
|
|
59
|
+
pip install gjdutils
|
|
60
|
+
|
|
61
|
+
# Test basic functionality
|
|
62
|
+
python -c "import gjdutils; print(gjdutils.__version__)"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Optional Features
|
|
66
|
+
Package has several optional feature sets that can be installed:
|
|
67
|
+
```bash
|
|
68
|
+
pip install "gjdutils[dt]" # Date/time utilities
|
|
69
|
+
pip install "gjdutils[llm]" # AI/LLM integrations
|
|
70
|
+
pip install "gjdutils[audio_lang]" # Speech/translation
|
|
71
|
+
pip install "gjdutils[html_web]" # Web scraping
|
|
72
|
+
pip install "gjdutils[dev]" # Development tools
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Progress Tracking
|
|
76
|
+
|
|
77
|
+
### Current State
|
|
78
|
+
- Package renamed to gjdutils
|
|
79
|
+
- Version 0.2.0 ready for release
|
|
80
|
+
- All tests passing
|
|
81
|
+
|
|
82
|
+
### Next Steps
|
|
83
|
+
1. Build package:
|
|
84
|
+
- Clean existing builds
|
|
85
|
+
- Run build command
|
|
86
|
+
- Verify dist/ contents
|
|
87
|
+
|
|
88
|
+
2. Test deployment:
|
|
89
|
+
- Upload to test.pypi.org
|
|
90
|
+
- Test installation in fresh virtualenv
|
|
91
|
+
- Verify basic functionality
|
|
92
|
+
|
|
93
|
+
3. Production deployment:
|
|
94
|
+
- Upload to PyPI
|
|
95
|
+
- Test installation
|
|
96
|
+
- Verify functionality
|
|
97
|
+
|
|
98
|
+
### Post-deployment
|
|
99
|
+
- [ ] Update GitHub release description
|
|
100
|
+
- [ ] Announce release (if needed)
|
|
101
|
+
- [ ] Update documentation with PyPI installation instructions
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Renaming gdutils to gjdutils
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
- Renaming project from `gdutils` to `gjdutils` (existing `gdutils` name is taken)
|
|
5
|
+
- Package contains utility functions for strings, dates, data science/AI, web development
|
|
6
|
+
- Currently at version 0.1.0, moving to 0.2.0 for the rename
|
|
7
|
+
|
|
8
|
+
## Files Requiring Updates
|
|
9
|
+
1. Package files:
|
|
10
|
+
- pyproject.toml:
|
|
11
|
+
- Update name from "GDutils" to "GJDutils"
|
|
12
|
+
- Update GitHub URLs from gdutils to gjdutils
|
|
13
|
+
- __VERSION__.py: Update version to 0.2.0
|
|
14
|
+
- Rename directory from gdutils/ to gjdutils/
|
|
15
|
+
- Update imports in all Python files:
|
|
16
|
+
- `from gdutils import ...`
|
|
17
|
+
- `import gdutils`
|
|
18
|
+
- References like `gdutils.something()`
|
|
19
|
+
|
|
20
|
+
2. Documentation/Meta:
|
|
21
|
+
- README.md: Update all references and examples
|
|
22
|
+
- .gitignore: Check for any gdutils-specific entries
|
|
23
|
+
- Any additional .md files in docs/ or root directory
|
|
24
|
+
|
|
25
|
+
## Steps
|
|
26
|
+
|
|
27
|
+
0. Backup (Important!)
|
|
28
|
+
```bash
|
|
29
|
+
# Create a backup branch
|
|
30
|
+
git checkout -b backup-before-rename
|
|
31
|
+
git push origin backup-before-rename
|
|
32
|
+
# Return to main
|
|
33
|
+
git checkout main
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
1. Rename GitHub Repository (✓ DONE)
|
|
37
|
+
- In GitHub web UI: Settings -> rename repository from 'gdutils' to 'gjdutils'
|
|
38
|
+
- Update local git remote:
|
|
39
|
+
```bash
|
|
40
|
+
git remote set-url origin https://github.com/gregdetre/gjdutils.git
|
|
41
|
+
```
|
|
42
|
+
- Verify: `git remote -v`
|
|
43
|
+
|
|
44
|
+
2. Local Development Changes
|
|
45
|
+
a. Create a new branch for rename changes:
|
|
46
|
+
```bash
|
|
47
|
+
git checkout -b rename-to-gjdutils
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
b. Update configuration files:
|
|
51
|
+
- ✓ Update version to 0.2.0 in __VERSION__.py
|
|
52
|
+
- ✓ Update pyproject.toml with new name and URLs
|
|
53
|
+
- ✓ Update README.md with new package name
|
|
54
|
+
- ✓ Review other documentation files
|
|
55
|
+
|
|
56
|
+
c. Rename the local directory:
|
|
57
|
+
```bash
|
|
58
|
+
# From the parent directory containing gdutils/
|
|
59
|
+
mv gdutils gjdutils
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
d. Update all internal imports and references
|
|
63
|
+
|
|
64
|
+
3. Testing
|
|
65
|
+
- ✓ Run existing tests to ensure they pass
|
|
66
|
+
- ✓ Test local import: `pip install -e .`
|
|
67
|
+
- ✓ Verify imports work
|
|
68
|
+
|
|
69
|
+
## Progress Tracking
|
|
70
|
+
|
|
71
|
+
### ✓ Completed Steps
|
|
72
|
+
- ✓ Created backup branch
|
|
73
|
+
- ✓ Renamed GitHub repository
|
|
74
|
+
- ✓ Updated local git remote
|
|
75
|
+
- ✓ Updated version to 0.2.0 in __VERSION__.py
|
|
76
|
+
- ✓ Updated pyproject.toml with new name and URLs
|
|
77
|
+
- ✓ Renamed source directory from src/gdutils to src/gjdutils
|
|
78
|
+
- ✓ Updated imports in Python files to use gjdutils
|
|
79
|
+
- ✓ Updated test files to use gjdutils
|
|
80
|
+
- ✓ Fixed package __init__.py to expose version
|
|
81
|
+
- ✓ Verified all tests are passing
|
|
82
|
+
- ✓ Committed all changes to rename-to-gjdutils branch
|
|
83
|
+
- ✓ Merged rename-to-gjdutils to main
|
|
84
|
+
- ✓ Tagged v0.2.0
|
|
85
|
+
|
|
86
|
+
### Files Updated
|
|
87
|
+
- [x] pyproject.toml
|
|
88
|
+
- [x] __VERSION__.py
|
|
89
|
+
- [x] tests/test_gdutils.py (imports updated)
|
|
90
|
+
- [x] All Python files in src/gjdutils/ (imports updated)
|
|
91
|
+
- [x] README.md
|
|
92
|
+
|
|
93
|
+
## Next Steps
|
|
94
|
+
See @250215_publishing_to_pypi.md for next steps on publishing to PyPI.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
# case-insensitive
|
|
3
|
+
name = "GJDutils"
|
|
4
|
+
# https://hatch.pypa.io/latest/config/metadata/
|
|
5
|
+
dynamic = ["version"]
|
|
6
|
+
authors = [
|
|
7
|
+
{ name="Greg Detre", email="greg@gregdetre.com" },
|
|
8
|
+
]
|
|
9
|
+
description = "A collection of useful utility functions (basics, data science/AI, web development, etc)"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
# because I use the | syntax for type Union
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Topic :: Utilities",
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
]
|
|
21
|
+
keywords = ["utilities", "strings", "dates", "data science", "web development", "llm", "ai",]
|
|
22
|
+
|
|
23
|
+
dependencies = [
|
|
24
|
+
"ipython",
|
|
25
|
+
"jinja2",
|
|
26
|
+
"python-dotenv",
|
|
27
|
+
"pydantic",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
# if you add a new optional dependency group, remember to add it to the 'all' group below
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
audio_lang = [
|
|
33
|
+
"azure-cognitiveservices-speech",
|
|
34
|
+
"cachetools",
|
|
35
|
+
"google-cloud-texttospeech",
|
|
36
|
+
"google-cloud-translate",
|
|
37
|
+
"elevenlabs",
|
|
38
|
+
# for playing mp3
|
|
39
|
+
"playsound",
|
|
40
|
+
# for playing mp3
|
|
41
|
+
"pygame",
|
|
42
|
+
# for playing mp3
|
|
43
|
+
"python-vlc",
|
|
44
|
+
"SpeechRecognition",
|
|
45
|
+
]
|
|
46
|
+
dev = [
|
|
47
|
+
"black",
|
|
48
|
+
"pytest",
|
|
49
|
+
"build",
|
|
50
|
+
"twine",
|
|
51
|
+
"wheel",
|
|
52
|
+
"rich", # for console output formatting
|
|
53
|
+
"typer", # for CLI tools
|
|
54
|
+
]
|
|
55
|
+
dt = [
|
|
56
|
+
"humanize",
|
|
57
|
+
"pendulum",
|
|
58
|
+
]
|
|
59
|
+
html_web = [
|
|
60
|
+
"bs4",
|
|
61
|
+
]
|
|
62
|
+
llm = [
|
|
63
|
+
"cachetools",
|
|
64
|
+
# "llm", no longer using this
|
|
65
|
+
"openai",
|
|
66
|
+
"pillow", # for images
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
all_no_dev = [
|
|
70
|
+
"gjdutils[audio_lang]",
|
|
71
|
+
"gjdutils[dt]",
|
|
72
|
+
"gjdutils[html_web]",
|
|
73
|
+
"gjdutils[llm]",
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
[project.urls]
|
|
77
|
+
Homepage = "https://github.com/gregdetre/gjdutils"
|
|
78
|
+
Repository = "https://github.com/gregdetre/gjdutils"
|
|
79
|
+
# Issues = "https://github.com/gregdetre/gjdutils/issues"
|
|
80
|
+
# Documentation
|
|
81
|
+
# Changelog
|
|
82
|
+
|
|
83
|
+
[build-system]
|
|
84
|
+
requires = ["hatchling"]
|
|
85
|
+
build-backend = "hatchling.build"
|
|
86
|
+
|
|
87
|
+
[tool.hatch.build.targets.sdist]
|
|
88
|
+
exclude = [
|
|
89
|
+
"dist/",
|
|
90
|
+
"gjdutils/obsolete/",
|
|
91
|
+
"gjdutils/todo/",
|
|
92
|
+
"tests/fixme_*.py",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[tool.hatch.version]
|
|
96
|
+
path = "__VERSION__.py"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
from rich.console import Console
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import shutil
|
|
6
|
+
|
|
7
|
+
from gjdutils.decorators import console_print_doc
|
|
8
|
+
from gjdutils.shell import temp_venv
|
|
9
|
+
from gjdutils.cmd import run_cmd
|
|
10
|
+
from gjdutils.pypi_build import verify_installation, check_install_optional_features
|
|
11
|
+
|
|
12
|
+
console = Console()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@console_print_doc(color="yellow")
|
|
16
|
+
def clean_build_dirs():
|
|
17
|
+
"""Cleaning existing builds..."""
|
|
18
|
+
# Command: rm -rf dist/ build/
|
|
19
|
+
shutil.rmtree("dist", ignore_errors=True)
|
|
20
|
+
shutil.rmtree("build", ignore_errors=True)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def build_package():
|
|
24
|
+
return run_cmd(
|
|
25
|
+
f"python -m build",
|
|
26
|
+
before_msg="Building package...",
|
|
27
|
+
fatal_msg="Failed to build package",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def install_and_test_package(python_path: Path, wheel_file: Path):
|
|
32
|
+
"""Installing and testing package..."""
|
|
33
|
+
# Command: pip install dist/*.whl
|
|
34
|
+
run_cmd(
|
|
35
|
+
f"{python_path} -m pip install {wheel_file}",
|
|
36
|
+
before_msg="Installing package wheel file from local build...",
|
|
37
|
+
fatal_msg="Failed to install package",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# Command: pip install ".[dev]"
|
|
41
|
+
run_cmd(
|
|
42
|
+
f"{python_path} -m pip install '.[dev]'",
|
|
43
|
+
before_msg="Installing dev dependencies...",
|
|
44
|
+
fatal_msg="Failed to install dev dependencies",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def run_test_suite(python_path: Path):
|
|
49
|
+
return run_cmd(
|
|
50
|
+
f"{python_path} -m pytest",
|
|
51
|
+
before_msg="Running test suite...",
|
|
52
|
+
fatal_msg="Test suite failed",
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def main():
|
|
57
|
+
console.rule("[yellow]Starting local package testing")
|
|
58
|
+
|
|
59
|
+
clean_build_dirs()
|
|
60
|
+
build_package()
|
|
61
|
+
|
|
62
|
+
venv_path = Path("/tmp/test-gjdutils")
|
|
63
|
+
with temp_venv(venv_path) as python_path:
|
|
64
|
+
wheel_file = next(Path("dist").glob("*.whl"))
|
|
65
|
+
install_and_test_package(python_path, wheel_file)
|
|
66
|
+
verify_installation(python_path)
|
|
67
|
+
run_test_suite(python_path)
|
|
68
|
+
check_install_optional_features(python_path)
|
|
69
|
+
|
|
70
|
+
console.print("\nLocal testing completed successfully!", style="green")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if __name__ == "__main__":
|
|
74
|
+
main()
|