From 1e067f9b8a1ff32dd6415eb8c48b6558ab48d03c Mon Sep 17 00:00:00 2001 From: mahiki Date: Sat, 9 Dec 2023 15:57:53 -0800 Subject: [PATCH 01/17] push to workflows direct in main --- .github/workflows/main.yml | 16 +++++++++------- .github/workflows/release.yml | 12 +++++++----- .github/workflows/test.yml | 3 +-- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 255f01e..6f4c3d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,12 @@ jobs: git branch --list git log --graph -n10 --pretty=format:'%h %as %cn %x09%s %d' + - name: Merge back to dev + run: | + git checkout dev + git merge --no-ff main + git push origin dev + - name: Merge the latest release commit run: | echo "release_tag_name: $release_tag_name" @@ -51,7 +57,6 @@ jobs: # required to initialise branch visibility git checkout "$RELEASE_BRANCH" git checkout main - git branch --list git merge --no-ff "$RELEASE_BRANCH" git push origin main git tag --annotate "$release_tag_name" -m "release $release_tag_name" @@ -59,14 +64,11 @@ jobs: echo "++++++++++++++++++++++++++++++++++++++++++++++++++++" git log --graph --all -n10 --pretty=format:'%h %as %cn %x09%s %d' - - - name: Merge back to dev + + - name: run: | - git checkout dev - git merge --no-ff main - git push origin dev - echo "RELEASE AND DEV MERGED" echo "YOU CAN DELETE RELEASE BRANCH: $RELEASE_BRANCH" + echo "RELEASE AND DEV MERGED" on-failure: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 513a737..c3517c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,12 @@ name: Release desertislandutils on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - + workflow_run: + workflows: [Merge Release Branch and Tag] + types: [completed] + branches: + - 'main' + jobs: release: runs-on: ubuntu-latest @@ -23,7 +25,7 @@ jobs: git branch --list git log --oneline --tags -n10 --pretty=format:'%h %as %cn %x09%s %d' echo - echo "current tag is ${{ github.ref_name }}" + echo "current ref is ${{ github.ref_name }}" - name: Build poetry distribution run: poetry build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51d3389..a815a86 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,8 +3,7 @@ name: Test desertislandutils on: push: branches: - - 'dev' - - 'main' + - '**' paths-ignore: - '**.md' pull_request: From c8b7947d382dc261f30306fe7dbe7586876645fb Mon Sep 17 00:00:00 2001 From: mahiki Date: Sat, 9 Dec 2023 15:59:32 -0800 Subject: [PATCH 02/17] release 0.3.8: tag match no work; back to workflow dependency --- __init__.py | 2 +- pyproject.toml | 2 +- tests/test_desertislandutils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index d93912e..17a3314 100644 --- a/__init__.py +++ b/__init__.py @@ -1 +1 @@ -__version__ = '0.3.7' +__version__ = '0.3.8' diff --git a/pyproject.toml b/pyproject.toml index a7abc65..83eb9e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "desertislandutils" -version = "0.3.7" +version = "0.3.8" description = "A collection of personal convenience utilities" authors = ["mahiki "] license = "MIT" diff --git a/tests/test_desertislandutils.py b/tests/test_desertislandutils.py index 997afce..957a02c 100644 --- a/tests/test_desertislandutils.py +++ b/tests/test_desertislandutils.py @@ -3,4 +3,4 @@ def test_version(): # I don't know why I'm testing this but at least the import worked in pytest - assert __version__ == '0.3.7' + assert __version__ == '0.3.8' From 140f6d5dd6ae3b1fa75cc689ee43e9c3ff8fc68d Mon Sep 17 00:00:00 2001 From: mahiki Date: Sat, 9 Dec 2023 16:10:06 -0800 Subject: [PATCH 03/17] release flow cant find tag --- .github/workflows/main.yml | 7 ++----- .github/workflows/release.yml | 6 ++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f4c3d5..9f3f757 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,18 +11,15 @@ env: RELEASE_BRANCH: ${{ github.event.workflow_run.head_branch }} jobs: - print-branch-vars: + merge-and-tag: runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Show workspace contexts run: | echo "head branch of trigger run: ${{ github.event.workflow_run.head_branch }}" echo "shell RELEASE_BRANCH: $RELEASE_BRANCH" - merge-and-tag: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - name: 'Checkout the whole repo' uses: actions/checkout@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3517c4..67399bf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,8 +10,11 @@ on: jobs: release: runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-python@v4 with: python-version: '3.11' @@ -26,6 +29,8 @@ jobs: git log --oneline --tags -n10 --pretty=format:'%h %as %cn %x09%s %d' echo echo "current ref is ${{ github.ref_name }}" + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + git checkout $LATEST_TAG - name: Build poetry distribution run: poetry build @@ -35,3 +40,4 @@ jobs: with: artifacts: "dist/*" generateReleaseNotes: true + tag: $LATEST_TAG From 4dac0e43221f4ccd4012b5c61d9505cd0c672495 Mon Sep 17 00:00:00 2001 From: mahiki Date: Sat, 9 Dec 2023 16:11:53 -0800 Subject: [PATCH 04/17] release flow cant find tag --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67399bf..2bdbe0c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,10 +30,12 @@ jobs: echo echo "current ref is ${{ github.ref_name }}" LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) - git checkout $LATEST_TAG + echo "latest tag: $LATEST_TAG" - name: Build poetry distribution - run: poetry build + run: | + git checkout $LATEST_TAG + poetry build - name: Create release from tag uses: ncipollo/release-action@v1 From eecf7c4be88c81be5d10a18ea518e950b0efbd45 Mon Sep 17 00:00:00 2001 From: mahiki Date: Sat, 9 Dec 2023 16:12:53 -0800 Subject: [PATCH 05/17] release 0.3.8: this is the time it works --- __init__.py | 2 +- pyproject.toml | 2 +- tests/test_desertislandutils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index 17a3314..6a49b24 100644 --- a/__init__.py +++ b/__init__.py @@ -1 +1 @@ -__version__ = '0.3.8' +__version__ = '0.3.9' diff --git a/pyproject.toml b/pyproject.toml index 83eb9e6..5d7808a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "desertislandutils" -version = "0.3.8" +version = "0.3.9" description = "A collection of personal convenience utilities" authors = ["mahiki "] license = "MIT" diff --git a/tests/test_desertislandutils.py b/tests/test_desertislandutils.py index 957a02c..ec39ed5 100644 --- a/tests/test_desertislandutils.py +++ b/tests/test_desertislandutils.py @@ -3,4 +3,4 @@ def test_version(): # I don't know why I'm testing this but at least the import worked in pytest - assert __version__ == '0.3.8' + assert __version__ == '0.3.9' From c6818ddc0317d86cb583fd3ace1cc5bf2f750f77 Mon Sep 17 00:00:00 2001 From: mahiki Date: Sat, 11 May 2024 19:29:10 -0700 Subject: [PATCH 06/17] committing much later in the middle of work --- .github/workflows/GHA.actions-handy.yml | 30 +++++++++++++++++-------- .github/workflows/release.yml | 2 ++ .github/workflows/test.yml | 18 ++++++++++++++- justfile | 20 ++++++++++++----- notes/CICD-notes.md | 27 ++++++++++++++++++++++ 5 files changed, 81 insertions(+), 16 deletions(-) diff --git a/.github/workflows/GHA.actions-handy.yml b/.github/workflows/GHA.actions-handy.yml index ba58b02..32544d1 100644 --- a/.github/workflows/GHA.actions-handy.yml +++ b/.github/workflows/GHA.actions-handy.yml @@ -29,15 +29,27 @@ jobs: just-macos-things: runs-on: macos-latest steps: - - name: some basic items - run: | - printf "github.event_name: %s\n" '${{ github.event_name }}' - printf "runner.os: %s\n" '${{ runner.os }}' - printf "github.ref (branch): %s\n" '${{ github.ref }}' - printf "github.repository: %s\n" '${{ github.repository }}' - printf "github workspace: %s\n" '${{ github.workspace }}' - printf "github branch/tag name: %s\n" '${{ github.ref_name }}' - printf "github branch/tag name from env var: %s\n" "$GITHUB_REF_NAME" + - name: Get latest tag + id: get_tag + run: echo ::set-output name=tag::$(git describe --tags --abbrev=0) + + - name: Get latest tag + id: get_tag + run: | + "tag=$(git describe --tags --abbrev=0)" + echo "tag=${tag}" >> $GITHUB_OUTPUT + + - name: some basic items + run: | + printf "github.event_name: %s\n" '${{ github.event_name }}' + printf "runner.os: %s\n" '${{ runner.os }}' + printf "github.ref (branch): %s\n" '${{ github.ref }}' + printf "github.repository: %s\n" '${{ github.repository }}' + printf "github workspace: %s\n" '${{ github.workspace }}' + printf "github branch/tag name: %s\n" '${{ github.ref_name }}' + printf "github branch/tag name from env var: %s\n" "$GITHUB_REF_NAME" + printf "latest tag name: %s\n" "${{ steps.get_tag.outputs.tag }}" + ubuntu-town: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2bdbe0c..aeb7070 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,8 @@ jobs: pipx install --python $(which python) poetry poetry install poetry show --latest + + - name: Get latest tag - run: | git branch --list git log --oneline --tags -n10 --pretty=format:'%h %as %cn %x09%s %d' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a815a86..a46a6dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,9 +46,25 @@ jobs: - run: | echo "REMINDER: Warnings are disabled" + - name: Get latest tag + id: get_tag + run: | + latest_tag=$(git describe --tags --abbrev=0)" + echo "latest_tag="${latest_tag}" >> $GITHUB_OUTPUT + + - name: Get Poetry application version + id: app_version + run: | + poetry_app_version="$(poetry version --short)" + echo "poetry_app_version="v${poetry_app_version}" >> $GITHUB_OUTPUT + - name: Print some workflow contexts run: | echo "workflow: ${{ github.workflow }}" echo "job_id: ${{ github.job }}" echo "job status: ${{ job.status }}" - echo "commit tag name: ${{ github.ref_name }}" + echo "commit ref name: ${{ github.ref_name }}" + echo "branch name: ${{ github.ref }} + echo "latest tag: ${{ steps.get_tag.outputs.latest_tag }}" + echo "poetry app version: ${{ steps.app_version.outputs.poetry_app_version }}" + \ No newline at end of file diff --git a/justfile b/justfile index 0632d1a..569545e 100644 --- a/justfile +++ b/justfile @@ -1,9 +1,5 @@ -YW := '\033[0;33m' -RD := '\033[0;31m' -LC := '\033[0;36m' -LB := '\033[0;34m' -LG := '\033[0;32m' -NC := '\033[0m' +home_dir := `echo "$HOME"` +export DOCKER_HOST := home_dir/".rd/docker.sock" # just --list default: @@ -54,3 +50,15 @@ test *args: @echo @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' diff --git a/notes/CICD-notes.md b/notes/CICD-notes.md index e1c8f2c..66a9e2f 100644 --- a/notes/CICD-notes.md +++ b/notes/CICD-notes.md @@ -65,3 +65,30 @@ jobs: ## OPTIONAL ADDITIONS Prerelease actions are available with examples of various approaches. [marvinpinto/actions release](https://github.com/marvinpinto/action-automatic-releases) + + +### ACT local github actions runner +Justfile is keeping the docker host and container arch flag. +UGH. Problems with sockets, not macos images.... hopeless. + +```sh +brew install act +# using Rancher Desktop in dockerd mode +export DOCKER_HOST=$HOME/.rd/docker.sock + +act --container-architecture linux/amd64 -l +# Stage Job ID Job name Workflow name Workflow file Events +# 0 ubuntu-town ubuntu-town GHA Handy Workflow Reference GHA.actions-handy.yml push,workflow_dispatch +# 0 official-actions-usage official-actions-usage GHA Handy Workflow Reference GHA.actions-handy.yml push,workflow_dispatch +# 0 just-macos-things just-macos-things GHA Handy Workflow Reference GHA.actions-handy.yml push,workflow_dispatch +# 0 on-failure on-failure Merge Release Branch and Tag main.yml workflow_run +# 0 merge-and-tag merge-and-tag Merge Release Branch and Tag main.yml workflow_run +# 0 release release Release desertislandutils release.yml workflow_run +# 0 poetry-run-tests poetry-run-tests Test desertislandutils test.yml push,pull_request,workflow_dispatch + +act --container-architecture linux/amd64 -j poetry-run-tests -P macos-latest=-self-hosted +# dang + +-P ubuntu-18.04=nektos/act-environments-ubuntu:18.04 + +``` \ No newline at end of file From 9c3e47075447abf89217bbcae2af03bc4b7094c9 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 00:05:39 +0200 Subject: [PATCH 07/17] WN working right with Typer, tests are good now, bug was fix --- README.md | 35 +++++++++-- justfile | 73 ++++++++++----------- poetry.lock | 132 ++++++++++++++++++++++++++++++-------- pyproject.toml | 2 +- src/weeknumber/wn.py | 55 +++++++++------- tests/wn/test_wn.py | 147 ++++++++++++++++++++++++++++++------------- 6 files changed, 309 insertions(+), 135 deletions(-) diff --git a/README.md b/README.md index 61585b7..a47f03d 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ -``` \ No newline at end of file +``` + +---------- +## 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 diff --git a/justfile b/justfile index 569545e..22f1b15 100644 --- a/justfile +++ b/justfile @@ -1,36 +1,19 @@ -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 @@ -38,11 +21,11 @@ repl: # 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 @@ -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 + diff --git a/poetry.lock b/poetry.lock index db0fb77..daeaa72 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "appdirs" @@ -197,22 +197,102 @@ files = [ [[package]] name = "pendulum" -version = "2.0.5" +version = "3.0.0" description = "Python datetimes made easy" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.8" files = [ - {file = "pendulum-2.0.5-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:c460f4d8dc41ec3c4377ac1807678cd72fe5e973cc2943c104ffdeaac32dacb7"}, - {file = "pendulum-2.0.5-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:57801754e05f30e8a7e4d24734c9fad82c6c3ec489151555f0fc66bb32ba6d6d"}, - {file = "pendulum-2.0.5-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:485aef2089defee88607d37d5bc238934d0b90993d7bf9ceb36e481af41e9c66"}, - {file = "pendulum-2.0.5-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:1cde6e3c6310fb882c98f373795f807cb2bd6af01f34d2857e6e283b5ee91e09"}, - {file = "pendulum-2.0.5-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:7ee344bc87cb425b04717b90d14ffde14c1dd64eaa73060b3772edcf57f3e866"}, - {file = "pendulum-2.0.5.tar.gz", hash = "sha256:d3078e007315a959989c41cee5cfd63cfeeca21dd3d8295f4bc24199489e9b6c"}, + {file = "pendulum-3.0.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:2cf9e53ef11668e07f73190c805dbdf07a1939c3298b78d5a9203a86775d1bfd"}, + {file = "pendulum-3.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fb551b9b5e6059377889d2d878d940fd0bbb80ae4810543db18e6f77b02c5ef6"}, + {file = "pendulum-3.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c58227ac260d5b01fc1025176d7b31858c9f62595737f350d22124a9a3ad82d"}, + {file = "pendulum-3.0.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:60fb6f415fea93a11c52578eaa10594568a6716602be8430b167eb0d730f3332"}, + {file = "pendulum-3.0.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b69f6b4dbcb86f2c2fe696ba991e67347bcf87fe601362a1aba6431454b46bde"}, + {file = "pendulum-3.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:138afa9c373ee450ede206db5a5e9004fd3011b3c6bbe1e57015395cd076a09f"}, + {file = "pendulum-3.0.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:83d9031f39c6da9677164241fd0d37fbfc9dc8ade7043b5d6d62f56e81af8ad2"}, + {file = "pendulum-3.0.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0c2308af4033fa534f089595bcd40a95a39988ce4059ccd3dc6acb9ef14ca44a"}, + {file = "pendulum-3.0.0-cp310-none-win_amd64.whl", hash = "sha256:9a59637cdb8462bdf2dbcb9d389518c0263799189d773ad5c11db6b13064fa79"}, + {file = "pendulum-3.0.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:3725245c0352c95d6ca297193192020d1b0c0f83d5ee6bb09964edc2b5a2d508"}, + {file = "pendulum-3.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6c035f03a3e565ed132927e2c1b691de0dbf4eb53b02a5a3c5a97e1a64e17bec"}, + {file = "pendulum-3.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:597e66e63cbd68dd6d58ac46cb7a92363d2088d37ccde2dae4332ef23e95cd00"}, + {file = "pendulum-3.0.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:99a0f8172e19f3f0c0e4ace0ad1595134d5243cf75985dc2233e8f9e8de263ca"}, + {file = "pendulum-3.0.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:77d8839e20f54706aed425bec82a83b4aec74db07f26acd039905d1237a5e1d4"}, + {file = "pendulum-3.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afde30e8146292b059020fbc8b6f8fd4a60ae7c5e6f0afef937bbb24880bdf01"}, + {file = "pendulum-3.0.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:660434a6fcf6303c4efd36713ca9212c753140107ee169a3fc6c49c4711c2a05"}, + {file = "pendulum-3.0.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:dee9e5a48c6999dc1106eb7eea3e3a50e98a50651b72c08a87ee2154e544b33e"}, + {file = "pendulum-3.0.0-cp311-none-win_amd64.whl", hash = "sha256:d4cdecde90aec2d67cebe4042fd2a87a4441cc02152ed7ed8fb3ebb110b94ec4"}, + {file = "pendulum-3.0.0-cp311-none-win_arm64.whl", hash = "sha256:773c3bc4ddda2dda9f1b9d51fe06762f9200f3293d75c4660c19b2614b991d83"}, + {file = "pendulum-3.0.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:409e64e41418c49f973d43a28afe5df1df4f1dd87c41c7c90f1a63f61ae0f1f7"}, + {file = "pendulum-3.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a38ad2121c5ec7c4c190c7334e789c3b4624798859156b138fcc4d92295835dc"}, + {file = "pendulum-3.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fde4d0b2024b9785f66b7f30ed59281bd60d63d9213cda0eb0910ead777f6d37"}, + {file = "pendulum-3.0.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4b2c5675769fb6d4c11238132962939b960fcb365436b6d623c5864287faa319"}, + {file = "pendulum-3.0.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8af95e03e066826f0f4c65811cbee1b3123d4a45a1c3a2b4fc23c4b0dff893b5"}, + {file = "pendulum-3.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2165a8f33cb15e06c67070b8afc87a62b85c5a273e3aaa6bc9d15c93a4920d6f"}, + {file = "pendulum-3.0.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:ad5e65b874b5e56bd942546ea7ba9dd1d6a25121db1c517700f1c9de91b28518"}, + {file = "pendulum-3.0.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:17fe4b2c844bbf5f0ece69cfd959fa02957c61317b2161763950d88fed8e13b9"}, + {file = "pendulum-3.0.0-cp312-none-win_amd64.whl", hash = "sha256:78f8f4e7efe5066aca24a7a57511b9c2119f5c2b5eb81c46ff9222ce11e0a7a5"}, + {file = "pendulum-3.0.0-cp312-none-win_arm64.whl", hash = "sha256:28f49d8d1e32aae9c284a90b6bb3873eee15ec6e1d9042edd611b22a94ac462f"}, + {file = "pendulum-3.0.0-cp37-cp37m-macosx_10_12_x86_64.whl", hash = "sha256:d4e2512f4e1a4670284a153b214db9719eb5d14ac55ada5b76cbdb8c5c00399d"}, + {file = "pendulum-3.0.0-cp37-cp37m-macosx_11_0_arm64.whl", hash = "sha256:3d897eb50883cc58d9b92f6405245f84b9286cd2de6e8694cb9ea5cb15195a32"}, + {file = "pendulum-3.0.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e169cc2ca419517f397811bbe4589cf3cd13fca6dc38bb352ba15ea90739ebb"}, + {file = "pendulum-3.0.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f17c3084a4524ebefd9255513692f7e7360e23c8853dc6f10c64cc184e1217ab"}, + {file = "pendulum-3.0.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:826d6e258052715f64d05ae0fc9040c0151e6a87aae7c109ba9a0ed930ce4000"}, + {file = "pendulum-3.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2aae97087872ef152a0c40e06100b3665d8cb86b59bc8471ca7c26132fccd0f"}, + {file = "pendulum-3.0.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:ac65eeec2250d03106b5e81284ad47f0d417ca299a45e89ccc69e36130ca8bc7"}, + {file = "pendulum-3.0.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:a5346d08f3f4a6e9e672187faa179c7bf9227897081d7121866358af369f44f9"}, + {file = "pendulum-3.0.0-cp37-none-win_amd64.whl", hash = "sha256:235d64e87946d8f95c796af34818c76e0f88c94d624c268693c85b723b698aa9"}, + {file = "pendulum-3.0.0-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:6a881d9c2a7f85bc9adafcfe671df5207f51f5715ae61f5d838b77a1356e8b7b"}, + {file = "pendulum-3.0.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:d7762d2076b9b1cb718a6631ad6c16c23fc3fac76cbb8c454e81e80be98daa34"}, + {file = "pendulum-3.0.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e8e36a8130819d97a479a0e7bf379b66b3b1b520e5dc46bd7eb14634338df8c"}, + {file = "pendulum-3.0.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7dc843253ac373358ffc0711960e2dd5b94ab67530a3e204d85c6e8cb2c5fa10"}, + {file = "pendulum-3.0.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0a78ad3635d609ceb1e97d6aedef6a6a6f93433ddb2312888e668365908c7120"}, + {file = "pendulum-3.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b30a137e9e0d1f751e60e67d11fc67781a572db76b2296f7b4d44554761049d6"}, + {file = "pendulum-3.0.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:c95984037987f4a457bb760455d9ca80467be792236b69d0084f228a8ada0162"}, + {file = "pendulum-3.0.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d29c6e578fe0f893766c0d286adbf0b3c726a4e2341eba0917ec79c50274ec16"}, + {file = "pendulum-3.0.0-cp38-none-win_amd64.whl", hash = "sha256:deaba8e16dbfcb3d7a6b5fabdd5a38b7c982809567479987b9c89572df62e027"}, + {file = "pendulum-3.0.0-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:b11aceea5b20b4b5382962b321dbc354af0defe35daa84e9ff3aae3c230df694"}, + {file = "pendulum-3.0.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a90d4d504e82ad236afac9adca4d6a19e4865f717034fc69bafb112c320dcc8f"}, + {file = "pendulum-3.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:825799c6b66e3734227756fa746cc34b3549c48693325b8b9f823cb7d21b19ac"}, + {file = "pendulum-3.0.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ad769e98dc07972e24afe0cff8d365cb6f0ebc7e65620aa1976fcfbcadc4c6f3"}, + {file = "pendulum-3.0.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a6fc26907eb5fb8cc6188cc620bc2075a6c534d981a2f045daa5f79dfe50d512"}, + {file = "pendulum-3.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c717eab1b6d898c00a3e0fa7781d615b5c5136bbd40abe82be100bb06df7a56"}, + {file = "pendulum-3.0.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:3ddd1d66d1a714ce43acfe337190be055cdc221d911fc886d5a3aae28e14b76d"}, + {file = "pendulum-3.0.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:822172853d7a9cf6da95d7b66a16c7160cb99ae6df55d44373888181d7a06edc"}, + {file = "pendulum-3.0.0-cp39-none-win_amd64.whl", hash = "sha256:840de1b49cf1ec54c225a2a6f4f0784d50bd47f68e41dc005b7f67c7d5b5f3ae"}, + {file = "pendulum-3.0.0-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:3b1f74d1e6ffe5d01d6023870e2ce5c2191486928823196f8575dcc786e107b1"}, + {file = "pendulum-3.0.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:729e9f93756a2cdfa77d0fc82068346e9731c7e884097160603872686e570f07"}, + {file = "pendulum-3.0.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e586acc0b450cd21cbf0db6bae386237011b75260a3adceddc4be15334689a9a"}, + {file = "pendulum-3.0.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22e7944ffc1f0099a79ff468ee9630c73f8c7835cd76fdb57ef7320e6a409df4"}, + {file = "pendulum-3.0.0-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:fa30af36bd8e50686846bdace37cf6707bdd044e5cb6e1109acbad3277232e04"}, + {file = "pendulum-3.0.0-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:440215347b11914ae707981b9a57ab9c7b6983ab0babde07063c6ee75c0dc6e7"}, + {file = "pendulum-3.0.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:314c4038dc5e6a52991570f50edb2f08c339debdf8cea68ac355b32c4174e820"}, + {file = "pendulum-3.0.0-pp37-pypy37_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5acb1d386337415f74f4d1955c4ce8d0201978c162927d07df8eb0692b2d8533"}, + {file = "pendulum-3.0.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a789e12fbdefaffb7b8ac67f9d8f22ba17a3050ceaaa635cd1cc4645773a4b1e"}, + {file = "pendulum-3.0.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:860aa9b8a888e5913bd70d819306749e5eb488e6b99cd6c47beb701b22bdecf5"}, + {file = "pendulum-3.0.0-pp37-pypy37_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:5ebc65ea033ef0281368217fbf59f5cb05b338ac4dd23d60959c7afcd79a60a0"}, + {file = "pendulum-3.0.0-pp37-pypy37_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:d9fef18ab0386ef6a9ac7bad7e43ded42c83ff7ad412f950633854f90d59afa8"}, + {file = "pendulum-3.0.0-pp38-pypy38_pp73-macosx_10_12_x86_64.whl", hash = "sha256:1c134ba2f0571d0b68b83f6972e2307a55a5a849e7dac8505c715c531d2a8795"}, + {file = "pendulum-3.0.0-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:385680812e7e18af200bb9b4a49777418c32422d05ad5a8eb85144c4a285907b"}, + {file = "pendulum-3.0.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9eec91cd87c59fb32ec49eb722f375bd58f4be790cae11c1b70fac3ee4f00da0"}, + {file = "pendulum-3.0.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4386bffeca23c4b69ad50a36211f75b35a4deb6210bdca112ac3043deb7e494a"}, + {file = "pendulum-3.0.0-pp38-pypy38_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:dfbcf1661d7146d7698da4b86e7f04814221081e9fe154183e34f4c5f5fa3bf8"}, + {file = "pendulum-3.0.0-pp38-pypy38_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:04a1094a5aa1daa34a6b57c865b25f691848c61583fb22722a4df5699f6bf74c"}, + {file = "pendulum-3.0.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:5b0ec85b9045bd49dd3a3493a5e7ddfd31c36a2a60da387c419fa04abcaecb23"}, + {file = "pendulum-3.0.0-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:0a15b90129765b705eb2039062a6daf4d22c4e28d1a54fa260892e8c3ae6e157"}, + {file = "pendulum-3.0.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:bb8f6d7acd67a67d6fedd361ad2958ff0539445ef51cbe8cd288db4306503cd0"}, + {file = "pendulum-3.0.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fd69b15374bef7e4b4440612915315cc42e8575fcda2a3d7586a0d88192d0c88"}, + {file = "pendulum-3.0.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc00f8110db6898360c53c812872662e077eaf9c75515d53ecc65d886eec209a"}, + {file = "pendulum-3.0.0-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:83a44e8b40655d0ba565a5c3d1365d27e3e6778ae2a05b69124db9e471255c4a"}, + {file = "pendulum-3.0.0-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:1a3604e9fbc06b788041b2a8b78f75c243021e0f512447806a6d37ee5214905d"}, + {file = "pendulum-3.0.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:92c307ae7accebd06cbae4729f0ba9fa724df5f7d91a0964b1b972a22baa482b"}, + {file = "pendulum-3.0.0.tar.gz", hash = "sha256:5d034998dea404ec31fae27af6b22cff1708f830a1ed7353be4d1019bb9f584e"}, ] [package.dependencies] -python-dateutil = ">=2.6,<3.0" -pytzdata = ">=2018.3" +python-dateutil = ">=2.6" +tzdata = ">=2020.1" + +[package.extras] +test = ["time-machine (>=2.6.0)"] [[package]] name = "pluggy" @@ -301,29 +381,18 @@ testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2. [[package]] name = "python-dateutil" -version = "2.8.2" +version = "2.9.0.post0" description = "Extensions to the standard Python datetime module" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ - {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, - {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, + {file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"}, + {file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"}, ] [package.dependencies] six = ">=1.5" -[[package]] -name = "pytzdata" -version = "2020.1" -description = "The Olson timezone database for Python." -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -files = [ - {file = "pytzdata-2020.1-py2.py3-none-any.whl", hash = "sha256:e1e14750bcf95016381e4d472bad004eef710f2d6417240904070b3d6654485f"}, - {file = "pytzdata-2020.1.tar.gz", hash = "sha256:3efa13b335a00a8de1d345ae41ec78dd11c9f8807f522d39850f2dd828681540"}, -] - [[package]] name = "rich" version = "13.7.0" @@ -410,6 +479,17 @@ files = [ {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, ] +[[package]] +name = "tzdata" +version = "2024.1" +description = "Provider of IANA time zone data" +optional = false +python-versions = ">=2" +files = [ + {file = "tzdata-2024.1-py2.py3-none-any.whl", hash = "sha256:9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252"}, + {file = "tzdata-2024.1.tar.gz", hash = "sha256:2674120f8d891909751c38abcdfd386ac0a5a1127954fbc332af6b5ceae07efd"}, +] + [[package]] name = "wcwidth" version = "0.2.6" @@ -424,4 +504,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "10e1acaba33291333a79e1cd9fc5ba3c1a7e5d05912379dbf1eebf133acfe106" +content-hash = "4c80d3cbdbfd8d69cefdcdf1907de9b694b50ae6322b24ecbfb172b17641213c" diff --git a/pyproject.toml b/pyproject.toml index 5d7808a..9cec285 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ python = "^3.11" argparse = "^1.4.0" GitPython = "^3.1.27" typer = {extras = ["all"], version = "^0.9.0"} -pendulum = "~2.0" +pendulum = "^3.0.0" [tool.poetry.group.dev.dependencies] ptpython = "^3.0.23" diff --git a/src/weeknumber/wn.py b/src/weeknumber/wn.py index c23c2fe..985567d 100644 --- a/src/weeknumber/wn.py +++ b/src/weeknumber/wn.py @@ -6,8 +6,8 @@ 2023-W48 """ -import os import pendulum +from pendulum.parsing.exceptions import ParserError import typer from typing_extensions import Annotated, Optional, List @@ -16,31 +16,48 @@ def input_date_validate(value: str): try: pendulum.parse(value, strict=False) - except Exception as ex: - raise typer.BadParameter(f"Unparseable date string: {value}, try YYYY-MM-DD format.") - # os._exit(0) + except ParserError as ex: + raise typer.BadParameter(f"{ex}, try YYYY-MM-DD format.") return value def today_datestring(): - return pendulum.now().strftime("%Y-%m-%d") + return pendulum.now().to_date_string() def week_number_string(date, sunday_weekend = False): if sunday_weekend: - return date.strftime("%Y-W%V") + return date.strftime("%G-W%V") else: - return date.add(days=1).strftime("%Y-W%V") + return date.add(days=1).strftime("%G-W%V") + +def verbose_output(date, parsed_date, sunday_weekend, last_week): + weekend_day = "Sunday" if sunday_weekend else "Saturday" + + if sunday_weekend: + weekend_date = parsed_date.add(days=-1).next(pendulum.SUNDAY) + else: + weekend_date = parsed_date.add(days=-1).next(pendulum.SATURDAY) + + if last_week: weekend_date = weekend_date.subtract(weeks=1) + + typer.echo(f"Input date string: {date}") + typer.echo(f"Timezone: {pendulum.now().timezone.name}") + typer.echo(f"Parsed date: {parsed_date.to_date_string()}") + typer.echo(f"Last week flag: {last_week}") + typer.echo(f"Week end day: {weekend_day}") + typer.echo(f"Week end date: {weekend_date.to_date_string()}") + @app.command() def main( date: Annotated[str , typer.Argument( callback=input_date_validate - , help="A text expression of date, ex: 'November 27', or 2112-07-29" + , help="A text expression of date, ex: 'November 27', or 2112-07-29. Default is today's in current TZ." , default_factory=today_datestring)] , sunday_weekend: Annotated[bool , typer.Option( "--sunday" - , help="Weekend is Saturday by default, this flag sets Sunday weekend day.")] = False + , help="Week end is Saturday by default, this flag sets Sunday weekend day (ISO standard).")] = False , last_week: Annotated[bool , typer.Option( "--last" @@ -48,22 +65,14 @@ def main( , verbose: bool = False ): """ - ISO year week number of a date as YYYY-WDD. Default weekend day is Sat. - - Example: - - $> wn 'Jul 22' - - 2023-W29 + ISO year week number of a date as YYYY-"W"WW. Default weekend day is Saturday.\n + Example:\n + $> wn 'Jul 22 2020' --last\n + 2020-W29 """ parsed_date = pendulum.parse(date, strict=False) - - if verbose: - typer.echo(f"Input date string: {date}") - typer.echo(f"Timezone: {pendulum.now().timezone.name}") - typer.echo(f"Parsed date: {parsed_date.strftime('%Y-%m-%d')}") - typer.echo("ISO week number:") - + if verbose: verbose_output(date, parsed_date, sunday_weekend, last_week) + if last_week: result = week_number_string(parsed_date.subtract(weeks=1), sunday_weekend=sunday_weekend) else: diff --git a/tests/wn/test_wn.py b/tests/wn/test_wn.py index 072d9af..1e86473 100644 --- a/tests/wn/test_wn.py +++ b/tests/wn/test_wn.py @@ -1,45 +1,106 @@ -import os, time -import pendulum from src.weeknumber.wn import main -TZ = pendulum.local_timezone().name - -def test_wn_options(capsys): - out1 = "2023-W48\n" - main("2023-11-29") - out, _ = capsys.readouterr() - assert out == "2023-W48\n" - - out2 = f"""Input date string: 2112-07-24 -Timezone: {TZ} -Parsed date: 2112-07-24 -ISO week number: -2112-W29\n""" - main("2112-07-24", sunday_weekend=True, verbose=True) - out, _ = capsys.readouterr() - assert out == out2 - - out3 = f"""Input date string: 2112-07-24 -Timezone: {TZ} -Parsed date: 2112-07-24 -ISO week number: -2112-W30\n""" - main("2112-07-24", sunday_weekend=False, verbose=True) - out, _ = capsys.readouterr() - assert out == out3 - - out4 = "2112-W30\n" - main("2112-07-24") - out, _ = capsys.readouterr() - assert out == out4 - - out5 = "2112-W29\n" - main("2112-07-24", last_week=True) - out, _ = capsys.readouterr() - assert out == out5 - - out6 = pendulum.now().subtract(weeks=1).strftime("%Y-W%V") - today = pendulum.now().strftime("%Y-%m-%d") - main(today, last_week=True) - out, _ = capsys.readouterr() - assert out == out6 + "\n" +calendarstring = """ +just for reference: + + December 2019 +Su Mo Tu We Th Fr Sa Sat Weekend + 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 +15 16 17 18 19 20 21 2019-W51 +22 23 24 25 26 27 28 2019-W52 +29 30 31 1 2 3 4 2020-W01 January 2020 + 5 6 7 8 9 10 11 2020-W02 + + December 2020 +Su Mo Tu We Th Fr Sa + 6 7 8 9 10 11 12 2020-W50 +13 14 15 16 17 18 19 2020-W51 +20 21 22 23 24 25 26 2020-W52 +27 28 29 30 31 1 2 2020-W53 January 2021 + 3 4 5 6 7 8 9 2021-W01 +10 11 12 13 14 15 16 2021-W02 +""" + +testcase_sat = { + '2020-12-18': '2020-W51' + , '2020-12-19': '2020-W51' + , '2020-12-20': '2020-W52' + , '2020-12-21': '2020-W52' + , '2020-12-22': '2020-W52' + , '2020-12-25': '2020-W52' + , '2020-12-26': '2020-W52' + , '2020-12-27': '2020-W53' + , '2020-12-28': '2020-W53' + , '2020-12-31': '2020-W53' + , '2021-01-01': '2020-W53' + , '2021-01-02': '2020-W53' + , '2021-01-03': '2021-W01' + , '2021-01-04': '2021-W01' + , '2021-01-05': '2021-W01' + , '2021-01-06': '2021-W01' + , '2021-01-07': '2021-W01' + , '2021-01-08': '2021-W01' + , '2021-01-09': '2021-W01' + , '2021-01-10': '2021-W02' + , '2021-01-11': '2021-W02' + } + +testcase_sun = { + '2020-12-18': '2020-W51' + , '2020-12-19': '2020-W51' + , '2020-12-20': '2020-W51' + , '2020-12-21': '2020-W52' + , '2020-12-22': '2020-W52' + , '2020-12-25': '2020-W52' + , '2020-12-26': '2020-W52' + , '2020-12-27': '2020-W52' + , '2020-12-28': '2020-W53' + , '2020-12-31': '2020-W53' + , '2021-01-01': '2020-W53' + , '2021-01-02': '2020-W53' + , '2021-01-03': '2020-W53' + , '2021-01-04': '2021-W01' + , '2021-01-05': '2021-W01' + , '2021-01-06': '2021-W01' + , '2021-01-07': '2021-W01' + , '2021-01-08': '2021-W01' + , '2021-01-09': '2021-W01' + , '2021-01-10': '2021-W01' + , '2021-01-11': '2021-W02' + , '2021-01-12': '2021-W02' + } + +testcase_last = { + '2019-12-27': '2019-W51' + , '2019-12-28': '2019-W51' + , '2019-12-29': '2019-W52' + , '2019-12-30': '2019-W52' + , '2019-12-31': '2019-W52' + , '2020-01-01': '2019-W52' + , '2020-01-02': '2019-W52' + , '2020-01-03': '2019-W52' + , '2020-01-04': '2019-W52' + , '2020-01-05': '2020-W01' + , '2020-01-06': '2020-W01' + , '2020-01-07': '2020-W01' + , '2020-01-08': '2020-W01' +} + +def test_week_numbers_sat(capsys): + for case in testcase_sat: + main(case) + out, _ = capsys.readouterr() + assert out == (testcase_sat[case] + '\n') + +def test_week_numbers_sun(capsys): + for case in testcase_sun: + main(case, sunday_weekend=True) + out, _ = capsys.readouterr() + assert out == (testcase_sun[case] + '\n') + +def test_week_numbers_last(capsys): + for case in testcase_last: + main(case, last_week = True) + out, _ = capsys.readouterr() + assert out == (testcase_last[case] + '\n') From 8b92e59b4154a89d36bff5d78957989859c4eed2 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 08:04:56 +0200 Subject: [PATCH 08/17] justfile improvements --- base.justfile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ justfile | 6 +++--- 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 base.justfile diff --git a/base.justfile b/base.justfile new file mode 100644 index 0000000..5f5a1a3 --- /dev/null +++ b/base.justfile @@ -0,0 +1,46 @@ +# Default justfile for import + +# just --list +[private] +ac3e01d: + @just --justfile base.justfile --list --unsorted --list-heading $'Default Justfile for Imports\n' + +# color code definitions for use in any justfile +[private] +colordefs: + @echo + @echo "{{BCY}}Terminal color code definitions included for use in any justfile{{NC}}" + @echo ' For example, {{{{BCY}} gives:' + @echo " {{BCY}}Bright Cyan{{NC}}" + @echo + +# show the color codes +colortest: + @echo " {{NC}}NC{{NC}}" + @echo " {{BK}}BK{{NC}} {{BL}}BL{{NC}}" + @echo " {{BBK}}BBK{{NC}} {{BBL}}BBL{{NC}}" + @echo " {{RD}}RD{{NC}} {{MG}}MG{{NC}}" + @echo " {{BRD}}BRD{{NC}} {{BMG}}BMG{{NC}}" + @echo " {{GR}}GR{{NC}} {{CY}}CY{{NC}}" + @echo " {{BGR}}BGR{{NC}} {{BCY}}BCY{{NC}}" + @echo " {{YW}}YW{{NC}} {{WT}}WT{{NC}}" + @echo " {{BYW}}BYW{{NC}} {{BWT}}BWT{{NC}}" + +# color decorations +BK := '\033[0;30m' # Black +BBK := '\033[1;30m' # Bright Gray +RD := '\033[0;31m' # Red +BRD := '\033[1;31m' # Bright Red +GR := '\033[0;32m' # Green +BGR := '\033[1;32m' # Bright Green +YW := '\033[0;33m' # Yellow +BYW := '\033[1;33m' # Bright Yellow +BL := '\033[0;34m' # Blue +BBL := '\033[1;34m' # Light Blue +MG := '\033[0;35m' # Magenta +BMG := '\033[1;35m' # Light Purple +CY := '\033[0;36m' # Cyan +BCY := '\033[1;36m' # Light Cyan +WT := '\033[0;37m' # White +BWT := '\033[1;37m' # Light White +NC := '\033[0m' diff --git a/justfile b/justfile index 569545e..4ec5d0d 100644 --- a/justfile +++ b/justfile @@ -1,11 +1,11 @@ -home_dir := `echo "$HOME"` -export DOCKER_HOST := home_dir/".rd/docker.sock" +import './base.justfile' +set positional-arguments := true # just --list default: @just --list --unsorted -# poetry pass thru command +# 'poetry run' pass thru command po *args: poetry run {{args}} From 474169e41c44052cbd36cf25cd530f7aa7691955 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 10:39:56 +0200 Subject: [PATCH 09/17] worflow/test debug shell commands --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a46a6dd..2d929dc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,14 +49,14 @@ jobs: - name: Get latest tag id: get_tag run: | - latest_tag=$(git describe --tags --abbrev=0)" - echo "latest_tag="${latest_tag}" >> $GITHUB_OUTPUT + latest_tag="$(git describe --tags --abbrev=0)" + echo latest_tag="${latest_tag}" >> $GITHUB_OUTPUT - name: Get Poetry application version id: app_version run: | poetry_app_version="$(poetry version --short)" - echo "poetry_app_version="v${poetry_app_version}" >> $GITHUB_OUTPUT + echo poetry_app_version="v${poetry_app_version}" >> $GITHUB_OUTPUT - name: Print some workflow contexts run: | From fc736bd21aaf046ef8811521f976a70dacc634e7 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 13:00:10 +0200 Subject: [PATCH 10/17] worflow/test debug shell commands --- .github/workflows/test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d929dc..81bc368 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,8 @@ name: Test desertislandutils +env: + ACTIONS_STEP_DEBUG: true + on: push: branches: @@ -11,7 +14,7 @@ on: - '**' paths-ignore: - '**.md' - + # NOTE: workflow_dispatch only work on main workflow_dispatch: inputs: @@ -49,7 +52,7 @@ jobs: - name: Get latest tag id: get_tag run: | - latest_tag="$(git describe --tags --abbrev=0)" + latest_tag="git ls-remote origin 'refs/tags/v*[0-9]'' | awk -F'refs/tags/' '{print $2}'" echo latest_tag="${latest_tag}" >> $GITHUB_OUTPUT - name: Get Poetry application version From 2ae56ccc0985d7802157c850ee30eb7d2a14b224 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 13:12:46 +0200 Subject: [PATCH 11/17] worflow/test debug shell commands --- .github/workflows/test.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 81bc368..4a5bb37 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,27 +41,31 @@ jobs: with: python-version: '3.11' - - run: python --version - - run: pipx install --python $(which python) poetry - - run: poetry install - - run: poetry show --latest - - run: poetry run pytest --disable-warnings --verbose - - run: | - echo "REMINDER: Warnings are disabled" + - name: Install Poetry + run: | + python --version + pipx install --python $(which python) poetry + poetry install + poetry show --latest + + - name: Poetry Run Pytest + run: | + poetry run pytest --disable-warnings --verbose + echo "WARNING: Pytest Warnings are disabled" - - name: Get latest tag + - name: Get Latest Tag id: get_tag run: | - latest_tag="git ls-remote origin 'refs/tags/v*[0-9]'' | awk -F'refs/tags/' '{print $2}'" + latest_tag="git ls-remote origin 'refs/tags/v*[0-9]' | awk -F'refs/tags/' '{print $2}'" echo latest_tag="${latest_tag}" >> $GITHUB_OUTPUT - - name: Get Poetry application version + - name: Get Poetry Version id: app_version run: | poetry_app_version="$(poetry version --short)" echo poetry_app_version="v${poetry_app_version}" >> $GITHUB_OUTPUT - - name: Print some workflow contexts + - name: REFERENCE - Variables and Workflow Contexts run: | echo "workflow: ${{ github.workflow }}" echo "job_id: ${{ github.job }}" From 6277947f7ca0102c6fac12233f0f757013869348 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 13:26:08 +0200 Subject: [PATCH 12/17] GHA shell commands and substitution are hell. almost there --- .github/workflows/test.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4a5bb37..82b09c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,8 +36,8 @@ jobs: poetry-run-tests: runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.11' @@ -56,10 +56,10 @@ jobs: - name: Get Latest Tag id: get_tag run: | - latest_tag="git ls-remote origin 'refs/tags/v*[0-9]' | awk -F'refs/tags/' '{print $2}'" + latest_tag="$(git ls-remote origin 'refs/tags/v*[0-9]' | awk -F'refs/tags/' '{print $2}')" echo latest_tag="${latest_tag}" >> $GITHUB_OUTPUT - - name: Get Poetry Version + - name: Get desertislandutils Version id: app_version run: | poetry_app_version="$(poetry version --short)" @@ -71,7 +71,6 @@ jobs: echo "job_id: ${{ github.job }}" echo "job status: ${{ job.status }}" echo "commit ref name: ${{ github.ref_name }}" - echo "branch name: ${{ github.ref }} + echo "branch name: ${{ github.ref }}" echo "latest tag: ${{ steps.get_tag.outputs.latest_tag }}" echo "poetry app version: ${{ steps.app_version.outputs.poetry_app_version }}" - \ No newline at end of file From b14e7663598e29ac145bd81677dc02d765680531 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 13:33:05 +0200 Subject: [PATCH 13/17] test.yaml almost done --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 82b09c0..d653632 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,7 @@ jobs: - name: Get Latest Tag id: get_tag run: | - latest_tag="$(git ls-remote origin 'refs/tags/v*[0-9]' | awk -F'refs/tags/' '{print $2}')" + latest_tag="$(git ls-remote origin 'refs/tags/v*[0-9]' | awk -F'refs/tags/' '{print $2}' | sort -V | tail -1)" echo latest_tag="${latest_tag}" >> $GITHUB_OUTPUT - name: Get desertislandutils Version From 70694b9c4533528bc53e8b11febd175b49a14158 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 17:16:07 +0200 Subject: [PATCH 14/17] GHA test is done, release errors fixing now --- .github/workflows/main.yml | 11 ++++++----- .github/workflows/release.yml | 36 +++++++++++++++++++++-------------- .github/workflows/test.yml | 1 + 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9f3f757..2f621e4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,9 @@ name: Merge Release Branch and Tag +env: + ACTIONS_STEP_DEBUG: true + RELEASE_BRANCH: ${{ github.event.workflow_run.head_branch }} + on: workflow_run: workflows: [Test desertislandutils] @@ -7,9 +11,6 @@ on: branches: - 'release/**' -env: - RELEASE_BRANCH: ${{ github.event.workflow_run.head_branch }} - jobs: merge-and-tag: runs-on: ubuntu-latest @@ -20,8 +21,8 @@ jobs: echo "head branch of trigger run: ${{ github.event.workflow_run.head_branch }}" echo "shell RELEASE_BRANCH: $RELEASE_BRANCH" - - name: 'Checkout the whole repo' - uses: actions/checkout@v3 + - name: Checkout the whole repo + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aeb7070..e60153e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,8 @@ name: Release desertislandutils +# create a release from the latest tag on MAIN or something + +env: + ACTIONS_STEP_DEBUG: true on: workflow_run: @@ -12,31 +16,35 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.11' - - run: python --version - - run: | - pipx install --python $(which python) poetry - poetry install - poetry show --latest + - name: Install Poetry + run: | + python --version + pipx install --python $(which python) poetry + poetry --version + poetry install + poetry show --latest - - name: Get latest tag - - run: | + - name: Get Gatest Tag + id: get_tag + run: | git branch --list git log --oneline --tags -n10 --pretty=format:'%h %as %cn %x09%s %d' echo echo "current ref is ${{ github.ref_name }}" - LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) - echo "latest tag: $LATEST_TAG" + latest_tag="$(git describe --tags --abbrev=0)" + echo "latest tag: ${latest_tag}" + echo latest_tag="${latest_tag}" >> $GITHUB_OUTPUT - - name: Build poetry distribution + - name: Build Poetry Distribution from Latest Tag run: | - git checkout $LATEST_TAG + git checkout ${{ steps.get_tag.outputs.latest_tag }}" poetry build - name: Create release from tag @@ -44,4 +52,4 @@ jobs: with: artifacts: "dist/*" generateReleaseNotes: true - tag: $LATEST_TAG + tag: ${{ steps.get_tag.outputs.latest_tag }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d653632..1577aa0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,6 +45,7 @@ jobs: run: | python --version pipx install --python $(which python) poetry + poetry --version poetry install poetry show --latest From 8da1de7104246eca744ce36f0ae54ad6b5b646b1 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 17:30:46 +0200 Subject: [PATCH 15/17] bumped version to 0.3.8 --- __init__.py | 2 +- pyproject.toml | 2 +- tests/test_desertislandutils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index 6a49b24..17a3314 100644 --- a/__init__.py +++ b/__init__.py @@ -1 +1 @@ -__version__ = '0.3.9' +__version__ = '0.3.8' diff --git a/pyproject.toml b/pyproject.toml index 9cec285..a56e264 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "desertislandutils" -version = "0.3.9" +version = "0.3.8" description = "A collection of personal convenience utilities" authors = ["mahiki "] license = "MIT" diff --git a/tests/test_desertislandutils.py b/tests/test_desertislandutils.py index ec39ed5..957a02c 100644 --- a/tests/test_desertislandutils.py +++ b/tests/test_desertislandutils.py @@ -3,4 +3,4 @@ def test_version(): # I don't know why I'm testing this but at least the import worked in pytest - assert __version__ == '0.3.9' + assert __version__ == '0.3.8' From 74ef9e77cb5dabb78344a66e1c4064489c682407 Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 17:40:49 +0200 Subject: [PATCH 16/17] remove merge back to dev step, that should wait or be separate --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f621e4..cf616ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,11 +41,11 @@ jobs: git branch --list git log --graph -n10 --pretty=format:'%h %as %cn %x09%s %d' - - name: Merge back to dev - run: | - git checkout dev - git merge --no-ff main - git push origin dev + # - name: Merge back to dev + # run: | + # git checkout dev + # git merge --no-ff main + # git push origin dev - name: Merge the latest release commit run: | From 1de86887d5715978e3aa2f66ea533123859caafc Mon Sep 17 00:00:00 2001 From: mahiki Date: Mon, 22 Jul 2024 20:28:06 +0200 Subject: [PATCH 17/17] todos --- todo/TODO.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 todo/TODO.md diff --git a/todo/TODO.md b/todo/TODO.md new file mode 100644 index 0000000..feb41e1 --- /dev/null +++ b/todo/TODO.md @@ -0,0 +1,53 @@ +# TODO +* build and bump homebrew: justfile or github actions? +* tests in GHA is cool, esp merge after tests pass + +## TODO: GHA AUTOMATION: WHAT? +Goals are what? + +1. test on push +2. ready for release -> somehow -> merge and tag +3. delete release branch +4. merge main back into dev +5. generate a release on the gh releases page from main tag +6. build executable for homebrew +7. bump homebrew formula + * trigger brew repo `mahiki/tap/desertislandutils` to link new version + + +I mean, right now 'Merge Release Branch and Tag' runs every time you push a release branch that passes tests. +I guess push feature branch, then checkout the release branch only when ready to release. +Maybe I should only trigger on merge to release branch? i dunno + +## TODO: JUSTFILE +add to justfile the merge/release process. Merge and tag GHA only happens for +branch with release/v... +test runs with everything pretty much +release will happen after successful release merge. +so work flow is: +dev .. do work +or feature-branch +then checkout dev or feature to new release/x.x.x +once test passes on a release branch its auto-merging. + +maybe a better way is auto-merge and tag after dev push or something + +Also, NOTE that GHA actions changes should be worked on in main. its own thing. + +### Release could be a jusftfile action +https://github.com/github-release/github-release + + github-release release \ + --user aktau \ + --repo gofinance \ + --tag v0.1.0 \ + --name "the wolf of source street" \ + --description "Not a movie, contrary to popular opinion. Still, my first release!" \ + --pre-release + + github-release upload \ + --user aktau \ + --repo gofinance \ + --tag v0.1.0 \ + --name "gofinance-osx-amd64" \ + --file bin/darwin/amd64/gofinance \ No newline at end of file