Package: boakboak
Aliased Shell runner for python projectsThis runs your python projects/packages from anywhere inside your shell, without the need to install the package or change directory.
NOTE: Currently only pipenvs are implemented. Only tested on Windows 10.
Feel free to clone and extend.NOTE: a sample runAlias.yml file can be found here:https://gitlab.com/larsmielke2/boakboak/-/tree/main/boakboak/appsInstallpipenv install boakboakCreate app directory and fileUserDir/boaks/archive.yml (for different app location change settings.py)run likeboak archive -m "mycomment"dependenciespython 3.9 - 3.10pyyamlProblem boakboak tries to solve?I have some python based services, which I want to run occasionally from anywhere inside the
shell using an aliased shell call.Most importantly: I dont want to install all these services into my main environment.For example:I want to save my files to a archive directory, for which I have a archive.py module.I want to convert a table to a json or yaml file for which I use a convert.py package.I want to be able to flexibly add/remove these services from the aliased shell call.UsageCreate and runAlias.yml file and name with a memorable alias.Sample names: archive.yml, cad.yml, unittest.yml, git_sy.ymlExample file:name like: /boaks/runAlias.yml (see example in directory below)save to: ... \Lib\site-packages\boakboak\apps\runAlias.ymlor save as boak_packageAlias.yml to the directory of the callable app (same directory as setup.py)NOTE: prefix boak can be changed in settings.pyRun likeboak runAlias -my parametersStepsExample: Imaginary project which uses a archive.py module to archive files and folders.I will run my module from the shell, using "python -m archive -c 'my_archive_comment'" as I always do.From the sucessfully executed shell command, I copy the path, cmds and optional args to archive.ymlI save the created .yml file in: ~/boaks/archive.ymlThe resulting .yml file has to look like this example:https://gitlab.com/larsmielke2/boakboak/-/tree/main/boakboak/appsFrom the shell, I now call:boak archive -c 'my_archive_comment'How it worksboakboak will use the parameters from apps/runAlias.yml, to run your project/packageIt takes appPath and finds your project/package (returns the first dir with .venv in it)It uses .venv file/folder or project name (if Pipfile is found), to identify the executableIt uses a subprocess call, to run your cmds using identified python.exeLoggingboakboak can log the runtime results in a logfileadd a 'logDir' and name to your .yml file like: logDir: path/to/logslog fileName will start with the name follwoed by a timestamp.logExample:logDir:  ~/python_venvs\libraries\boakboak\boakboak\test\logsname: boakboakthis will result in ...\logs\boakboak_2022-05-29-15-38-31-405411.logExternal cmdsboakboak can take cmds from another file i.e. .gitlab-ci.ymlin runAlias.yml file specify cmds like cmds: .gitlab-ci, path, to, cmdstringcmdsstring has to be a comma seperated string representing the path to the scriptExample:
runAlias.yml file:
cmds: .gitlab-ci, precommittest, script.gitlab-ci.yml file:
precommittest:
stage: test
when: manual
allow_failure: true
tags:
- test
script:
- python -m unittestresulting cmds now come from script key in .gitlab-ci.yml:
cmds: ['python', '-m', 'unittest']LicenseRelease notesVersion 1.1.1, 07-2022some improvements to param searchingdefault apps foder moved to "UserDir/boaks/..." (can be changed in settings.py)Version 1.1.0, 05-2022some improvements to param searchingparam .yml file inside package can now be named flexibly but must be prefixed with 'boak'see settings.py pgParamPrefix to change prefixVersion 1.0.9, 05-2022bugfix false executableVersion 1.0.8, 05-2022python requirement changed to 3.9 and higherrun result can now use logginguse of external file cmdsVersion 1.0.7, 05-2022python requirement changed to 3.8 and higherPipenv inside package now allowed (.venv folder inside package)Version 1.0.6, 05-2022Bugfix for Error verifying correct executable (second try)Bugfix os.sep errorVersion 1.0.5, 05-2022Bugfix for Error verifying correct executable (file not found error)app.yml file can now be held within the app directory as boakboak.ymlVersion 1.0.4, 05-2022last known executable is automatically added to apps.yml filesVersion 1.0.3, 05-2022some technical changes, i.e. README.mdVersion 1.0.0, 05-2022python 3.8 - 3.10venvs: pipenvos: tested on Windows 10
MIT LicenseCopyright (c) 2022 Lars MielkePermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.