chassis2024


Namechassis2024 JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/LionKimbro/chassis2024
Summarya flexible chassis for assembling Python programs from parts
upload_time2024-01-29 11:22:56
maintainer
docs_urlNone
authorLion Kimbro
requires_python>=3.7
license
keywords chassis framework infrastructure
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Chassis 2024

Automatically sequence infrastructure initialization and teardown.

#### Installation

```
pip install chassis2024
```

### Brief Explanation

*(This is just a teaser.  [Read the github project pages for more details and a full tutorial.](https://github.com/LionKimbro/chassis2024))*

The idea of chassis2024 to make it so that you quickly reuse infrastructure.

"Infrastructure" here means things like:
* writing a lock file for your program
* reading config files
* setting up a GUI system (like tkinter), and running a main loop
* populating and processing argparse
* reading a persistence file, and writing back to it when closing

I wanted to make it trivial to combine infrastructure like these, together.

The central challenge was making sure that infrastructure steps are followed in the correct order.


### An Example: Hello, world!

Here's a "Hello, world!" program:

```
import sys

import chassis2024
import chassis2024.basicrun


CHASSIS2024_SPEC = {
    "INTERFACES": {"RUN": sys.modules[__name__]}
}


# interface: RUN
def run():
    print("Hello, world!")


if __name__ == "__main__":
    chassis2024.run()
```

## Execution Nodes

Chassis 2024 infrastructure positions itself  within an execution graph.

By default, the execution graph is very basic:

* #1 **CLEAR** -- the program begins
* #2 **RESET** -- the program is initialized
* #3 **ARGPARSE** -- Command Line arguments are parsed
* #4 **CONNECT** -- files are loaded, resources are connected
* #5 **ACTIVATE** -- user interface systems are activated
* #6 **UP** -- the program is running, main loop operations commense

This built-in system is fixed, but there is no default implementation, and it is very flexible, because Chassis 2024 infrastructure can extend the graph via module declarations.

An example from the ```chassis2024.argparse``` package:

```
CHASSIS2024_SPEC = {
    EXECUTES_GRAPH_NODES: [CLEAR_ARGPARSE, RESET_ARGPARSE, ARGPARSE],
    EXECUTION_GRAPH_SEQUENCES: [(CLEAR, CLEAR_ARGPARSE, RESET, RESET_ARGPARSE, ARGPARSE)],
    INTERFACES: {ARGPARSE: sys.modules[__name__]}
}
```

## Interfaces

The infrastructure pieces glue to one another through "interfaces."  Any object or module can be at the end of an interface, but ***only one*** thing can implement a given interface.

Similarly, each execution node can activate ***only one*** function.

## More Complex Example

```

import sys

import chassis2024
import chassis2024.basicrun
import chassis2024.argparse
import chassis2024.basicjsonpersistence
from chassis2024.words import *
from chassis2024.argparse.words import *
from chassis2024.basicjsonpersistence.words import *


this_module = sys.modules[__name__]


CHASSIS2024_SPEC = {
    INTERFACES: {RUN: this_module,
                 ARGPARSE_CONFIGURE: this_module}
}

EXECUTION_SPEC = {
    BASICJSONPERSISTENCE: {
        SAVE_AT_EXIT: True,
        CREATE_FOLDER: False,
        FILEPATH: "./echo_persistence_data.json"
    }
}


# interface: ARGPARSE_CONFIGURE
def argparse_configure(parser):
    parser.add_argument("-e", "--echo",
                        help="input string to echo",
                        default=None)
    parser.add_argument("-r", "--repeat-last",
                        dest="repeat",
                        help="repeat the last used echo string",
                        action="store_true")
    chassis2024.basicjsonpersistence.argparse_configure(parser)

# interface: RUN
def run():
    argparser = chassis2024.interface(ARGPARSE, required=True)
    D = chassis2024.interface(PERSISTENCE_DATA, required=True).data()
    if argparser.args.echo is not None:
        print(argparser.args.echo)
        D["msg"] = argparser.args.echo  # saved automatically
    else:
        print(D.get("msg", "use -e to specify string to echo"))


if __name__ == "__main__":
    chassis2024.run()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LionKimbro/chassis2024",
    "name": "chassis2024",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "chassis,framework,infrastructure",
    "author": "Lion Kimbro",
    "author_email": "Lion Kimbro <lionkimbro@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/75/d0/b3bc1a719fecaf7e1c503573c9850675956af2975f17d0a61bcb2a9eeaa6/chassis2024-1.0.0.tar.gz",
    "platform": null,
    "description": "# Chassis 2024\r\n\r\nAutomatically sequence infrastructure initialization and teardown.\r\n\r\n#### Installation\r\n\r\n```\r\npip install chassis2024\r\n```\r\n\r\n### Brief Explanation\r\n\r\n*(This is just a teaser.  [Read the github project pages for more details and a full tutorial.](https://github.com/LionKimbro/chassis2024))*\r\n\r\nThe idea of chassis2024 to make it so that you quickly reuse infrastructure.\r\n\r\n\"Infrastructure\" here means things like:\r\n* writing a lock file for your program\r\n* reading config files\r\n* setting up a GUI system (like tkinter), and running a main loop\r\n* populating and processing argparse\r\n* reading a persistence file, and writing back to it when closing\r\n\r\nI wanted to make it trivial to combine infrastructure like these, together.\r\n\r\nThe central challenge was making sure that infrastructure steps are followed in the correct order.\r\n\r\n\r\n### An Example: Hello, world!\r\n\r\nHere's a \"Hello, world!\" program:\r\n\r\n```\r\nimport sys\r\n\r\nimport chassis2024\r\nimport chassis2024.basicrun\r\n\r\n\r\nCHASSIS2024_SPEC = {\r\n    \"INTERFACES\": {\"RUN\": sys.modules[__name__]}\r\n}\r\n\r\n\r\n# interface: RUN\r\ndef run():\r\n    print(\"Hello, world!\")\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    chassis2024.run()\r\n```\r\n\r\n## Execution Nodes\r\n\r\nChassis 2024 infrastructure positions itself  within an execution graph.\r\n\r\nBy default, the execution graph is very basic:\r\n\r\n* #1 **CLEAR** -- the program begins\r\n* #2 **RESET** -- the program is initialized\r\n* #3 **ARGPARSE** -- Command Line arguments are parsed\r\n* #4 **CONNECT** -- files are loaded, resources are connected\r\n* #5 **ACTIVATE** -- user interface systems are activated\r\n* #6 **UP** -- the program is running, main loop operations commense\r\n\r\nThis built-in system is fixed, but there is no default implementation, and it is very flexible, because Chassis 2024 infrastructure can extend the graph via module declarations.\r\n\r\nAn example from the ```chassis2024.argparse``` package:\r\n\r\n```\r\nCHASSIS2024_SPEC = {\r\n    EXECUTES_GRAPH_NODES: [CLEAR_ARGPARSE, RESET_ARGPARSE, ARGPARSE],\r\n    EXECUTION_GRAPH_SEQUENCES: [(CLEAR, CLEAR_ARGPARSE, RESET, RESET_ARGPARSE, ARGPARSE)],\r\n    INTERFACES: {ARGPARSE: sys.modules[__name__]}\r\n}\r\n```\r\n\r\n## Interfaces\r\n\r\nThe infrastructure pieces glue to one another through \"interfaces.\"  Any object or module can be at the end of an interface, but ***only one*** thing can implement a given interface.\r\n\r\nSimilarly, each execution node can activate ***only one*** function.\r\n\r\n## More Complex Example\r\n\r\n```\r\n\r\nimport sys\r\n\r\nimport chassis2024\r\nimport chassis2024.basicrun\r\nimport chassis2024.argparse\r\nimport chassis2024.basicjsonpersistence\r\nfrom chassis2024.words import *\r\nfrom chassis2024.argparse.words import *\r\nfrom chassis2024.basicjsonpersistence.words import *\r\n\r\n\r\nthis_module = sys.modules[__name__]\r\n\r\n\r\nCHASSIS2024_SPEC = {\r\n    INTERFACES: {RUN: this_module,\r\n                 ARGPARSE_CONFIGURE: this_module}\r\n}\r\n\r\nEXECUTION_SPEC = {\r\n    BASICJSONPERSISTENCE: {\r\n        SAVE_AT_EXIT: True,\r\n        CREATE_FOLDER: False,\r\n        FILEPATH: \"./echo_persistence_data.json\"\r\n    }\r\n}\r\n\r\n\r\n# interface: ARGPARSE_CONFIGURE\r\ndef argparse_configure(parser):\r\n    parser.add_argument(\"-e\", \"--echo\",\r\n                        help=\"input string to echo\",\r\n                        default=None)\r\n    parser.add_argument(\"-r\", \"--repeat-last\",\r\n                        dest=\"repeat\",\r\n                        help=\"repeat the last used echo string\",\r\n                        action=\"store_true\")\r\n    chassis2024.basicjsonpersistence.argparse_configure(parser)\r\n\r\n# interface: RUN\r\ndef run():\r\n    argparser = chassis2024.interface(ARGPARSE, required=True)\r\n    D = chassis2024.interface(PERSISTENCE_DATA, required=True).data()\r\n    if argparser.args.echo is not None:\r\n        print(argparser.args.echo)\r\n        D[\"msg\"] = argparser.args.echo  # saved automatically\r\n    else:\r\n        print(D.get(\"msg\", \"use -e to specify string to echo\"))\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    chassis2024.run()\r\n```\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "a flexible chassis for assembling Python programs from parts",
    "version": "1.0.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/lionkimbro/chassis2024/issues",
        "Homepage": "https://github.com/lionkimbro/chassis2024"
    },
    "split_keywords": [
        "chassis",
        "framework",
        "infrastructure"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53d49a32335eb60ce53f65228ab4bf9b23681db18b68f9f71dbf869ff4ab275e",
                "md5": "215ed2ca94304b4744b5b5671d527bf8",
                "sha256": "919adb9948053abf3b01f0a29884292657bd7e84080ed60709faea5396537e57"
            },
            "downloads": -1,
            "filename": "chassis2024-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "215ed2ca94304b4744b5b5671d527bf8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16230,
            "upload_time": "2024-01-29T11:22:55",
            "upload_time_iso_8601": "2024-01-29T11:22:55.046063Z",
            "url": "https://files.pythonhosted.org/packages/53/d4/9a32335eb60ce53f65228ab4bf9b23681db18b68f9f71dbf869ff4ab275e/chassis2024-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75d0b3bc1a719fecaf7e1c503573c9850675956af2975f17d0a61bcb2a9eeaa6",
                "md5": "e44259e34bec908b4d04d038042b8fc1",
                "sha256": "74e746209a84011eb77abc0cbfef5885b00d758b6517096bb5e56f9391ff95cd"
            },
            "downloads": -1,
            "filename": "chassis2024-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e44259e34bec908b4d04d038042b8fc1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 14828,
            "upload_time": "2024-01-29T11:22:56",
            "upload_time_iso_8601": "2024-01-29T11:22:56.716083Z",
            "url": "https://files.pythonhosted.org/packages/75/d0/b3bc1a719fecaf7e1c503573c9850675956af2975f17d0a61bcb2a9eeaa6/chassis2024-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-29 11:22:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LionKimbro",
    "github_project": "chassis2024",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "chassis2024"
}
        
Elapsed time: 0.23008s