<commit_before>import argparse
import logging

import sys
from pathlib import Path

import pkg_resources

from lightbus.commands import utilities as command_utilities
from lightbus.plugins import PluginRegistry
from lightbus.utilities.async_tools import block

logger = logging.getLogger(__name__)


class Command:
    def setup(self, parser, subparsers):
        parser_version = subparsers.add_parser(
            "version", help="Show the currently installed Lightbus version"
        )
        parser_version.set_defaults(func=self.handle)

    def handle(self, args):
        print(pkg_resources.get_distribution("lightbus").version)
<commit_msg>Adding hidden --pyproject option to version command (needed for release process)<commit_after>import argparse
import logging
from pathlib import Path

import pkg_resources


logger = logging.getLogger(__name__)


class Command:
    def setup(self, parser, subparsers):
        parser_version = subparsers.add_parser(
            "version", help="Show the currently installed Lightbus version"
        )
        # Read version directly out of pyproject.toml. Useful for the release process
        parser_version.add_argument("--pyproject", action="store_true", help=argparse.SUPPRESS)
        parser_version.set_defaults(func=self.handle)

    def handle(self, args):
        if args.pyproject:
            import lightbus
            import toml

            file_path = Path(lightbus.__file__).parent.parent / "pyproject.toml"
            with file_path.open() as f:
                version = toml.load(f)["tool"]["poetry"]["version"]
            print(version)
        else:
            print(pkg_resources.get_distribution("lightbus").version)

{'fraction_non_alphanumeric': 0.0824014125956445, 'fraction_numerical': 0.0, 'mean_word_length': 3.314720812182741, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7363608', 'n_tokens_mistral': 462, 'n_tokens_neox': 450, 'n_words': 121}