Skip to content

Commit

Permalink
WN working right with Typer, tests are good now, bug was fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mahiki committed Jul 21, 2024
1 parent c6818dd commit 9c3e470
Show file tree
Hide file tree
Showing 6 changed files with 309 additions and 135 deletions.
35 changes: 29 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# desertislandutils
Refactoring my convenience utility bash scripts into python for learning and profit.
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!

* build: poetry
* deploy: poetry -> pypi -> homebew
* github CI actions
## INSTALL
brew install mahiki/tap/desertislandutils

## SCRIPTS
## THE UTILS
### toobigdatadoc
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.

Expand Down Expand Up @@ -53,4 +52,28 @@ wn --help
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
│ --help Show this message and exit. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```
```

----------
## DEVELOPMENT
>Trying to automate the merge tag homebrew tap repo upgrade thing. Its not going great.
* build: poetry
* deploy: poetry -> pypi -> homebrew
* github CI actions

### JUSTFILE
>Best documentation is in the Just taskrunner `justfile`.
```sh
just info

just wn --help

# also direct into poetry environment
poetry shell
(desertislandutils)> wn --help
```

### Testing
just test
73 changes: 37 additions & 36 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,48 +1,31 @@
home_dir := `echo "$HOME"`
export DOCKER_HOST := home_dir/".rd/docker.sock"
import '~/.config/just-systems/base.justfile'
set positional-arguments := true

# just --list
[private]
default:
@just --list --unsorted
@just --list --unsorted --list-heading $'Poetry development workflow commands:\n'

# poetry pass thru command
po *args:
poetry run {{args}}
@poetry run "$@"

# pass thru
blank *args:
pass *args:
{{args}}

# INFO: develop, build, deploy
info:
@echo
@echo " {{LC}}Workflow to develop python scripts and deploy to homebrew.{{LG}}"
@echo
@echo " {{LG}}1.{{NC}} Develop/commit on dev"
@echo " {{LG}}2.{{NC}} just test"
@echo " {{LG}}3.{{NC}} just bump"
@echo " {{LG}}4.{{NC}} git checkout -b release/0.3.1"
@echo " * final TESTS and debug"
@echo " * git push --set-upstream origin release/0.3.1"
@echo " * PR 'release/0.3.1' for CI/CD tests (click link to open PR)"
@echo " * debug GHA tests"
@echo " * GHA-bot auto-merge to main and tag"
@echo " {{LG}}5.{{RD}} TODO:{{NC}} release to homebrew repo on merge to main"
@echo


# ptpython REPL in poetry shell
repl:
@poetry run ptpython

# instructions to bump version number
bump:
@echo
@echo " {{LC}}REMINDER:{{NC}} You need to manually bump the version numbers in these locations."
@echo " {{BCY}}REMINDER:{{NC}} You need to manually bump the version numbers in these locations."
@echo " ./desertislandutils/"
@echo " {{YW}}__init__.py"
@echo " pyproject.toml"
@echo " tests/test_desertislandutils.py"
@echo " tests/test_desertislandutils.py{{NC}}"
code __init__.py pyproject.toml tests/test_desertislandutils.py

# pytest
Expand All @@ -51,14 +34,32 @@ test *args:
@echo " ✙✙✙✙✙✙✙✙ TESTING ✙✙✙✙✙✙✙✙"
poetry run pytest --disable-warnings --verbose {{args}}

# act github actions runner
act *args:
act --container-architecture linux/amd64 {{args}}

# colors for output
YW := '\033[0;33m'
RD := '\033[0;31m'
LC := '\033[0;36m'
LB := '\033[0;34m'
LG := '\033[0;32m'
NC := '\033[0m'
# INFO: develop, build, deploy
info:
@echo
@echo " {{BCY}}Workflow to develop python scripts and deploy to homebrew{{NC}}"
@echo
@echo " {{CY}}1.{{NC}} Develop/commit on dev"
@echo " {{CY}}2.{{NC}} just test"
@echo " {{CY}}3.{{NC}} just bump"
@echo " {{CY}}4.{{NC}} git checkout -b release/0.3.1"
@echo " {{CY}}*{{NC}} final TESTS and debug"
@echo " {{CY}}*{{NC}} git push --set-upstream origin release/0.3.1"
@echo " {{CY}}*{{NC}} PR 'release/0.3.1' for CI/CD tests (click link to open PR)"
@echo " {{CY}}*{{NC}} debug GHA tests"
@echo " {{CY}}*{{NC}} GHA-bot auto-merge to main and tag"
@echo " {{CY}}5.{{RD}} TODO:{{NC}} release to homebrew repo on merge to main"
@echo " {{CY}}6.{{NC}} git delete that release branch or maybe GHA does for you"
@echo
@echo " {{BCY}}Running utils in poetry environment{{NC}}"
@echo
@echo " {{GR}}just po wn"
@echo " {{GR}}just po wn --help"
@echo " {{GR}}just po too --help"
@echo " {{GR}}just po too --help"
@echo
@echo " {{BBK}}# or directly from poetry shell:{{NC}}"
@echo " {{GR}}poetry shell"
@echo " {{BGR}}wn --help"
@echo

Loading

0 comments on commit 9c3e470

Please sign in to comment.