2024-11-19 23:49:03 -07:00
|
|
|
---
|
|
|
|
gitea: none
|
|
|
|
include_toc: true
|
|
|
|
---
|
|
|
|
|
|
|
|
**app_skellington**
|
|
|
|
|
2020-03-01 21:08:11 -07:00
|
|
|
Application framework for Python, features include:
|
2020-07-19 01:54:54 -06:00
|
|
|
- Pain-free multi-level command menu: Expose public class methods as commands available to user.
|
|
|
|
- Simple to define services and automatic dependency injection based on name (with custom invocation as an option). \*WIP
|
|
|
|
- INI-style config and and validation (provided through ConfigObj).
|
|
|
|
- Colored logging (provided through colorlog)
|
|
|
|
- Works on Linux, Windows, and Mac.
|
2020-03-01 21:08:11 -07:00
|
|
|
|
|
|
|
Principles:
|
2020-07-19 01:54:54 -06:00
|
|
|
- Lend to creating beautiful, easy to read and understand code in the application.
|
|
|
|
- Minimize coupling of applications to this framework.
|
2024-11-16 00:57:00 -07:00
|
|
|
- Compatible with Linux, Windows, and Mac. Try to be compatible as possible otherwise.
|
2020-07-19 01:54:54 -06:00
|
|
|
- Try to be compatible with alternate Python runtimes such as PyPy and older python environments. \*WIP
|
2020-03-01 21:08:11 -07:00
|
|
|
|
2024-11-15 19:44:11 -07:00
|
|
|
# PyPi Hosted Link
|
2024-11-15 06:06:30 -07:00
|
|
|
|
2024-11-19 23:54:18 -07:00
|
|
|
This is the project page for PyPi: The Python Package Index for community third-party libraries
|
|
|
|
|
2024-11-15 06:06:30 -07:00
|
|
|
https://pypi.org/project/app-skellington/
|
|
|
|
|
2024-11-19 23:54:18 -07:00
|
|
|
```
|
|
|
|
pip install app_skellington # install
|
|
|
|
pip uninstall app_skellington # uninstall
|
|
|
|
pip download app_skellington # download .whl wheel files for redistributable install
|
|
|
|
pip install -U app_skellington # upgrade
|
|
|
|
pip list # list install packages in environment
|
|
|
|
pip index version app_skellington # enumerate available distributions in pypi for package
|
|
|
|
```
|
|
|
|
|
2024-11-15 19:44:11 -07:00
|
|
|
# Application Configuration
|
|
|
|
|
2020-03-11 23:18:51 -06:00
|
|
|
Site configurations are supported through ConfigObj. There is a config.spec
|
2020-03-01 21:08:11 -07:00
|
|
|
in the src directory which is a validation file; it contains the accepted
|
|
|
|
parameter names, types, and limits for configurable options in the
|
|
|
|
application which is built on app_skellington. The format is multi-level .ini syntax.
|
|
|
|
|
2024-08-02 05:00:58 -06:00
|
|
|
Reference the ConfigObj documentation for config.ini and config.spec
|
2020-03-11 23:18:51 -06:00
|
|
|
format. See:
|
2020-03-01 21:08:11 -07:00
|
|
|
|
2020-07-19 01:54:54 -06:00
|
|
|
- https://configobj.readthedocs.io/en/latest/configobj.html#the-config-file-format
|
|
|
|
- https://configobj.readthedocs.io/en/latest/configobj.html#validation
|
2020-03-11 23:18:51 -06:00
|
|
|
|
|
|
|
Config files (config.ini) are created if they don't exist. The
|
2020-03-01 21:08:11 -07:00
|
|
|
file always contains the full specification of parameters; i.e. even default
|
|
|
|
parameters are added into the config file.
|
|
|
|
|
|
|
|
Linux:
|
2024-08-02 05:00:58 -06:00
|
|
|
|
2024-11-15 19:44:11 -07:00
|
|
|
* /home/\<user\>/.config/\<app_name\>/config.ini
|
|
|
|
* /home/\<user\>/.cache/\<app_name\>/log/\<app_name\>.log
|
2020-03-01 21:08:11 -07:00
|
|
|
|
|
|
|
Windows:
|
2024-08-02 05:00:58 -06:00
|
|
|
|
2024-11-15 19:44:11 -07:00
|
|
|
* C:\\Users\\\<user>\\\<app_name\>\\Local\\\<app_name\>\\config.ini
|
|
|
|
* C:\\Users\\\<user>\\\<app_name\>\\Local\\\<app_name\>\\Logs\\\<app_name\>.log
|
2020-03-01 21:08:11 -07:00
|
|
|
|
|
|
|
Application configuration can be overridden ad-hoc through the --config <filename>
|
|
|
|
argument.
|
|
|
|
|
2024-11-15 19:44:11 -07:00
|
|
|
# Debug - Turn on Logging
|
|
|
|
|
2020-03-01 21:08:11 -07:00
|
|
|
Set 'APPSKELLINGTON_ENABLE_LOGGING' environment variable to any value which turns
|
|
|
|
on AppSkellington-level logging. For example,
|
|
|
|
|
2020-07-19 01:54:54 -06:00
|
|
|
APPSKELLINGTON_DEBUG=1 <executable>
|
2020-03-01 21:08:11 -07:00
|
|
|
|
|
|
|
or
|
|
|
|
|
2020-07-19 01:54:54 -06:00
|
|
|
export APPSKELLINGTON_DEBUG=1
|
2020-03-01 21:08:11 -07:00
|
|
|
<executable>
|
|
|
|
|
2024-11-15 19:44:11 -07:00
|
|
|
# Tests
|
|
|
|
|
2020-03-01 21:08:11 -07:00
|
|
|
Tests are a WIP. Recommendation is to run 'pytest' in the 'tests' directory.
|
|
|
|
|
2024-11-15 19:44:11 -07:00
|
|
|
# Development
|
|
|
|
|
2024-11-16 00:24:09 -07:00
|
|
|
I recommend pyenv to install a reliable, controlled python of preferred version locally.
|
|
|
|
|
2024-08-02 05:00:58 -06:00
|
|
|
```
|
2024-11-16 00:24:09 -07:00
|
|
|
curl https://pyenv.run | bash
|
|
|
|
|
|
|
|
# Add to .bashrc or similar for different shells:
|
|
|
|
tee -a "$HOME"/.profile <<'EOF'
|
2024-08-02 05:00:58 -06:00
|
|
|
|
2024-11-16 00:24:09 -07:00
|
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
|
|
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
|
|
|
eval "$(pyenv init -)"
|
2024-08-02 05:00:58 -06:00
|
|
|
|
2024-11-16 00:24:09 -07:00
|
|
|
EOF
|
|
|
|
```
|
|
|
|
* reference https://github.com/pyenv/pyenv
|
2024-11-16 22:05:18 -07:00
|
|
|
* Use pyenv to install desired python version, and/or create any virtual environments you desire
|
2024-11-16 00:24:09 -07:00
|
|
|
|
|
|
|
Clone the repo:
|
2024-08-02 05:00:58 -06:00
|
|
|
```commandline
|
2024-11-16 03:16:04 -07:00
|
|
|
git clone https://git-repos.zavage.net/zavage-software/app_skellington.git
|
2024-08-02 05:00:58 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
Install pre-commit hooks:
|
|
|
|
```commandline
|
|
|
|
pre-commit install
|
|
|
|
```
|
|
|
|
|
2024-11-16 00:24:09 -07:00
|
|
|
Build:
|
|
|
|
```
|
|
|
|
python -m build
|
|
|
|
```
|
|
|
|
|
|
|
|
Install:
|
|
|
|
|
|
|
|
```
|
|
|
|
pip install .
|
|
|
|
```
|
|
|
|
|
2024-11-16 00:57:00 -07:00
|
|
|
Formatting and Linters:
|
|
|
|
```
|
|
|
|
black app_skellington
|
|
|
|
isort app_skellington
|
|
|
|
flake8 app_skellington
|
|
|
|
```
|
|
|
|
|
2024-11-16 02:06:00 -07:00
|
|
|
Publish:
|
|
|
|
|
|
|
|
```
|
2024-11-16 03:02:32 -07:00
|
|
|
# Push latest commit, or on commit ready to publish:
|
|
|
|
git push
|
|
|
|
|
|
|
|
# Create a tag with the desired version number and push:
|
2024-11-16 02:06:00 -07:00
|
|
|
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
|
2024-11-16 03:02:32 -07:00
|
|
|
|
|
|
|
# Build the wheel:
|
2024-11-16 02:06:00 -07:00
|
|
|
python -m build
|
2024-11-16 03:02:32 -07:00
|
|
|
|
|
|
|
# Publish to pypi:
|
|
|
|
twine check dist/*
|
2024-11-16 02:06:00 -07:00
|
|
|
twine upload dist/*
|
|
|
|
```
|
2024-11-16 03:02:32 -07:00
|
|
|
* Reference https://packaging.python.org/en/latest/overview/
|
2024-11-16 00:24:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
# Version
|
|
|
|
|
|
|
|
setuptools_scm will infer the version based on the latest tag in your Git history.
|
|
|
|
Ensure you are tagging your commits with meaningful version numbers like v1.0.0, v1.1.0, etc.
|
2024-08-02 05:00:58 -06:00
|
|
|
|
2024-11-17 04:50:45 -07:00
|
|
|
You can view the current version number with the command:
|
|
|
|
|
|
|
|
python -m setuptools_scm
|
|
|
|
|
2024-11-15 19:44:11 -07:00
|
|
|
# License
|
|
|
|
|
|
|
|
MIT no attribution required - https://opensource.org/license/mit-0
|
|
|
|
|
|
|
|
* Allows commercial use.
|
|
|
|
* Allows modifications and closed-source derivatives.
|
|
|
|
* Fully interoperable with nearly all other open-source licenses, including GPL (when combined properly).
|
|
|
|
|
|
|
|
# See Also
|
|
|
|
|
|
|
|
* Project page: https://zavage-software.com/portfolio/app_skellington
|
|
|
|
* Please report bugs, improvements, or feedback!
|
2024-11-16 22:05:18 -07:00
|
|
|
* Contact: mat@zavage.net
|
2024-11-16 00:57:00 -07:00
|
|
|
|
2024-11-16 00:24:09 -07:00
|
|
|
* 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/
|