Skip to content

Commit

Permalink
Merge pull request #28 from blowekamp/add_versioning
Browse files Browse the repository at this point in the history
Use setuptools-scm to extract version from git tags.
  • Loading branch information
blowekamp authored Jul 7, 2023
2 parents 82bcb09 + 75f6132 commit f190534
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@

from comment_parser import comment_parser

from importlib.metadata import version, PackageNotFoundError

try:
__version__ = version("SimpleITKSpellChecking")
except PackageNotFoundError:
# package is not installed
pass


SUFFIX2MIME = {
'.h': 'text/x-c++',
Expand Down Expand Up @@ -240,6 +248,7 @@ def parse_args():

parser.add_argument('--type', '-t', action='store', default='',
dest='mime_type', help='Set file mime type. File name suffix will be ignored.')
parser.add_argument( '--version', action='version', version=f'%(prog)s {__version__}')
args = parser.parse_args()
return args

Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[build-system]
requires = ["setuptools>=61.0"]
requires = ["setuptools>=61.0", "setuptools_scm[toml]>=7.1"]
build-backend = "setuptools.build_meta"

[project]
name = "SimpleITKSpellChecking"
version = "0.0.1"
authors = [
{ name="David Chen", email="[email protected]" },
]
Expand All @@ -16,7 +15,7 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dynamic = ["dependencies"]
dynamic = ["dependencies", "version"]

[project.urls]
"Homepage" = "https://github.com/SimpleITK/SimpleITKSpellChecking"
Expand All @@ -28,3 +27,5 @@ dependencies = {file = ["requirements.txt"]}
[project.scripts]
codespell = "codespell:main"

[tool.setuptools_scm]
local_scheme = "dirty-tag"

0 comments on commit f190534

Please sign in to comment.