Skip to content

Commit

Permalink
fix: Turn get_version into a variable __version__ and replace its usages
Browse files Browse the repository at this point in the history
  • Loading branch information
mazulo committed Feb 14, 2023
1 parent 4001b24 commit 2b65ed3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ line_length=120

[tool.semantic_release]
version_variable = [
"src/mispelling_lib/utils/version:get_version",
"src/misspelling_lib/utils/version.py:__version__",
"pyproject.toml:version",
]
branch = "main"
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import unittest
from pathlib import Path

from setuptools import Command, find_packages, setup
from setuptools import Command, setup

from src.misspelling_lib.utils import get_version
from src.misspelling_lib.utils.version import __version__

this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
Expand All @@ -38,9 +38,9 @@ def run(self):
setup(
cmdclass={"test": TestCommand},
name="misspellings_lib",
version=get_version(),
url="https://github.com/mazulo/misspellings",
download_url=f"https://github.com/mazulo/misspellings/tarball/{get_version()}",
version=__version__,
url="https://github.com/mazulo/misspelling",
download_url=f"https://github.com/mazulo/misspelling/tarball/{__version__}",
author="Patrick Mazulo",
author_email="pmazulo@gmail.com",
description="A tool to detect misspellings with opinionated additions",
Expand Down
5 changes: 3 additions & 2 deletions src/misspelling_lib/misspellings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@


from misspelling_lib import MisspellingFactory
from misspelling_lib.utils import MisspellingArgumentParser, expand_directories, get_version, parse_file_list
from misspelling_lib.utils import MisspellingArgumentParser, expand_directories, parse_file_list
from misspelling_lib.utils.version import __version__


def entrypoint() -> Optional[int]:
Expand All @@ -46,7 +47,7 @@ def entrypoint() -> Optional[int]:

if args.version:
console = Console()
console.print(f"[green]misspellings version[/green]: [bold green]{get_version()}")
console.print(f"[green]misspellings version[/green]: [bold green]{__version__}")
return 0

if args.misspelling_file:
Expand Down
4 changes: 2 additions & 2 deletions src/misspelling_lib/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from .argument_parser import MisspellingArgumentParser
from .files import expand_directories, parse_file_list
from .suggestions import SuggestionGenerator
from .version import get_version
from .version import __version__
from .words import esc_file, esc_sed, get_a_line, normalize, same_case, split_words

__all__ = [
"MisspellingArgumentParser",
"esc_file",
"esc_sed",
"get_a_line",
"get_version",
"normalize",
"same_case",
"SuggestionGenerator",
"split_words",
"expand_directories",
"parse_file_list",
"__version__",
]
3 changes: 1 addition & 2 deletions src/misspelling_lib/utils/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
def get_version() -> str:
return "2.0.8"
__version__ = "2.0.8"

0 comments on commit 2b65ed3

Please sign in to comment.