diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a96001c..8cc67123 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,10 +27,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed issue with import modules aliasing using ns eval (#719) * Fix issue with `ns-resolve` throwing an error on macros (#720) * Fix issue with py module `readerwritelock` locks handling (#722) - * Fix issue with basilisp.io/writer :append mode not working (#741). + * Fix issue with basilisp.io/writer :append mode not working (#741) ### Removed * Removed the dependency `astor` for versions of Python 3.9+ (#736) + * Removed `basilisp.__version__` in favor of using `importlib.metadata` for version info (#617) ## [v0.1.0a2] ### Added diff --git a/src/basilisp/__version__.py b/src/basilisp/__version__.py deleted file mode 100644 index 04e7c887..00000000 --- a/src/basilisp/__version__.py +++ /dev/null @@ -1,3 +0,0 @@ -VERSION = (0, 1, "0a2") - -__version__ = ".".join(map(str, VERSION)) diff --git a/src/basilisp/cli.py b/src/basilisp/cli.py index aa7684a6..5a1b3803 100644 --- a/src/basilisp/cli.py +++ b/src/basilisp/cli.py @@ -1,5 +1,5 @@ import argparse -import importlib +import importlib.metadata import io import os import sys @@ -430,9 +430,8 @@ def _add_test_subcommand(parser: argparse.ArgumentParser) -> None: def version(_, __): - from basilisp.__version__ import __version__ - - print(f"Basilisp {__version__}") + v = importlib.metadata.version("basilisp") + print(f"Basilisp {v}") @_subcommand("version", help="print the version of Basilisp", handler=version) diff --git a/src/basilisp/lang/runtime.py b/src/basilisp/lang/runtime.py index 3ef07b79..43ab4c18 100644 --- a/src/basilisp/lang/runtime.py +++ b/src/basilisp/lang/runtime.py @@ -1,7 +1,7 @@ import contextlib import decimal import functools -import importlib +import importlib.metadata import inspect import itertools import logging @@ -72,6 +72,10 @@ NS_VAR_NS = CORE_NS REPL_DEFAULT_NS = "basilisp.user" SUPPORTED_PYTHON_VERSIONS = frozenset({(3, 8), (3, 9), (3, 10), (3, 11), (3, 12)}) +BASILISP_VERSION_STRING = importlib.metadata.version("basilisp") +BASILISP_VERSION = vec.vector( + (int(s) if s.isdigit() else s) for s in BASILISP_VERSION_STRING.split(".") +) # Public basilisp.core symbol names COMPILER_OPTIONS_VAR_NAME = "*compiler-options*" @@ -2118,8 +2122,6 @@ def in_ns(s: sym.Symbol): ) # Version info - from basilisp.__version__ import VERSION - Var.intern( CORE_NS_SYM, sym.symbol(PYTHON_VERSION_VAR_NAME), @@ -2137,7 +2139,7 @@ def in_ns(s: sym.Symbol): Var.intern( CORE_NS_SYM, sym.symbol(BASILISP_VERSION_VAR_NAME), - vec.vector(VERSION), + BASILISP_VERSION, dynamic=True, meta=lmap.map( {