6 Commits
4 changed files with 36 additions and 24 deletions
+4 -4
View File
@@ -17,10 +17,10 @@ repos:
args: ["--profile", "black", "--filter-files"]
# Flake8
#- repo: https://github.com/pycqa/flake8
# rev: '7.0.0'
# hooks:
# - id: flake8
- repo: https://github.com/pycqa/flake8
rev: '7.0.0'
hooks:
- id: flake8
# Black
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
+21 -2
View File
@@ -81,10 +81,11 @@ eval "$(pyenv init -)"
EOF
```
* reference https://github.com/pyenv/pyenv
* Use pyenv to install desired python version, and/or create any virtual environments you desire
Clone the repo:
```commandline
git clone https://git-mirror.zavage.net/zavage-software/app_skellington.git
git clone https://git-repos.zavage.net/zavage-software/app_skellington.git
```
Install pre-commit hooks:
@@ -110,6 +111,24 @@ isort app_skellington
flake8 app_skellington
```
Publish:
```
# Push latest commit, or on commit ready to publish:
git push
# Create a tag with the desired version number and push:
git tag -a v0.2.0 -m "0.2.0 provides modern pyproject.toml build with setuptools, versioning, and publishing"
git push origin v0.2.0
# Build the wheel:
python -m build
# Publish to pypi:
twine check dist/*
twine upload dist/*
```
* Reference https://packaging.python.org/en/latest/overview/
# Version
@@ -129,7 +148,7 @@ MIT no attribution required - https://opensource.org/license/mit-0
* Project page: https://zavage-software.com/portfolio/app_skellington
* Please report bugs, improvements, or feedback!
* Contact: mathew@zavage.net
* Contact: mat@zavage.net
* Packing and distribution conforms to PEP 621 https://peps.python.org/pep-0621/
* Reference https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/
-3
View File
@@ -180,9 +180,6 @@ class ApplicationContainer:
except NoCommandSpecified:
print("Failure: No command specified.")
def interactive_shell(self):
pass
def invoke_from_cli(self):
self.invoke_command()
+11 -15
View File
@@ -3,7 +3,7 @@ import inspect
import re
import sys
from . import app_container
from . import NoCommandSpecified, app_container
from ._bootstrap import _bootstrap_logger
# If explicit fail is enabled, any command with at least one unknown
@@ -41,12 +41,12 @@ class CommandTree:
./scriptname --option="value" [submenu] [command]
is different than
is different from
./scriptname [submenu] [command] --option="value"
in that option is being applied to the application in the first example and
applied to the refresh_datasets command (under the nhsn command group) in
applied to the command (under the submenu command group) in
the second. In the same way the -h, --help options print different docs
depending on where the help option was passed.
"""
@@ -82,17 +82,7 @@ class CommandTree:
Creates a root-level submenu with no entries. SubMenu node is
returned which can have submenus and commands attached to it.
"""
# NOTE(MG) Fix for Python>=3.7,
# argparse.ArgumentParser added 'required' argument.
# Must also be written into SubMenu.create_submenu.
func_args = {"dest": param_name, "metavar": param_name, "required": is_required}
if sys.version_info.major == 3 and sys.version_info.minor < 7:
if is_required:
_bootstrap_logger.warn(
"Unable to enforce required submenu: Requires >= Python 3.7"
)
del func_args["required"]
# END fix for Python<3.7
# Creates an argument as a slot in the underlying argparse.
subparsers = self.root_parser.add_subparsers(**func_args)
@@ -176,7 +166,7 @@ class CommandTree:
registered_name = cmd_name
_bootstrap_logger.info("registered command: %s", registered_name)
# end copy-paste then editted from SubMenu.register_command
# end copy-paste then edited from SubMenu.register_command
self._cmd_tree_is_single_command = True
self._single_command = cmd
@@ -211,6 +201,12 @@ class CommandTree:
return None, None, False
def run_command(self, args=None):
"""
Args:
args (list[str]): Direct from STDIN
Raises:
NoCommandSpecified for invalid command.
"""
args, unk, success = self.parse(args)
if not success:
_bootstrap_logger.info("cli - SystemExit: Perhaps user invoked --help")
@@ -226,7 +222,7 @@ class CommandTree:
cmd = self._lookup_command(args)
if cmd is None:
_bootstrap_logger.critical("cli - Failed to find command.")
return False
raise NoCommandSpecified
return self._invoke_command(cmd, args)