Skip to content

Commit

Permalink
Version value rework and centralization (#136)
Browse files Browse the repository at this point in the history
* Single source of truth for version

* Fix package name for version gathering

* Add package metadata to the binaries

* Moved version out of pyproject.toml

* Add missing newline for linter
  • Loading branch information
remyroy authored Sep 6, 2024
1 parent 224b1d0 commit a46abdf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions ethstaker_deposit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.1.3.dev'
4 changes: 4 additions & 0 deletions ethstaker_deposit/deposit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
fuzzy_reverse_dict_lookup,
load_text,
)
from ethstaker_deposit.settings import (
DEPOSIT_CLI_VERSION,
)


def check_python_version() -> None:
Expand Down Expand Up @@ -100,6 +103,7 @@ def list_commands(self, ctx: click.Context) -> list[str]:
),
hidden=False,
)
@click.version_option(version=DEPOSIT_CLI_VERSION)
def cli(ctx: click.Context, language: str, non_interactive: bool, ignore_connectivity: bool) -> None:
if not ignore_connectivity and not non_interactive:
check_connectivity()
Expand Down
4 changes: 3 additions & 1 deletion ethstaker_deposit/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from typing import Dict, NamedTuple, Optional
from eth_utils import decode_hex

DEPOSIT_CLI_VERSION = '2.7.0'
from ethstaker_deposit import __version__

DEPOSIT_CLI_VERSION = __version__


class BaseChainSetting(NamedTuple):
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ build-backend = "setuptools.build_meta"
[tool.setuptools]
packages = ["ethstaker_deposit"]

[tool.setuptools.dynamic]
version = {attr = "ethstaker_deposit.__version__"}

[tool.pip-tools]
generate-hashes = true
no-annotate = true

[project]
name = "ethstaker_deposit"
version = "0.1.3"
description = "Secure key generation for deposits"
readme = "README.md"
dependencies = [
Expand All @@ -23,6 +25,7 @@ dependencies = [
"ssz"
]
requires-python = ">=3.9,<4"
dynamic = ["version"]

[project.optional-dependencies]
test = [
Expand Down

0 comments on commit a46abdf

Please sign in to comment.