Skip to content

Commit

Permalink
Fix rpzip --version output (#9)
Browse files Browse the repository at this point in the history
* Fix license value

* Use 'hatch version' to get version

* Fix license value

* Fix misformatted --version output

---------

Co-authored-by: Jay Qi <jayqi@users.noreply.github.com>
  • Loading branch information
jayqi and jayqi authored Feb 2, 2024
1 parent be33cff commit af1a12b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ jobs:
- name: Install hatch
run: |
pip install hatch
hatch env create
- name: Check that versions match
id: version
run: |
echo "Release tag: [${{ github.ref_name }}]"
PACKAGE_VERSION=$(hatch run python -c "import rpzip; print(rpzip.__version__)")
PACKAGE_VERSION=$(hatch version)
echo "Package version: [$PACKAGE_VERSION]"
[ "${{ github.ref_name }}" == "cli-v$PACKAGE_VERSION" ] || { exit 1; }
echo "major_minor_version=v${PACKAGE_VERSION%.*}" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: version
run: |
echo "Release tag: [${{ github.ref_name }}]"
PACKAGE_VERSION=$(hatch run python -c "import repro_zipfile; print(repro_zipfile.__version__)")
PACKAGE_VERSION=$(hatch version)
echo "Package version: [$PACKAGE_VERSION]"
[ "${{ github.ref_name }}" == "v$PACKAGE_VERSION" ] || { exit 1; }
echo "major_minor_version=v${PACKAGE_VERSION%.*}" >> $GITHUB_OUTPUT
Expand Down
4 changes: 4 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog — rpzip

## v0.1.1 (2024-02-01)

- Fixed misformatted `--version` output.

## v0.1.0 (2024-01-27)

Initial release! 🎉
2 changes: 1 addition & 1 deletion cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dynamic = ["version"]
description = "A lightweight command-line program for creating reproducible/deterministic ZIP archives."
readme = "README.md"
requires-python = ">=3.8"
license = "MIT"
license = { text = "MIT License" }
keywords = ["zipfile", "zip", "reproducible", "deterministic", "cli"]
authors = [{ name = "DrivenData", email = "info@drivendata.org" }]
classifiers = [
Expand Down
6 changes: 3 additions & 3 deletions cli/rpzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import sys
from typing import List, Optional

try:
if sys.version_info >= (3, 9):
from typing import Annotated
except ImportError:
else:
from typing_extensions import Annotated

import typer
Expand All @@ -25,7 +25,7 @@
def version_callback(value: bool):
if value:
print(f"repro-zipfile v{repro_zipfile_version}")
print(f"rpzip (rpzip) v{__version__}")
print(f"rpzip v{__version__}")
raise typer.Exit()


Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dynamic = ["version"]
description = "A tiny, zero-dependency replacement for Python's zipfile.ZipFile for creating reproducible/deterministic ZIP archives."
readme = "README.md"
requires-python = ">=3.8"
license = "MIT"
license = { file = "LICENSE" }
keywords = ["zipfile", "zip", "reproducible", "deterministic"]
authors = [{ name = "DrivenData", email = "info@drivendata.org" }]
classifiers = [
Expand Down Expand Up @@ -44,22 +44,22 @@ path = "repro_zipfile.py"

[tool.hatch.envs.default]
pre-install-commands = [
"pip install -e cli",
"pip install -e . -e cli",
]
features = ["cli", "tests"]
dependencies = ["mypy>=1.0.0", "ruff>=0.1.14"]
dependencies = ["ipython", "mypy>=1.0.0", "ruff>=0.1.14"]
python = "3.10"
path = ".venv"

[tool.hatch.envs.default.scripts]
lint = ["ruff format --check {args:.}", "ruff check {args:.}"]
typecheck = ["mypy {args:repro_zipfile.py} --install-types --non-interactive"]
typecheck = ["mypy {args:repro_zipfile.py cli/rpzip.py} --install-types --non-interactive"]

## TESTS ENVIRONMENT ##

[tool.hatch.envs.tests]
pre-install-commands = [
"pip install -e cli",
"pip install -e . -e cli",
]
features = ["tests", "cli"]
dependencies = ["coverage>=6.5", "pytest-cov"]
Expand Down

0 comments on commit af1a12b

Please sign in to comment.