Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using built-in tools to automatically version FIREWHEEL #14

Merged
merged 4 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ get_fw_tab_completion_script = "firewheel.cli.completion.prepare_completion_scri
# Required for tox documentation building
firewheel = ["firewheel.yaml"]

[tool.setuptools.dynamic]
version = {attr = "firewheel.__version__"}

[tool.setuptools_scm]

[tool.doc8]
Expand Down
2 changes: 0 additions & 2 deletions src/firewheel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from pathlib import Path

__version__ = "2.7.0"

FIREWHEEL_PACKAGE_DIR = Path(__file__).parent
4 changes: 2 additions & 2 deletions src/firewheel/cli/firewheel_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import textwrap
from math import floor
from uuid import uuid4
from importlib.metadata import version

from rich.columns import Columns
from rich.console import Console
from rich.markdown import Markdown

import firewheel
from firewheel.cli import utils
from firewheel.config import Config
from firewheel.lib.log import Log
Expand Down Expand Up @@ -953,7 +953,7 @@ def do_version(self, arg):
# Write to the history file.
if not self.interactive:
self.write_history(f"version {arg}")
print(firewheel.__version__)
print(version("firewheel"))

def help_list(self):
"""Help message for the list command.
Expand Down
4 changes: 2 additions & 2 deletions src/firewheel/lib/grpc/firewheel_grpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from typing import Iterable
from datetime import datetime
from concurrent import futures
from importlib.metadata import version

import grpc
from google.protobuf.json_format import Parse, MessageToDict

import firewheel
from firewheel.config import Config
from firewheel.lib.log import Log
from firewheel.lib.grpc import firewheel_grpc_pb2, firewheel_grpc_pb2_grpc
Expand Down Expand Up @@ -52,7 +52,7 @@ def __init__(self):

self.log.info("Initialized FirewheelServicer log.")
self.server_start_time = datetime.utcnow()
self.version = firewheel.__version__
self.version = version("firewheel")
self.cache_dir = os.path.join(
config["grpc"]["root_dir"], config["grpc"]["cache_dir"]
)
Expand Down
4 changes: 2 additions & 2 deletions src/firewheel/tests/unit/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import tempfile
import unittest
import unittest.mock
from importlib.metadata import version

import firewheel
from firewheel.config import Config
from firewheel.cli.utils import HelperNotFoundError
from firewheel.cli.firewheel_cli import FirewheelCLI
Expand Down Expand Up @@ -277,7 +277,7 @@ def test_do_version(self, mock_stdout):
args = ""
cli.do_version(args)

self.assertEqual(mock_stdout.getvalue().strip(), firewheel.__version__)
self.assertEqual(mock_stdout.getvalue().strip(), version("firewheel"))

def test_do_exit(self):
cli = FirewheelCLI()
Expand Down
Loading