Skip to content

Commit

Permalink
BLD: drop package level __version__ attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Oct 26, 2024
1 parent 4b7dc35 commit ac5e582
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

- DEP: drop `[isolated]` extra (external tooling should handle dependency pinning)
- BLD: drop package level `__version__` attribute

## [5.2.1] - 2024-09-20

Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "idefix_cli"
version = "6.0.0dev0"
description = "A command line utility belt for Idefix"
authors = [
{ name = "C.M.T. Robert" },
Expand All @@ -20,7 +21,6 @@ dependencies = [
"termcolor>=2.3.0",
"typing-extensions>=4.1.0;python_version < '3.11'",
]
dynamic = ["version"]

[project.license]
text = "GPL-3.0"
Expand Down Expand Up @@ -52,8 +52,6 @@ license-files = [
]
include-package-data = false

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

[tool.setuptools.packages.find]
where = ["src"]
Expand Down
1 change: 0 additions & 1 deletion src/idefix_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__version__ = "5.2.1"
11 changes: 7 additions & 4 deletions src/idefix_cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import sys
import unicodedata
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from importlib.metadata import version
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
from types import FunctionType, ModuleType
from typing import Any, Final

from idefix_cli import __version__
from idefix_cli._theme import set_theme
from idefix_cli.lib import get_config_file, get_option, print_error, print_warning

Expand Down Expand Up @@ -114,13 +114,16 @@ def _setup_commands(parser: ArgumentParser) -> CommandMap:


def main(
argv: "list[str] | None" = None, parser: "ArgumentParser | None" = None
argv: list[str] | None = None,
parser: ArgumentParser | None = None,
) -> Any:
# the return value is deleguated to sub commands so its type is arbitrary
# In practice it should be either 'int' or 'typing.NoReturn'
if parser is None:
parser = ArgumentParser(prog="idfx", allow_abbrev=False)
parser.add_argument("-v", "--version", action="version", version=__version__)
parser.add_argument(
"-v", "--version", action="version", version=version("idefix-cli")
)
commands = _setup_commands(parser)

known_args, unknown_args = parser.parse_known_args(argv)
Expand All @@ -142,7 +145,7 @@ def main(
return cmd(*unknown_args, **vars(known_args))


def alt_main(argv: "list[str] | None" = None) -> Any:
def alt_main(argv: list[str] | None = None) -> Any:
print(
unicodedata.lookup("BASEBALL")
+ unicodedata.lookup("BLACK RIGHT-POINTING TRIANGLE"),
Expand Down

0 comments on commit ac5e582

Please sign in to comment.