Name | probable-fiesta JSON |
Version |
0.2.5
JSON |
| download |
home_page | |
Summary | Python Core Package. |
upload_time | 2023-09-05 20:44:52 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.7 |
license | BSD 3-Clause License Copyright (c) 2023, Sergio M Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# probable-fiesta
[](https://github.com/sergio-munoz/probable-fiesta/actions/workflows/python_app.yml) [](https://github.com/sergio-munoz/probable-fiesta/actions/workflows/python_publish.yml) [](https://wakatime.com/badge/user/1e0e8b49-a94f-431f-8ca2-93081dfb4c8b/project/0dca8cc1-046e-4345-a174-50d11cad482b)
> There's probably a fiesta somewhere.
Python Package Core
A Python package core for building a Python package.
## Installation
## Installation using pip
```bash
pip install probable-fiesta
```
## Installation with automatic build and install
> It is recommended to setup a [virtual environment](https://docs.python.org/3/library/venv.html).
To install locally with automatic build and install, run the following command in the root directory of the project.
```bash
git clone https://github.com/sergio-munoz/probable-fiesta.git
cd probable-fiesta
chmod +x scripts/build_install.sh
./scripts/build_install.sh
```
## Installation with manual build and install
Setup a new virtual environment and install packages in `requirements.txt`.
```bash
python -m venv build_venv
source build_venv/bin/activate
(build_venv) $ pip install -r build_requirements.txt
(build_venv) $ hatch build
(build_venv) $ pip install dist/probable_fiesta-${VERSION}.tar.gz
```
### Installation in Jupyter Notebook
To install the into the Jupyter Notebook kernel:
```bash
import sys
!{sys.executable} -m pip install -U --no-deps probable-fiesta
```
## Usage
```bash
probable_fiesta --help
```
## Build and Run
### Build and Run command
Build and a command. Pass flags, for example `--version`:
```bash
./scripts/build_install.sh & probable_fiesta --version
```
## Tests
### Automatic
```bash
./scripts/test_coverage.sh
```
## Developer Reference
This package contains various modules that can be used to build a Python package.
### Modules
- `probable_fiesta`: Main module.
- `probable_fiesta.app`: Main application.
- `probable_fiesta.app.main`: Main application.
- `probable_fiesta.cli`: Command line interface.
- `probable_fiesta.command`: Internal command implementation.
- `probable_fiesta.config`: Configuration.
- `probable_fiesta.logger`: Logging.
### Create Application Example
Create a new application using the `probable_fiesta` package.
- Create a main module, for example `main.py`:
```python
# Path: main.py
from probable_fiesta.config.variables import DotEnvDef
from probable_fiesta.config.builder.config_builder import ConfigBuilder
from probable_fiesta.logger.builder.logger_factory import LoggerFactory
from probable_fiesta.app.builder.context_factory import ContextFactory as CF
from probable_fiesta.app.builder.app_builder import AppBuilder
# Import or add your business logic here
# For example the next get version functions:
def get_version_echo(version):
return version
def get_version():
return "v0"
# Create custom dotenv definition from DotEnvDef
class MyDotEnvDef(DotEnvDef):
def __init__(self):
super().__init__()
self.version_echo = "v0" # This will be overwritten by .env file
# make the class iterable
def __iter__(self):
for attr, value in self.__dict__.items():
yield value # only yield the values
# Create main function
def main(args):
# Create config, will be replaced by a Factory in the future
cB = ConfigBuilder()
config = (
cB.logger.set_logger(
LoggerFactory.new_logger_get_logger("main_app", "INFO")
)
.dotenv.load_dotenv() # Load .env file if exists
.set_vars(MyDotEnvDef())
.build()
)
# Create main app
main_app = (
aB.name.set_name("main_app")
.arguments.set_arguments(args)
# Add your arguments
.args_parser.add_argument(
"--version", action="store_true", help="show version builder"
)
# Add your commands that do not require parsed arguments
.context.add_context(
CF.new_context_one_new_command("version", "version", get_version, None)
)
# Define which are executable
.set_executables(["version"])
.config.set_config(config)
.validate()
.build()
)
# Create commands that require parsed arguments
c3 = CF.new_context_one_new_command(
"--version-echo",
"version_echo",
get_version_echo,
main_app.get_arg("version_echo"), # CLI overrides .env
)
# Add commands to main app
main_app.context.add_context(c3)
# Check build errors
if main_app.args_parser.error:
print(main_app.args_parser.error)
return
# Run main app
run_context = main_app.run()
history = run_context.get_run_history()
print(history)
return history
```
This allows you to call the `main` function from the command line:
```bash
python main.py --version
```
Raw data
{
"_id": null,
"home_page": "",
"name": "probable-fiesta",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "",
"author_email": "Sergio Munoz <sergio.munoz@pubnub.com>",
"download_url": "https://files.pythonhosted.org/packages/8b/32/aa86978e777c3d6a8412bf031cf204d566912ec69d68ce8616398def236e/probable_fiesta-0.2.5.tar.gz",
"platform": null,
"description": "# probable-fiesta\n\n[](https://github.com/sergio-munoz/probable-fiesta/actions/workflows/python_app.yml) [](https://github.com/sergio-munoz/probable-fiesta/actions/workflows/python_publish.yml) [](https://wakatime.com/badge/user/1e0e8b49-a94f-431f-8ca2-93081dfb4c8b/project/0dca8cc1-046e-4345-a174-50d11cad482b)\n\n> There's probably a fiesta somewhere.\n\nPython Package Core \n\nA Python package core for building a Python package.\n\n## Installation\n\n## Installation using pip\n\n\n```bash\npip install probable-fiesta\n```\n\n## Installation with automatic build and install\n\n\n> It is recommended to setup a [virtual environment](https://docs.python.org/3/library/venv.html).\n\nTo install locally with automatic build and install, run the following command in the root directory of the project.\n\n```bash\ngit clone https://github.com/sergio-munoz/probable-fiesta.git\ncd probable-fiesta\nchmod +x scripts/build_install.sh\n./scripts/build_install.sh\n```\n\n## Installation with manual build and install\n\nSetup a new virtual environment and install packages in `requirements.txt`.\n\n```bash\npython -m venv build_venv\nsource build_venv/bin/activate\n(build_venv) $ pip install -r build_requirements.txt\n(build_venv) $ hatch build\n(build_venv) $ pip install dist/probable_fiesta-${VERSION}.tar.gz\n```\n\n### Installation in Jupyter Notebook\n\nTo install the into the Jupyter Notebook kernel:\n\n```bash\nimport sys\n!{sys.executable} -m pip install -U --no-deps probable-fiesta\n```\n\n## Usage\n\n```bash\nprobable_fiesta --help\n```\n\n## Build and Run\n\n### Build and Run command\n\nBuild and a command. Pass flags, for example `--version`:\n\n```bash\n./scripts/build_install.sh & probable_fiesta --version\n```\n\n## Tests\n\n### Automatic\n\n```bash\n./scripts/test_coverage.sh\n```\n\n## Developer Reference\n\nThis package contains various modules that can be used to build a Python package.\n\n### Modules\n\n- `probable_fiesta`: Main module.\n- `probable_fiesta.app`: Main application.\n- `probable_fiesta.app.main`: Main application.\n- `probable_fiesta.cli`: Command line interface.\n- `probable_fiesta.command`: Internal command implementation.\n- `probable_fiesta.config`: Configuration.\n- `probable_fiesta.logger`: Logging.\n\n### Create Application Example\n\nCreate a new application using the `probable_fiesta` package.\n\n- Create a main module, for example `main.py`:\n\n```python\n# Path: main.py\nfrom probable_fiesta.config.variables import DotEnvDef\nfrom probable_fiesta.config.builder.config_builder import ConfigBuilder\nfrom probable_fiesta.logger.builder.logger_factory import LoggerFactory\nfrom probable_fiesta.app.builder.context_factory import ContextFactory as CF\nfrom probable_fiesta.app.builder.app_builder import AppBuilder\n\n# Import or add your business logic here\n# For example the next get version functions:\ndef get_version_echo(version):\n return version\ndef get_version():\n return \"v0\"\n\n# Create custom dotenv definition from DotEnvDef\nclass MyDotEnvDef(DotEnvDef):\n def __init__(self):\n super().__init__()\n self.version_echo = \"v0\" # This will be overwritten by .env file\n\n # make the class iterable\n def __iter__(self):\n for attr, value in self.__dict__.items():\n yield value # only yield the values\n\n# Create main function\ndef main(args):\n # Create config, will be replaced by a Factory in the future\n cB = ConfigBuilder()\n config = (\n cB.logger.set_logger(\n LoggerFactory.new_logger_get_logger(\"main_app\", \"INFO\")\n )\n .dotenv.load_dotenv() # Load .env file if exists\n .set_vars(MyDotEnvDef())\n .build()\n )\n\n # Create main app\n main_app = (\n aB.name.set_name(\"main_app\")\n .arguments.set_arguments(args)\n # Add your arguments\n .args_parser.add_argument(\n \"--version\", action=\"store_true\", help=\"show version builder\"\n )\n # Add your commands that do not require parsed arguments\n .context.add_context(\n CF.new_context_one_new_command(\"version\", \"version\", get_version, None)\n )\n # Define which are executable\n .set_executables([\"version\"])\n .config.set_config(config)\n .validate()\n .build()\n )\n\n # Create commands that require parsed arguments\n c3 = CF.new_context_one_new_command(\n \"--version-echo\",\n \"version_echo\",\n get_version_echo,\n main_app.get_arg(\"version_echo\"), # CLI overrides .env\n )\n # Add commands to main app\n main_app.context.add_context(c3)\n\n # Check build errors\n if main_app.args_parser.error:\n print(main_app.args_parser.error)\n return\n\n # Run main app\n run_context = main_app.run()\n history = run_context.get_run_history()\n print(history)\n return history\n```\n\nThis allows you to call the `main` function from the command line:\n\n```bash\npython main.py --version\n```\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License Copyright (c) 2023, Sergio M Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "Python Core Package.",
"version": "0.2.5",
"project_urls": {
"Bug Tracker": "https://github.com/sergio-munoz/probable_fiesta/issues",
"Documentation": "https://github.com/sergio-munoz/probable_fiesta#readme",
"Homepage": "https://github.com/sergio-munoz/probable_fiesta/",
"Issues": "https://github.com/sergio-munoz/probable_fiesta/issues",
"Source": "https://github.com/sergio-munoz/probable_fiesta"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ec13f1a9ccf443d942a902abb9c125e63136263a8c7759281f638fa10b5840e9",
"md5": "2c239abf71e9ead6bb8fe8f2244d9253",
"sha256": "bff8ecad9f7e712e75e0503d389c8311b46f402d6cc52eab85010902a2f4fa9e"
},
"downloads": -1,
"filename": "probable_fiesta-0.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c239abf71e9ead6bb8fe8f2244d9253",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 28142,
"upload_time": "2023-09-05T20:44:49",
"upload_time_iso_8601": "2023-09-05T20:44:49.940561Z",
"url": "https://files.pythonhosted.org/packages/ec/13/f1a9ccf443d942a902abb9c125e63136263a8c7759281f638fa10b5840e9/probable_fiesta-0.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8b32aa86978e777c3d6a8412bf031cf204d566912ec69d68ce8616398def236e",
"md5": "bd47ff6c1d70642b6aa573e9f0ea62be",
"sha256": "c8e458ac94f745696fcdfca045f8f4344cd4409d2d119e69cc36e08498cc5e35"
},
"downloads": -1,
"filename": "probable_fiesta-0.2.5.tar.gz",
"has_sig": false,
"md5_digest": "bd47ff6c1d70642b6aa573e9f0ea62be",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 101889,
"upload_time": "2023-09-05T20:44:52",
"upload_time_iso_8601": "2023-09-05T20:44:52.745267Z",
"url": "https://files.pythonhosted.org/packages/8b/32/aa86978e777c3d6a8412bf031cf204d566912ec69d68ce8616398def236e/probable_fiesta-0.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-05 20:44:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sergio-munoz",
"github_project": "probable_fiesta",
"github_not_found": true,
"lcname": "probable-fiesta"
}