Skip to content

Commit

Permalink
Move 'ksconf' to a namespace
Browse files Browse the repository at this point in the history
- Allow multiple packages to contribute to the ksconf namespace (may require
  some re-installs for Splunk app?).  Drop the '__init__' to allow multiple
  python packages to contribute to the same namespace)
  • Loading branch information
lowell80 committed Oct 4, 2023
1 parent 5ca9bd3 commit eb38dbf
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 28 deletions.
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 import __author__ as author # noqa
from ksconf import __version__ as release # noqa
from ksconf._ksconf import __author__ as author # noqa
from ksconf._ksconf import __version__ as release # noqa

if release is None:
release = "0.0.0"
Expand Down
File renamed without changes.
22 changes: 11 additions & 11 deletions ksconf/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from collections import defaultdict
from typing import List

import ksconf
import ksconf._ksconf as ksc
import ksconf.util
from ksconf.commands import DescriptionHelpFormatterPreserveLayout, get_all_ksconf_cmds
from ksconf.consts import EXIT_CODE_ENV_BUSTED, EXIT_CODE_INTERNAL_ERROR, KSCONF_DEBUG, is_debug
Expand Down Expand Up @@ -107,16 +107,16 @@ def build_cli_parser(do_formatter=False):
version_info = []

# XXX: Check terminal size before picking a signature
version_info.append(choice(ksconf.__ascii_sigs__))
version_info.append(choice(ksc.__ascii_sigs__))

verbuild = f"%(prog)s {ksconf.__version__}"
if ksconf.__build__:
verbuild += f" (Build {ksconf.__build__})"
verbuild = f"%(prog)s {ksc.__version__}"
if ksc.__build__:
verbuild += f" (Build {ksc.__build__})"
version_info.append(verbuild)
version_info.append(f"Python: {sys.version.split()[0]} ({sys.executable})")
if ksconf.__vcs_info__:
version_info.append(ksconf.__vcs_info__)
install_location = os.path.dirname(os.path.abspath(ksconf.__file__))
if ksc.__vcs_info__:
version_info.append(ksc.__vcs_info__)
install_location = os.path.dirname(os.path.abspath(ksc.__file__))
version_info.append(f"Installed at: {install_location}")
version_info.append(f"Platform: {platform.version()}")
try:
Expand Down Expand Up @@ -172,9 +172,9 @@ def build_cli_parser(do_formatter=False):
version_info.append(f" hook {caller.name}")

# XXX: Grab splunk version and home, if running as a splunk app
version_info.append(f"Written by {ksconf.__author__}.")
version_info.append(f"Copyright {ksconf.__copyright__}, all rights reserved.")
version_info.append(f"Licensed under {ksconf.__license__}")
version_info.append(f"Written by {ksc.__author__}.")
version_info.append(f"Copyright {ksc.__copyright__}, all rights reserved.")
version_info.append(f"Licensed under {ksc.__license__}")

# Add entry-point subcommands
subcommands = defaultdict(list)
Expand Down
2 changes: 1 addition & 1 deletion ksconf/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import TextIO
from warnings import warn

from ksconf import KsconfPluginWarning
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,
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,7 +15,7 @@
import sys
from argparse import FileType

from ksconf import __vcs_info__, __version__
from ksconf._ksconf import __vcs_info__, __version__
from ksconf.commands 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
Expand Down
2 changes: 1 addition & 1 deletion ksconf/conf/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def write_diff_as_json(delta: List[DiffOp], stream, **dump_args):
import json
import sys

from ksconf import __vcs_info__, __version__
from ksconf._ksconf import __vcs_info__, __version__
record = {
"schema_version": 1,
"software": {
Expand Down
16 changes: 4 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re
from textwrap import dedent

from setuptools import setup
from setuptools import find_namespace_packages, setup

from ksconf.setup_entrypoints import get_entrypoints_setup

Expand Down Expand Up @@ -173,16 +173,7 @@ def get_ver(_allow_git_fetch=True):
"Documentation": "https://ksconf.readthedocs.io/",
"Splunk app": "https://splunkbase.splunk.com/app/4383/",
},
packages=[
"ksconf",
"ksconf.app",
"ksconf.builder",
"ksconf.commands",
"ksconf.conf",
"ksconf.util",
"ksconf.vc",
"ksconf.ext", # Third-party modules shipping with ksconf
],
packages=find_namespace_packages(include=['ksconf.*']),
setup_requires=[
"wheel",
],
Expand All @@ -203,8 +194,9 @@ def get_ver(_allow_git_fetch=True):
"argcomplete",
"jinja2",
"splunk-sdk",
"pyyaml",
]
},
include_package_data=True,
zip_safe=True
zip_safe=False
)

0 comments on commit eb38dbf

Please sign in to comment.