probable-fiesta
There's probably a fiesta somewhere.
Python Package Core
A Python package core for building a Python package.
Installation
Installation using pip
pip install probable-fiesta
Installation with automatic build and install
It is recommended to setup a virtual environment.
To install locally with automatic build and install, run the following command in the root directory of the project.
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.
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:
import sys
!{sys.executable} -m pip install -U --no-deps probable-fiesta
Usage
probable_fiesta --help
Build and Run
Build and Run command
Build and a command. Pass flags, for example --version:
./scripts/build_install.sh & probable_fiesta --version
Tests
Automatic
./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:
# 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:
python main.py --version
Metadata
Release files for probable-fiesta 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| probable_fiesta-0.2.5.tar.gz | 101.9 kB | Without provenance | Details for probable_fiesta-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| probable_fiesta-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for probable_fiesta-0.2.5-py3-none-any.whl |
Total release size: 130.0 kB
Release files / probable_fiesta-0.2.5.tar.gz
| Download URL | probable_fiesta-0.2.5.tar.gz |
|---|---|
| Size | 101.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8e458ac94f745696fcdfca045f8f4344cd4409d2d119e69cc36e08498cc5e35
|
|
BLAKE2b-256 checksum How to use checksums |
8b32aa86978e777c3d6a8412bf031cf204d566912ec69d68ce8616398def236e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / probable_fiesta-0.2.5-py3-none-any.whl
| Download URL | probable_fiesta-0.2.5-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bff8ecad9f7e712e75e0503d389c8311b46f402d6cc52eab85010902a2f4fa9e
|
|
BLAKE2b-256 checksum How to use checksums |
ec13f1a9ccf443d942a902abb9c125e63136263a8c7759281f638fa10b5840e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for probable-fiesta 0.2.5
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.