Skip to main content

Python MVC Shell Framework Package

About the package

Python MVC Shell Framework Package (PMVCS) is a tiny framework for shell projects making in Python 3.10+.

PMVCS

Install with pip3

pip install pmvcs

or

pip3 install pmvcs

Settings from console in english

>>> 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

Settings from console in spanish

>>> 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

Setup, step by step:

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 . . .

Add a new Multiple modules

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 . . .

PMVCS Helpers

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.

Custom Helpers

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

Custom Helpers: Pass variables:

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 configuration constants from config.ini:

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 language constants from languages/en.ini:

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'>

Using PMVCS View functions

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)

PMVCS captures

PMVCS intro language selection

PMVCS menus for multiple modules

PMVCS runing module

PMVCS implementation examples

Repository

Metadata

Release files for pmvcs 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pmvcs 1.0.4
File Size Uploaded Provenance Actions
pmvcs-1.0.4.tar.gz 70.3 kB Without provenance Details for pmvcs-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pmvcs 1.0.4
File Interpreter ABI Platform Actions
pmvcs-1.0.4-py3-none-any.whl Python 3 none any Details for pmvcs-1.0.4-py3-none-any.whl

Total release size: 202.9 kB

Release files / pmvcs-1.0.4.tar.gz

Download URL pmvcs-1.0.4.tar.gz
Size 70.3 kB
Tags Source
SHA-256 checksum
How to use checksums
76798f44f51c45366b1e34c0dca49223030d679d458d1a587b048d50070ac974
BLAKE2b-256 checksum
How to use checksums
31457f9f972e958336780cdc291300969e0dc9b4c2f5a4f971cf177fd68a9798
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release files / pmvcs-1.0.4-py3-none-any.whl

Download URL pmvcs-1.0.4-py3-none-any.whl
Size 132.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bba313e0ebce5baf9cfbe3255a0154b4ef06cfa2f5b61a5e8694f6f5bbf74d8
BLAKE2b-256 checksum
How to use checksums
2070db30b1dccbe827f1ef6a7eb1531d142d1ffa0234004f141a24adfe3e4e81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Security for pmvcs 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page