Skip to content

Commit

Permalink
Create ksconf.version for easy version check
Browse files Browse the repository at this point in the history
- Move _ksconf to version (was __init__) due to namespace package and need for
  a public interface showing version information.
- Move that one warning from _ksconf to hookspec.
  • Loading branch information
lowell80 committed Oct 12, 2023
1 parent 32d0162 commit 8c893f7
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 22 deletions.
11 changes: 9 additions & 2 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@ New namespaces:

Renames:

- ``ksconf/__init__`` -> ``ksconf._ksconf``
- ``ksconf/__init__`` -> ``ksconf.version``
- ``ksconf/commands/__init__.py`` -> ``ksconf/command.py``


Ksconf v0.13.3 (DRAFT)
Ksconf v0.13.3 (2023-10-12)
~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Created a new public interface :ref:py:mod:`ksconf.version`.
This provides a consistent means of getting the version information without any extra modules being loaded, now that ksconf is a namespace package.

Note that for v0.13.0 - 0.13.2, this was called ``ksconf._ksconf``.
Hopefully in that short time frame nobody got too attached to that terrible name.


* Changes for :ref:`ksconf_cmd_rest-publish`:

* Implement ``--insecure`` parameter.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
project = u'KSConf'
copyright = u'2020, Kintyre Solutions'

from ksconf._ksconf import __author__ as author # noqa
from ksconf._ksconf import __version__ as release # noqa
from ksconf.version import __author__ as author # noqa
from ksconf.version import __version__ as release # noqa

if release is None:
release = "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion ksconf/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from collections import defaultdict
from typing import List

import ksconf._ksconf as ksc
import ksconf.util
import ksconf.version as ksc
from ksconf.command import DescriptionHelpFormatterPreserveLayout, get_all_ksconf_cmds
from ksconf.consts import EXIT_CODE_ENV_BUSTED, EXIT_CODE_INTERNAL_ERROR, KSCONF_DEBUG, is_debug
from ksconf.hook import plugin_manager
Expand Down
2 changes: 1 addition & 1 deletion ksconf/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
from typing import TextIO
from warnings import warn

from ksconf._ksconf import KsconfPluginWarning
from ksconf.compat import cache
from ksconf.conf.parser import (ConfParserException, ParserConfig,
detect_by_bom, parse_conf, smart_write_conf,
write_conf)
from ksconf.consts import (EXIT_CODE_BAD_ARGS, EXIT_CODE_BAD_CONF_FILE,
EXIT_CODE_NO_SUCH_FILE, SMART_CREATE, SmartEnum)
from ksconf.hook import plugin_manager
from ksconf.hookspec import KsconfPluginWarning
from ksconf.util import debug_traceback

__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion ksconf/commands/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import sys
from argparse import FileType

from ksconf._ksconf import __vcs_info__, __version__
from ksconf.command import KsconfCmd, dedent
from ksconf.conf.parser import GLOBAL_STANZA, PARSECONF_MID_NC, ConfParserException, parse_conf
from ksconf.consts import EXIT_CODE_NO_SUCH_FILE, EXIT_CODE_SUCCESS
from ksconf.util.completers import DirectoriesCompleter, FilesCompleter
from ksconf.util.file import file_hash
from ksconf.version import __vcs_info__, __version__


class ConfSnapshotConfig:
Expand Down
4 changes: 4 additions & 0 deletions ksconf/hookspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class Protocol:
pass


class KsconfPluginWarning(Warning):
pass


hookspec = HookspecMarker(PLUGGY_HOOK)


Expand Down
16 changes: 1 addition & 15 deletions ksconf/_ksconf.py → ksconf/version.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
""" ksconf - Ksconf Splunk CONFig tool
Design goals:
* Multi-purpose go-to ``.conf`` tool.
* Dependability
* Simplicity
* No eternal dependencies (single source file, if possible; or packable as single file.)
* Stable CLI
* Good scripting interface for deployment scripts and/or git hooks
""" ksconf.version: Version and release info for the core ksconf package
"""

Expand All @@ -27,10 +17,6 @@
__vcs_info__ = None


class KsconfPluginWarning(Warning):
pass


# Because how do you pick just just ONE?!!
__ascii_sigs__ = (
"""
Expand Down

0 comments on commit 8c893f7

Please sign in to comment.