diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4356a0b..68471f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,7 +86,7 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: dist/ - repository-url: https://test.pypi.org/legacy/ + # repository-url: https://test.pypi.org/legacy/ verbose: true # skip-existing: true # user: __token__ @@ -113,6 +113,7 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: dist/ + # url = "https://upload.pypi.org/legacy/" verbose: true # user: __token__ # password: ${{ secrets.PYPI_SECRECT }} diff --git a/pyproject.toml b/pyproject.toml index cafc080..7fb248f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ description = "Dornech's testpackage" readme = "README.md" requires-python = ">=3.9" # only license identifier from https://spdx.org/licenses/ are allowed -license = { text = "MIT"} +license = { text = "MIT" } # keywords for easier look-up on PyPI keywords = ["keyword_1", "keyword_2"] # ToDo: Modify according to your needs! authors = [ @@ -30,6 +30,7 @@ classifiers = [ # ToDo: Modify according to your needs! ] # direct dependencies of this package, installed when users `pip install pytestdornech` later. dependencies = [ # ToDo: Modify according to your needs! + "setuptools_scm", "typer", # "numpy", # "matplotlib", @@ -37,6 +38,9 @@ dependencies = [ # ToDo: Modify according to your needs! ] dynamic = ["version"] +[project.optional-dependencies] +# n. a. + [project.scripts] # Use `fibonacci` as command-line script, comment or remove this section if not needed. fibonacci = "pytestdornech.skeleton:app" @@ -59,6 +63,7 @@ allow-direct-references = true [tool.hatch.version] source = "vcs" +fallback-version = "0.0.1dev0" raw-options = { version_scheme = "no-guess-dev" } [tool.hatch.build.hooks.vcs] diff --git a/src/pytestdornech/__init__.py b/src/pytestdornech/__init__.py index eceba1f..ea5217a 100644 --- a/src/pytestdornech/__init__.py +++ b/src/pytestdornech/__init__.py @@ -3,33 +3,33 @@ Notion-API: https://developers.notion.com/reference/intro """ -#from importlib.metadata import PackageNotFoundError, version -# -#try: -# __version__ = version('pytestdornech') -#except PackageNotFoundError: # pragma: no cover -# __version__ = 'unknown' -#finally: -# del version, PackageNotFoundError +from importlib.metadata import PackageNotFoundError, version + +try: + __version__ = version('pytestdornech') +except PackageNotFoundError: # pragma: no cover + __version__ = 'unknown' +finally: + del version, PackageNotFoundError # up-to-date version tag for modules installed in editable mode inspired by # https://github.com/maresb/hatch-vcs-footgun-example/blob/main/hatch_vcs_footgun_example/__init__.py # Define the variable '__version__': -try: - # If setuptools_scm is installed (e.g. in a development environment with - # an editable install), then use it to determine the version dynamically. - from setuptools_scm import get_version - # This will fail with LookupError if the package is not installed in - # editable mode or if Git is not installed. - __version__ = get_version(root="..", relative_to=__file__) -except (ImportError, LookupError): - # As a fallback, use the version that is hard-coded in the file. - try: - from ._version import __version__ # noqa: F401 - except ModuleNotFoundError: - # The user is probably trying to run this without having installed the - # package, so complain. - raise RuntimeError( - f"Package {__package__} is not correctly installed. Please install it with pip." - ) +# try: +# # If setuptools_scm is installed (e.g. in a development environment with +# # an editable install), then use it to determine the version dynamically. +# from setuptools_scm import get_version +# # This will fail with LookupError if the package is not installed in +# # editable mode or if Git is not installed. +# __version__ = get_version(root="..", relative_to=__file__) +# except (ImportError, LookupError): +# # As a fallback, use the version that is hard-coded in the file. +# try: +# from ._version import __version__ # noqa: F401 +# except ModuleNotFoundError: +# # The user is probably trying to run this without having installed the +# # package, so complain. +# raise RuntimeError( +# f"Package {__package__} is not correctly installed. Please install it with pip." +# ) diff --git a/src/pytestdornech/skeleton.py b/src/pytestdornech/skeleton.py index 56c931e..bc95e98 100644 --- a/src/pytestdornech/skeleton.py +++ b/src/pytestdornech/skeleton.py @@ -79,4 +79,5 @@ def main( if __name__ == '__main__': + print(f"My version is '{__version__}'.\n") app()