desertislandutils 0.1.0__tar.gz → 0.4.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.
- desertislandutils-0.4.2/.github/workflows/main.yml +47 -0
- desertislandutils-0.4.2/.github/workflows/release.yml +71 -0
- desertislandutils-0.4.2/.github/workflows/test.yml +77 -0
- desertislandutils-0.4.2/.gitignore +148 -0
- desertislandutils-0.4.2/PKG-INFO +96 -0
- desertislandutils-0.4.2/README.md +79 -0
- desertislandutils-0.4.2/__init__.py +0 -0
- desertislandutils-0.4.2/base.justfile +46 -0
- desertislandutils-0.4.2/justfile +78 -0
- desertislandutils-0.4.2/notes/CICD-notes.md +102 -0
- desertislandutils-0.4.2/notes/GHA.actions-handy.yml +179 -0
- desertislandutils-0.4.2/notes/example-gha-workflow.on-push.yaml +84 -0
- desertislandutils-0.4.2/notes/package-log.md +101 -0
- desertislandutils-0.4.2/notes/poetry-packaging-notes.md +60 -0
- desertislandutils-0.4.2/notes/toobigdatadoc-dev-log.md +334 -0
- desertislandutils-0.4.2/notes/toobigdatadoc-packaging-log.md +195 -0
- desertislandutils-0.4.2/notes/toobigdatadoc.poetry-pytest-problem.md +85 -0
- desertislandutils-0.4.2/notes/weeknumber/weeknumber.md +128 -0
- desertislandutils-0.4.2/notes/why-parallel-file-systems.md +74 -0
- desertislandutils-0.4.2/notes/workflow.publish-update.md +87 -0
- desertislandutils-0.4.2/notes/workflow.unit-testing.md +68 -0
- desertislandutils-0.4.2/notes/workflows/archive/github-actions-demo.yml +23 -0
- desertislandutils-0.4.2/notes/workflows/github.actions.auto-merge-back-to-dev.yml +30 -0
- desertislandutils-0.4.2/notes/workflows/github.actions.setup-python.yml +42 -0
- desertislandutils-0.4.2/notes/workflows/github.example.python-simple.yml +32 -0
- desertislandutils-0.4.2/notes/workflows/github.python-app.yml +41 -0
- desertislandutils-0.4.2/notes/workflows/github.python-package.yml +42 -0
- desertislandutils-0.4.2/notes/workflows/poetry.abatilo.CI-actions.yml +26 -0
- desertislandutils-0.4.2/notes/workflows/poetry.abatilo.release-on-push.yml +37 -0
- desertislandutils-0.4.2/pyproject.toml +33 -0
- desertislandutils-0.4.2/src/__init__.py +0 -0
- desertislandutils-0.4.2/src/toobigdatadoc/__init__.py +0 -0
- desertislandutils-0.4.2/src/toobigdatadoc/too.py +87 -0
- desertislandutils-0.4.2/src/weeknumber/__init__.py +0 -0
- desertislandutils-0.4.2/src/weeknumber/wn.py +85 -0
- desertislandutils-0.4.2/tests/README.md +38 -0
- desertislandutils-0.4.2/tests/__init__.py +0 -0
- desertislandutils-0.4.2/tests/test_unit.py +18 -0
- desertislandutils-0.4.2/tests/toobigdatadoc/test_pytest.py +11 -0
- desertislandutils-0.4.2/tests/toobigdatadoc/test_too.py +93 -0
- desertislandutils-0.4.2/tests/wn/test_wn.py +106 -0
- desertislandutils-0.4.2/todo/RESUME.manual-build-bump-formula.md +84 -0
- desertislandutils-0.4.2/todo/TODO.md +77 -0
- desertislandutils-0.4.2/todo/bash-to-python-migrate.md +13 -0
- desertislandutils-0.4.2/todo/desertislandutils.markdowner.md +13 -0
- desertislandutils-0.4.2/todo/poetry-build-github-actions.md +136 -0
- desertislandutils-0.1.0/PKG-INFO +0 -14
- desertislandutils-0.1.0/pyproject.toml +0 -24
- desertislandutils-0.1.0/setup.py +0 -34
- desertislandutils-0.1.0/src/toobigdatadoc/__init__.py +0 -1
- desertislandutils-0.1.0/src/toobigdatadoc/too.py +0 -88
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Merge Release Branch and Tag
|
|
2
|
+
|
|
3
|
+
env:
|
|
4
|
+
ACTIONS_STEP_DEBUG: true
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
types: [closed]
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
tag-release:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
if: |
|
|
16
|
+
github.event.pull_request.merged == true &&
|
|
17
|
+
startsWith(github.event.pull_request.head.ref, 'release/')
|
|
18
|
+
steps:
|
|
19
|
+
- name: Show PR info
|
|
20
|
+
run: |
|
|
21
|
+
echo "PR merged from: ${{ github.event.pull_request.head.ref }}"
|
|
22
|
+
echo "PR merged to: ${{ github.event.pull_request.base.ref }}"
|
|
23
|
+
|
|
24
|
+
- name: Checkout the repo
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
fetch-depth: 0
|
|
28
|
+
|
|
29
|
+
- name: Generate tag name
|
|
30
|
+
id: tag
|
|
31
|
+
run: |
|
|
32
|
+
release_branch="${{ github.event.pull_request.head.ref }}"
|
|
33
|
+
tag_name=$(echo "$release_branch" | sed -E 's/.*release.*([0-9]+\.[0-9]+\.[0-9]+).*/v\1/')
|
|
34
|
+
echo "release_tag_name=$tag_name" >> $GITHUB_OUTPUT
|
|
35
|
+
echo "Generated tag: $tag_name"
|
|
36
|
+
|
|
37
|
+
- name: Create and push tag
|
|
38
|
+
run: |
|
|
39
|
+
git config user.name gha-bot
|
|
40
|
+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
41
|
+
git tag --annotate "${{ steps.tag.outputs.release_tag_name }}" -m "release ${{ steps.tag.outputs.release_tag_name }}"
|
|
42
|
+
git push origin "${{ steps.tag.outputs.release_tag_name }}"
|
|
43
|
+
echo
|
|
44
|
+
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
45
|
+
git log --graph --all -n10 --pretty=format:'%h %as %cn %x09%s %d'
|
|
46
|
+
echo "Tag "${{ steps.tag.outputs.release_tag_name }}" created and pushed"
|
|
47
|
+
echo "YOU CAN DELETE RELEASE BRANCH: $RELEASE_BRANCH"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: Publish Release
|
|
2
|
+
# create a release from the latest tag on MAIN or something
|
|
3
|
+
|
|
4
|
+
env:
|
|
5
|
+
ACTIONS_STEP_DEBUG: true
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
workflow_run:
|
|
9
|
+
workflows: [Merge Release Branch and Tag]
|
|
10
|
+
types: [completed]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
release:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: '3.11'
|
|
23
|
+
|
|
24
|
+
- name: Install UV
|
|
25
|
+
uses: astral-sh/setup-uv@v5
|
|
26
|
+
|
|
27
|
+
- name: Get Latest Tag
|
|
28
|
+
id: get_tag
|
|
29
|
+
run: |
|
|
30
|
+
git branch --list
|
|
31
|
+
git log --oneline --tags -n10 --pretty=format:'%h %as %cn %x09%s %d'
|
|
32
|
+
echo
|
|
33
|
+
echo "current ref is ${{ github.ref_name }}"
|
|
34
|
+
latest_tag="$(git describe --tags --abbrev=0)"
|
|
35
|
+
echo "latest tag: ${latest_tag}"
|
|
36
|
+
echo latest_tag="${latest_tag}" >> $GITHUB_OUTPUT
|
|
37
|
+
|
|
38
|
+
- name: Build UV Distribution from Latest Tag
|
|
39
|
+
run: |
|
|
40
|
+
git checkout "${{ steps.get_tag.outputs.latest_tag }}"
|
|
41
|
+
uv build
|
|
42
|
+
|
|
43
|
+
- name: Validate Tag Matches Version
|
|
44
|
+
run: |
|
|
45
|
+
tag="${{ steps.get_tag.outputs.latest_tag }}"
|
|
46
|
+
app_version="v$(uv version | awk '{print $2}')"
|
|
47
|
+
echo "Git tag: ${tag}"
|
|
48
|
+
echo "App version: ${app_version}"
|
|
49
|
+
if [[ "${tag}" != "${app_version}" ]]; then
|
|
50
|
+
echo "ERROR: Git tag '${tag}' does not match pyproject.toml version '${app_version}'"
|
|
51
|
+
echo "Developer must ensure release branch has matching version in pyproject.toml"
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
echo "Tag and version match"
|
|
55
|
+
|
|
56
|
+
- name: Create release from tag
|
|
57
|
+
id: create_release
|
|
58
|
+
uses: ncipollo/release-action@v1
|
|
59
|
+
with:
|
|
60
|
+
artifacts: "dist/*"
|
|
61
|
+
generateReleaseNotes: true
|
|
62
|
+
allowUpdates: true
|
|
63
|
+
tag: ${{ steps.get_tag.outputs.latest_tag }}
|
|
64
|
+
|
|
65
|
+
- name: Publish to PyPI
|
|
66
|
+
run: uv publish --token ${{ secrets.PYPI_TOKEN }}
|
|
67
|
+
|
|
68
|
+
- name: Release URL Output
|
|
69
|
+
run: |
|
|
70
|
+
echo release URL: ${{ steps.create_release.outputs.html_url }}
|
|
71
|
+
echo PyPI: https://pypi.org/project/desertislandutils/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: Test desertislandutils
|
|
2
|
+
|
|
3
|
+
env:
|
|
4
|
+
ACTIONS_STEP_DEBUG: true
|
|
5
|
+
|
|
6
|
+
concurrency:
|
|
7
|
+
group: test-${{ github.ref }}
|
|
8
|
+
cancel-in-progress: true
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches:
|
|
13
|
+
- '**'
|
|
14
|
+
paths-ignore:
|
|
15
|
+
- '**.md'
|
|
16
|
+
pull_request:
|
|
17
|
+
branches: [main]
|
|
18
|
+
paths-ignore: ['**.md']
|
|
19
|
+
|
|
20
|
+
# NOTE: workflow_dispatch only work on main
|
|
21
|
+
workflow_dispatch:
|
|
22
|
+
inputs:
|
|
23
|
+
note:
|
|
24
|
+
description: 'Describe why you are doing this'
|
|
25
|
+
required: false
|
|
26
|
+
default: 'no message'
|
|
27
|
+
manual_workflow_conclusion:
|
|
28
|
+
description: 'Insert success/failure for downstream'
|
|
29
|
+
required: false
|
|
30
|
+
default: ''
|
|
31
|
+
type: choice
|
|
32
|
+
options:
|
|
33
|
+
- ' '
|
|
34
|
+
- failure
|
|
35
|
+
- success
|
|
36
|
+
|
|
37
|
+
jobs:
|
|
38
|
+
uv-run-tests:
|
|
39
|
+
runs-on: macos-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- uses: actions/setup-python@v5
|
|
43
|
+
with:
|
|
44
|
+
python-version: '3.11'
|
|
45
|
+
|
|
46
|
+
- name: Install UV
|
|
47
|
+
uses: astral-sh/setup-uv@v5
|
|
48
|
+
|
|
49
|
+
- name: UV Sync and Test
|
|
50
|
+
run: |
|
|
51
|
+
python --version
|
|
52
|
+
uv --version
|
|
53
|
+
uv sync --all-extras
|
|
54
|
+
uv run pytest --disable-warnings --verbose
|
|
55
|
+
echo "WARNING: Pytest Warnings are disabled"
|
|
56
|
+
|
|
57
|
+
- name: Get Latest Tag
|
|
58
|
+
id: get_tag
|
|
59
|
+
run: |
|
|
60
|
+
latest_tag="$(git ls-remote origin 'refs/tags/v*[0-9]' | awk -F'refs/tags/' '{print $2}' | sort -V | tail -1)"
|
|
61
|
+
echo latest_tag="${latest_tag}" >> $GITHUB_OUTPUT
|
|
62
|
+
|
|
63
|
+
- name: Get desertislandutils Version
|
|
64
|
+
id: app_version
|
|
65
|
+
run: |
|
|
66
|
+
app_version="$(uv version | awk '{print $2}')"
|
|
67
|
+
echo app_version="v${app_version}" >> $GITHUB_OUTPUT
|
|
68
|
+
|
|
69
|
+
- name: REFERENCE - Variables and Workflow Contexts
|
|
70
|
+
run: |
|
|
71
|
+
echo "workflow: ${{ github.workflow }}"
|
|
72
|
+
echo "job_id: ${{ github.job }}"
|
|
73
|
+
echo "job status: ${{ job.status }}"
|
|
74
|
+
echo "commit ref name: ${{ github.ref_name }}"
|
|
75
|
+
echo "branch name: ${{ github.ref }}"
|
|
76
|
+
echo "latest tag: ${{ steps.get_tag.outputs.latest_tag }}"
|
|
77
|
+
echo "app version: ${{ steps.app_version.outputs.app_version }}"
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# python gitignore standards
|
|
2
|
+
# https://github.com/github/gitignore/blob/main/Python.gitignore
|
|
3
|
+
|
|
4
|
+
# Byte-compiled / optimized / DLL files
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*$py.class
|
|
8
|
+
|
|
9
|
+
# C extensions
|
|
10
|
+
*.so
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
.Python
|
|
14
|
+
build/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
dist/
|
|
17
|
+
downloads/
|
|
18
|
+
eggs/
|
|
19
|
+
.eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
wheels/
|
|
26
|
+
share/python-wheels/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
.installed.cfg
|
|
29
|
+
*.egg
|
|
30
|
+
MANIFEST
|
|
31
|
+
|
|
32
|
+
# PyInstaller
|
|
33
|
+
# Usually these files are written by a python script from a template
|
|
34
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
35
|
+
*.manifest
|
|
36
|
+
*.spec
|
|
37
|
+
|
|
38
|
+
# Installer logs
|
|
39
|
+
pip-log.txt
|
|
40
|
+
pip-delete-this-directory.txt
|
|
41
|
+
|
|
42
|
+
# Unit test / coverage reports
|
|
43
|
+
htmlcov/
|
|
44
|
+
.tox/
|
|
45
|
+
.nox/
|
|
46
|
+
.coverage
|
|
47
|
+
.coverage.*
|
|
48
|
+
.cache
|
|
49
|
+
nosetests.xml
|
|
50
|
+
coverage.xml
|
|
51
|
+
*.cover
|
|
52
|
+
*.py,cover
|
|
53
|
+
.hypothesis/
|
|
54
|
+
.pytest_cache/
|
|
55
|
+
cover/
|
|
56
|
+
|
|
57
|
+
# Translations
|
|
58
|
+
*.mo
|
|
59
|
+
*.pot
|
|
60
|
+
|
|
61
|
+
# Django stuff:
|
|
62
|
+
*.log
|
|
63
|
+
local_settings.py
|
|
64
|
+
db.sqlite3
|
|
65
|
+
db.sqlite3-journal
|
|
66
|
+
|
|
67
|
+
# Flask stuff:
|
|
68
|
+
instance/
|
|
69
|
+
.webassets-cache
|
|
70
|
+
|
|
71
|
+
# Scrapy stuff:
|
|
72
|
+
.scrapy
|
|
73
|
+
|
|
74
|
+
# Sphinx documentation
|
|
75
|
+
docs/_build/
|
|
76
|
+
|
|
77
|
+
# PyBuilder
|
|
78
|
+
.pybuilder/
|
|
79
|
+
target/
|
|
80
|
+
|
|
81
|
+
# Jupyter Notebook
|
|
82
|
+
.ipynb_checkpoints
|
|
83
|
+
|
|
84
|
+
# IPython
|
|
85
|
+
profile_default/
|
|
86
|
+
ipython_config.py
|
|
87
|
+
|
|
88
|
+
# pyenv
|
|
89
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
90
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
91
|
+
# .python-version
|
|
92
|
+
|
|
93
|
+
# pipenv
|
|
94
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
95
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
96
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
97
|
+
# install all needed dependencies.
|
|
98
|
+
#Pipfile.lock
|
|
99
|
+
|
|
100
|
+
# poetry
|
|
101
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
102
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
103
|
+
# commonly ignored for libraries.
|
|
104
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
105
|
+
#poetry.lock
|
|
106
|
+
|
|
107
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
108
|
+
__pypackages__/
|
|
109
|
+
|
|
110
|
+
# Celery stuff
|
|
111
|
+
celerybeat-schedule
|
|
112
|
+
celerybeat.pid
|
|
113
|
+
|
|
114
|
+
# SageMath parsed files
|
|
115
|
+
*.sage.py
|
|
116
|
+
|
|
117
|
+
# Environments
|
|
118
|
+
.env
|
|
119
|
+
.venv
|
|
120
|
+
env/
|
|
121
|
+
venv/
|
|
122
|
+
ENV/
|
|
123
|
+
env.bak/
|
|
124
|
+
venv.bak/
|
|
125
|
+
|
|
126
|
+
# Spyder project settings
|
|
127
|
+
.spyderproject
|
|
128
|
+
.spyproject
|
|
129
|
+
|
|
130
|
+
# Rope project settings
|
|
131
|
+
.ropeproject
|
|
132
|
+
|
|
133
|
+
# mkdocs documentation
|
|
134
|
+
/site
|
|
135
|
+
|
|
136
|
+
# mypy
|
|
137
|
+
.mypy_cache/
|
|
138
|
+
.dmypy.json
|
|
139
|
+
dmypy.json
|
|
140
|
+
|
|
141
|
+
# Pyre type checker
|
|
142
|
+
.pyre/
|
|
143
|
+
|
|
144
|
+
# pytype static type analyzer
|
|
145
|
+
.pytype/
|
|
146
|
+
|
|
147
|
+
# Cython debug symbols
|
|
148
|
+
cython_debug/
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: desertislandutils
|
|
3
|
+
Version: 0.4.2
|
|
4
|
+
Summary: A collection of personal convenience utilities
|
|
5
|
+
Author-email: mahiki <mahiki@users.noreply.github.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: argparse>=1.4.0
|
|
9
|
+
Requires-Dist: gitpython>=3.1.27
|
|
10
|
+
Requires-Dist: pendulum>=3.0.0
|
|
11
|
+
Requires-Dist: typer>=0.12.0
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: ptpython>=3.0.23; extra == 'dev'
|
|
14
|
+
Provides-Extra: test
|
|
15
|
+
Requires-Dist: pytest>=7.2.2; extra == 'test'
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# desertislandutils
|
|
19
|
+
Refactoring my convenience utility bash scripts into python for learning and profit. Deployed for MacOS via homebrew, its really far better than shell scripting, yuck!
|
|
20
|
+
|
|
21
|
+
## INSTALL
|
|
22
|
+
brew install mahiki/tap/desertislandutils
|
|
23
|
+
|
|
24
|
+
## THE UTILS
|
|
25
|
+
### toobigdatadoc
|
|
26
|
+
I like to keep text files in one directory system, with supporting data files and binary documents in parallel directories from the home folder: `toobig`, `toodata`, `toodoc`. For example, its easy to exclude the whole `toobig` directory structure from backups, since there is nothing but huge files here.
|
|
27
|
+
|
|
28
|
+
$HOME
|
|
29
|
+
|-- toobig
|
|
30
|
+
|-- # replicated folder paths with large files here, assume not to be backed up
|
|
31
|
+
|-- toodata
|
|
32
|
+
|-- # small-ish data files in support of the parallel root
|
|
33
|
+
|-- toodoc
|
|
34
|
+
|-- # usually pdfs or image files
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
$> too --help
|
|
38
|
+
usage: too [-h] {big,data,doc}
|
|
39
|
+
|
|
40
|
+
Create symlinked parallel folders to contain data/binary files outside of git repo or away from source/text files.
|
|
41
|
+
|
|
42
|
+
positional arguments:
|
|
43
|
+
{big,data,doc} large files to exclude from backup, smallish datasets, binary files like pdf
|
|
44
|
+
|
|
45
|
+
optional arguments:
|
|
46
|
+
-h, --help show this help message and exit
|
|
47
|
+
Kehena segovia: ~
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### weeknumber
|
|
51
|
+
```sh
|
|
52
|
+
wn --help
|
|
53
|
+
|
|
54
|
+
Usage: wn [OPTIONS] [DATE]
|
|
55
|
+
|
|
56
|
+
ISO year week number of a date as YYYY-WDD. Default weekend day is Sat.
|
|
57
|
+
Example:
|
|
58
|
+
$> wn 'Jul 22'
|
|
59
|
+
2023-W29
|
|
60
|
+
|
|
61
|
+
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────╮
|
|
62
|
+
│ date [DATE] A text expression of date, ex: 'November 27', or 2112-07-29 [default: (dynamic)] │
|
|
63
|
+
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
64
|
+
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
|
65
|
+
│ --sunday Weekend is Saturday by default, this flag sets Sunday weekend day. │
|
|
66
|
+
│ --last Give week number of most recently completed week (overrides DATE argument). │
|
|
67
|
+
│ --verbose --no-verbose [default: no-verbose] │
|
|
68
|
+
│ --install-completion Install completion for the current shell. │
|
|
69
|
+
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
|
|
70
|
+
│ --help Show this message and exit. │
|
|
71
|
+
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
----------
|
|
75
|
+
## DEVELOPMENT
|
|
76
|
+
>Trying to automate the merge tag homebrew tap repo upgrade thing. Its not going great.
|
|
77
|
+
|
|
78
|
+
* build: poetry
|
|
79
|
+
* deploy: poetry -> pypi -> homebrew
|
|
80
|
+
* github CI actions
|
|
81
|
+
|
|
82
|
+
### JUSTFILE
|
|
83
|
+
>Best documentation is in the Just taskrunner `justfile`.
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
just info
|
|
87
|
+
|
|
88
|
+
just wn --help
|
|
89
|
+
|
|
90
|
+
# also direct into poetry environment
|
|
91
|
+
poetry shell
|
|
92
|
+
(desertislandutils)> wn --help
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Testing
|
|
96
|
+
just test
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# desertislandutils
|
|
2
|
+
Refactoring my convenience utility bash scripts into python for learning and profit. Deployed for MacOS via homebrew, its really far better than shell scripting, yuck!
|
|
3
|
+
|
|
4
|
+
## INSTALL
|
|
5
|
+
brew install mahiki/tap/desertislandutils
|
|
6
|
+
|
|
7
|
+
## THE UTILS
|
|
8
|
+
### toobigdatadoc
|
|
9
|
+
I like to keep text files in one directory system, with supporting data files and binary documents in parallel directories from the home folder: `toobig`, `toodata`, `toodoc`. For example, its easy to exclude the whole `toobig` directory structure from backups, since there is nothing but huge files here.
|
|
10
|
+
|
|
11
|
+
$HOME
|
|
12
|
+
|-- toobig
|
|
13
|
+
|-- # replicated folder paths with large files here, assume not to be backed up
|
|
14
|
+
|-- toodata
|
|
15
|
+
|-- # small-ish data files in support of the parallel root
|
|
16
|
+
|-- toodoc
|
|
17
|
+
|-- # usually pdfs or image files
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
$> too --help
|
|
21
|
+
usage: too [-h] {big,data,doc}
|
|
22
|
+
|
|
23
|
+
Create symlinked parallel folders to contain data/binary files outside of git repo or away from source/text files.
|
|
24
|
+
|
|
25
|
+
positional arguments:
|
|
26
|
+
{big,data,doc} large files to exclude from backup, smallish datasets, binary files like pdf
|
|
27
|
+
|
|
28
|
+
optional arguments:
|
|
29
|
+
-h, --help show this help message and exit
|
|
30
|
+
Kehena segovia: ~
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### weeknumber
|
|
34
|
+
```sh
|
|
35
|
+
wn --help
|
|
36
|
+
|
|
37
|
+
Usage: wn [OPTIONS] [DATE]
|
|
38
|
+
|
|
39
|
+
ISO year week number of a date as YYYY-WDD. Default weekend day is Sat.
|
|
40
|
+
Example:
|
|
41
|
+
$> wn 'Jul 22'
|
|
42
|
+
2023-W29
|
|
43
|
+
|
|
44
|
+
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────╮
|
|
45
|
+
│ date [DATE] A text expression of date, ex: 'November 27', or 2112-07-29 [default: (dynamic)] │
|
|
46
|
+
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
47
|
+
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
|
48
|
+
│ --sunday Weekend is Saturday by default, this flag sets Sunday weekend day. │
|
|
49
|
+
│ --last Give week number of most recently completed week (overrides DATE argument). │
|
|
50
|
+
│ --verbose --no-verbose [default: no-verbose] │
|
|
51
|
+
│ --install-completion Install completion for the current shell. │
|
|
52
|
+
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
|
|
53
|
+
│ --help Show this message and exit. │
|
|
54
|
+
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
----------
|
|
58
|
+
## DEVELOPMENT
|
|
59
|
+
>Trying to automate the merge tag homebrew tap repo upgrade thing. Its not going great.
|
|
60
|
+
|
|
61
|
+
* build: poetry
|
|
62
|
+
* deploy: poetry -> pypi -> homebrew
|
|
63
|
+
* github CI actions
|
|
64
|
+
|
|
65
|
+
### JUSTFILE
|
|
66
|
+
>Best documentation is in the Just taskrunner `justfile`.
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
just info
|
|
70
|
+
|
|
71
|
+
just wn --help
|
|
72
|
+
|
|
73
|
+
# also direct into poetry environment
|
|
74
|
+
poetry shell
|
|
75
|
+
(desertislandutils)> wn --help
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Testing
|
|
79
|
+
just test
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Default justfile for import
|
|
2
|
+
|
|
3
|
+
# just --list
|
|
4
|
+
[private]
|
|
5
|
+
ac3e01d:
|
|
6
|
+
@just --justfile base.justfile --list --unsorted --list-heading $'Default Justfile for Imports\n'
|
|
7
|
+
|
|
8
|
+
# color code definitions for use in any justfile
|
|
9
|
+
[private]
|
|
10
|
+
colordefs:
|
|
11
|
+
@echo
|
|
12
|
+
@echo "{{BCY}}Terminal color code definitions included for use in any justfile{{NC}}"
|
|
13
|
+
@echo ' For example, {{{{BCY}} gives:'
|
|
14
|
+
@echo " {{BCY}}Bright Cyan{{NC}}"
|
|
15
|
+
@echo
|
|
16
|
+
|
|
17
|
+
# show the color codes
|
|
18
|
+
colortest:
|
|
19
|
+
@echo " {{NC}}NC{{NC}}"
|
|
20
|
+
@echo " {{BK}}BK{{NC}} {{BL}}BL{{NC}}"
|
|
21
|
+
@echo " {{BBK}}BBK{{NC}} {{BBL}}BBL{{NC}}"
|
|
22
|
+
@echo " {{RD}}RD{{NC}} {{MG}}MG{{NC}}"
|
|
23
|
+
@echo " {{BRD}}BRD{{NC}} {{BMG}}BMG{{NC}}"
|
|
24
|
+
@echo " {{GR}}GR{{NC}} {{CY}}CY{{NC}}"
|
|
25
|
+
@echo " {{BGR}}BGR{{NC}} {{BCY}}BCY{{NC}}"
|
|
26
|
+
@echo " {{YW}}YW{{NC}} {{WT}}WT{{NC}}"
|
|
27
|
+
@echo " {{BYW}}BYW{{NC}} {{BWT}}BWT{{NC}}"
|
|
28
|
+
|
|
29
|
+
# color decorations
|
|
30
|
+
BK := '\033[0;30m' # Black
|
|
31
|
+
BBK := '\033[1;30m' # Bright Gray
|
|
32
|
+
RD := '\033[0;31m' # Red
|
|
33
|
+
BRD := '\033[1;31m' # Bright Red
|
|
34
|
+
GR := '\033[0;32m' # Green
|
|
35
|
+
BGR := '\033[1;32m' # Bright Green
|
|
36
|
+
YW := '\033[0;33m' # Yellow
|
|
37
|
+
BYW := '\033[1;33m' # Bright Yellow
|
|
38
|
+
BL := '\033[0;34m' # Blue
|
|
39
|
+
BBL := '\033[1;34m' # Light Blue
|
|
40
|
+
MG := '\033[0;35m' # Magenta
|
|
41
|
+
BMG := '\033[1;35m' # Light Purple
|
|
42
|
+
CY := '\033[0;36m' # Cyan
|
|
43
|
+
BCY := '\033[1;36m' # Light Cyan
|
|
44
|
+
WT := '\033[0;37m' # White
|
|
45
|
+
BWT := '\033[1;37m' # Light White
|
|
46
|
+
NC := '\033[0m'
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import './base.justfile'
|
|
2
|
+
set positional-arguments := true
|
|
3
|
+
|
|
4
|
+
# just --list
|
|
5
|
+
[private]
|
|
6
|
+
default:
|
|
7
|
+
@just --list --unsorted --list-heading $'UV development workflow commands:\n'
|
|
8
|
+
|
|
9
|
+
# 'uv run' pass thru command
|
|
10
|
+
uv *args:
|
|
11
|
+
@uv run "$@"
|
|
12
|
+
|
|
13
|
+
# pass thru
|
|
14
|
+
pass *args:
|
|
15
|
+
{{args}}
|
|
16
|
+
|
|
17
|
+
# ptpython REPL in uv environment
|
|
18
|
+
repl:
|
|
19
|
+
@uv run ptpython
|
|
20
|
+
|
|
21
|
+
# instructions to bump version number
|
|
22
|
+
bump level="patch":
|
|
23
|
+
@echo
|
|
24
|
+
@echo " {{BCY}}Bumping version with {{YW}}uv version --bump [patch|minor|major]{{NC}}"
|
|
25
|
+
@echo
|
|
26
|
+
@uv version --bump {{ level }}
|
|
27
|
+
|
|
28
|
+
# pytest
|
|
29
|
+
test *args:
|
|
30
|
+
@echo
|
|
31
|
+
@echo " ✙✙✙✙✙✙✙✙ TESTING ✙✙✙✙✙✙✙✙"
|
|
32
|
+
uv sync --all-extras
|
|
33
|
+
uv run pytest --disable-warnings --verbose {{args}}
|
|
34
|
+
|
|
35
|
+
# INFO: develop, build, deploy
|
|
36
|
+
info:
|
|
37
|
+
@echo
|
|
38
|
+
@echo " {{BCY}}Workflow to develop python scripts and deploy via uv tool{{NC}}"
|
|
39
|
+
@echo
|
|
40
|
+
@echo " {{CY}}1.{{NC}} Develop/commit on dev"
|
|
41
|
+
@echo " {{CY}}2.{{NC}} just test"
|
|
42
|
+
@echo " {{CY}}3.{{NC}} just bump"
|
|
43
|
+
@echo " {{CY}}4.{{NC}} git checkout -b release/x.y.z"
|
|
44
|
+
@echo " {{CY}}*{{NC}} final TESTS and debug"
|
|
45
|
+
@echo " {{CY}}*{{NC}} git push --set-upstream origin release/x.y.z"
|
|
46
|
+
@echo " {{CY}}*{{NC}} PR 'release/x.y.z' for CI/CD tests (click link to open PR)"
|
|
47
|
+
@echo " {{CY}}*{{NC}} debug GHA tests"
|
|
48
|
+
@echo " {{CY}}*{{NC}} GHA-bot auto-merge to main and tag"
|
|
49
|
+
@echo " {{CY}}5.{{NC}} Publish to PyPI: uv publish"
|
|
50
|
+
@echo " {{CY}}6.{{NC}} Install globally: uv tool install desertislandutils"
|
|
51
|
+
@echo " {{CY}}7.{{NC}} git delete that release branch or maybe GHA does for you"
|
|
52
|
+
@echo
|
|
53
|
+
@echo " {{BCY}}Running utils in uv environment{{NC}}"
|
|
54
|
+
@echo
|
|
55
|
+
@echo " {{GR}}just uv wn"
|
|
56
|
+
@echo " {{GR}}just uv wn --help"
|
|
57
|
+
@echo " {{GR}}just uv too --help"
|
|
58
|
+
@echo
|
|
59
|
+
|
|
60
|
+
# sync dependencies
|
|
61
|
+
sync:
|
|
62
|
+
uv sync
|
|
63
|
+
|
|
64
|
+
# sync with dev and test dependencies
|
|
65
|
+
sync-all:
|
|
66
|
+
uv sync --all-extras
|
|
67
|
+
|
|
68
|
+
# build package
|
|
69
|
+
build:
|
|
70
|
+
uv build
|
|
71
|
+
|
|
72
|
+
# install as global tool (from local source)
|
|
73
|
+
install-local:
|
|
74
|
+
uv tool install --editable .
|
|
75
|
+
|
|
76
|
+
# uninstall global tool
|
|
77
|
+
uninstall:
|
|
78
|
+
uv tool uninstall desertislandutils
|