Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Python MVC Shell Framework Package (PMVCS) is a tiny framework for shell projects making in Python 3.10+.
pip install pmvcs
or
pip3 install pmvcs
>>> python -m pmvcs.cli setup -l en
or
>>> python -m pmvcs.cli setup -language en
or
>>> pmvcs-cli setup -l en
or
>>> pmvcs-cli setup -language en
>>> python -m pmvcs.cli setup -l es
or
>>> python -m pmvcs.cli setup -language es
or
>>> pmvcs-cli setup -l es
or
>>> pmvcs-cli setup -language es
Insert APP name (default: "MyApp", leaves blank):
>>> My Test App
Insert APP folder name (default: "app", leaves blank):
>>> app
Enable debug? (default: "No")
(Y) Yes - (N) No:
>>> Y
View project information on exit? (default: "Yes")
(Y) Yes - (N) No:
>>> Y
Enable Multi-Language support? (default: "Yes")
(Y) Yes - (N) No:
>>> Y
Define default Language (default: "(1)")
(1) English - (2) Español:
>>> 2
Installs example data, use menu for multiple modules or unique module?
(E) Example data
(M) Multiple modules
(S) Unique module
Option:
>>> E -> Installs data examples, one module in menu with controller, model and view files.
>>> M -> Installs multiple modules in menu with controller, model and view files each one.
>>> S -> Installs a unique module in menu with controller file.
-------------------------------------------------
>>> Configuration has finished
>>> Thanks for choose PMVCS!
-------------------------------------------------
Press any key to continue . . .
Installs new multiple modules in menu with controller, model and view files each one. For adding new modules in menu, run the following:
>>> python -m pmvcs.cli menu -l en
o
>>> python -m pmvcs.cli menu -language en
Current APP folder name:
>>> app01
Insert module name:
>>> example_two
Insert another module
(Y) Yes - (N) No:
>>> N
-------------------------------------------------
>>> Configuration has finished
>>> Thanks for choose PMVCS!
-------------------------------------------------
Press any key to continue . . .
You can load PMVCS Helpers, for example:
old_value = str('5')
print(type(old_value))
>>> <class 'str'>
filters = self.pmvcs_helper.load_helper('filters', True)
new_value = filters.data_type(old_value)
print(type(new_value))
>>> <class 'int'>
The helper "filters" returns an integer value from a string number.
You can load custom helpers, for example:
example = self.pmvcs_helper.load_helper('example')
example.my_func()
Path to save your helper: (app_folder)/helpers/
Format in helper's file:
from pmvcs.core.helpers.base_helper import BaseHelper
class ExampleHelper(BaseHelper):
""" Class for Example Helper """
def __init__(self, **kwargs) -> None:
"""
Init PMVCS Example Helper requirements
"""
super().__init__(**kwargs)
def my_func(self):
"""
Returns a float or int value
"""
pass
In init it should have:
def __init__(self, **kwargs) -> None:
self.pmvcs_helper = kwargs['pmvcs_helper']
self.kwargs = { 'pmvcs_cfg': kwargs['pmvcs_cfg'],
'pmvcs_lang': kwargs['pmvcs_lang'],
'pmvcs_helper': kwargs['pmvcs_helper']}
And in the function that calls the helper:
def to_string_table(self, data: dict) -> str:
kwargs2 = { 'data': data,
'file_name': 'temp_file'}
kwargs2.update(self.kwargs)
table_helper = self.pmvcs_helper.load_helper('table', **kwargs2)
table_helper.record_file()
Finally in the helper we retrieve the values as:
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self._data = kwargs['data']
self._file_name = f"{kwargs['file_name']}.{self._file_extension}"
Get a configuration constant in string type from "OPTIONS":
Code: >>> self.cfg.get("EXAMPLE_CONSTANT", "OPTIONS")
Returns: This is an example value from config file
Value Type: <class 'str'>
Get a configuration constant in string type from "DEFAULT":
Code: >>> self.cfg.get("DEFAULT_TITLE", "DEFAULT")
Returns: Example App
Value Type: <class 'str'>
Get a configuration constant in integer type:
Code: >>> self.cfg.get("EXAMPLE_INT", "OPTIONS", "int")
Returns: 8
Value Type: <class 'int'>
Get a configuration constant in float type:
Code: >>> self.cfg.get("EXAMPLE_FLOAT", "OPTIONS", "float")
Returns: 1.57
Value Type: <class 'float'>
Get a configuration constant in boolean type:
Code: >>> self.cfg.get("EXAMPLE_BOOLEAN", "OPTIONS", "boolean")
Returns: True
Value Type: <class 'bool'>
Get a configuration constant in a list:
Code: >>> self.cfg.get("EXAMPLE_LIST", "OPTIONS", "list")
Returns: ['1', '2']
Value Type: <class 'list'>
Get a configuration constant in a dictionary:
Code: >>> self.cfg.get("EXAMPLE_DICT", "OPTIONS", "dict")
Returns: {'value_one': '1', 'value_two': '2'}
Value Type: <class 'dict'>
Get current language tag:
Code: >>> self.lang.tag
Returns: en
Value Type: <class 'str'>
Get a language constant:
Code: >>> self.lang.get("LANG_EXAMPLE_STRING")
Returns: This is an example string
Value Type: <class 'str'>
Get a language constant by passing a value in String-Print-Format. In the language file you will see for example: "The value here: "{}"
Code: >>> self.lang.sprintf("LANG_EXAMPLE_SPRINTF", "3")
Returns: String-Print-Format value here: "3"
Value Type: <class 'str'>
Get a language constant by passing many values in String-Print-Format. In the language file you will see: "One: "{}". Two: "{}". Three: "{}".
Code: >>> self.lang.sprintf("LANG_EXAMPLE_SPRINTF2", "1", "2", "3")
Returns: One: "1". Two: "2". Three: "3".
Value Type: <class 'str'>
Translating a string:
Code: >>> value = 'dictionary'
>>> self.lang.translate(value)
Returns: Dictionary
Value Type: <class 'str'>
This shows the banner with the App's name:
Code: >>> self.pmvcs_view.get_intro()
This shows the exit message:
Code: >>> self.pmvcs_view.get_exit()
This inserts a line break without print():
Code: >>> self.pmvcs_view.line_brake()
This inserts a line break with print():
Code: >>> self.pmvcs_view.line_brake(True)
This inserts a pause to press ENTER to start:
Code: >>> self.pmvcs_view.input_start()
This inserts a pause to press ENTER to continue:
Code: >>> self.pmvcs_view.input_pause()
This inserts a select an option input():
Code: >>> self.pmvcs_view.input_options()
This inserts a select an input():
Code: >>> self.pmvcs_view.input_generic(text)
FAQs
Python MVC Shell Framework Package is a tiny framework for shell projects in Python.
We found that pmvcs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.