Skip to content

Commit

Permalink
add version command and fix dynamic versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteOtter committed May 10, 2023
1 parent d6e1115 commit 530dff2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ src/nester/__pycache__/
src/nester/**/__pycache__/
test/__pycache__/


# build information
**/**/__nester_struct.egg-info/
src/nester_struct.egg-info/
src/Nester.egg-info/
src/nester.egg-info/
build/
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ dynamic = [
[project.scripts]
nester = "nester.nester_commands:cli"

[tool.setuptools_scm]
root = "."
relative_to = "src/nester/__init__.py"

[tool.isort]
profile = "black"

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = Nester
version = attr: src.nester.__version__
version = attr: setuptools_scm.get_version(root="..", relative_to=__file__)
author = Christopher Hock
author_email = [email protected]
url = https://github.com/ByteOtter/nester
Expand Down
4 changes: 4 additions & 0 deletions src/nester/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
"""
Main Nester package.
"""

__version__ = "0.1.0"
15 changes: 14 additions & 1 deletion src/nester/nester_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import os
import click
from . import utils
from . import utils, __version__

_context_settings = dict(help_option_names=["-h", "--help"])

Expand Down Expand Up @@ -94,6 +94,19 @@ def clean(projectname):
utils.clean(projectname)


@click.command()
def version():
"""
Print Nester version
"""

print(
"""Nester - Copyright (c) 2023 ByteOtter. (github.com/ByteOtter)\nLicensed under the terms of GPL-3.0. Check github.com/ByteOtter/nester/LICENSE for more info.\nNester-version:""",
__version__,
)


cli.add_command(create)
cli.add_command(validate)
cli.add_command(clean)
cli.add_command(version)

0 comments on commit 530dff2

Please sign in to comment.