Package: probable-fiesta
probable-fiestaThere's probably a fiesta somewhere.Python Package CoreA Python package core for building a Python package.InstallationInstallation using pippipinstallprobable-fiestaInstallation with automatic build and installIt is recommended to setup avirtual environment.To install locally with automatic build and install, run the following command in the root directory of the project.gitclonehttps://github.com/sergio-munoz/probable-fiesta.gitcdprobable-fiesta
chmod+xscripts/build_install.sh
./scripts/build_install.shInstallation with manual build and installSetup a new virtual environment and install packages inrequirements.txt.python-mvenvbuild_venvsourcebuild_venv/bin/activate(build_venv)$pipinstall-rbuild_requirements.txt(build_venv)$hatchbuild(build_venv)$pipinstalldist/probable_fiesta-${VERSION}.tar.gzInstallation in Jupyter NotebookTo install the into the Jupyter Notebook kernel:importsys
!{sys.executable}-mpipinstall-U--no-depsprobable-fiestaUsageprobable_fiesta--helpBuild and RunBuild and Run commandBuild and a command. Pass flags, for example--version:./scripts/build_install.sh&probable_fiesta--versionTestsAutomatic./scripts/test_coverage.shDeveloper ReferenceThis package contains various modules that can be used to build a Python package.Modulesprobable_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 ExampleCreate a new application using theprobable_fiestapackage.Create a main module, for examplemain.py:# Path: main.pyfromprobable_fiesta.config.variablesimportDotEnvDeffromprobable_fiesta.config.builder.config_builderimportConfigBuilderfromprobable_fiesta.logger.builder.logger_factoryimportLoggerFactoryfromprobable_fiesta.app.builder.context_factoryimportContextFactoryasCFfromprobable_fiesta.app.builder.app_builderimportAppBuilder# Import or add your business logic here# For example the next get version functions:defget_version_echo(version):returnversiondefget_version():return"v0"# Create custom dotenv definition from DotEnvDefclassMyDotEnvDef(DotEnvDef):def__init__(self):super().__init__()self.version_echo="v0"# This will be overwritten by .env file# make the class iterabledef__iter__(self):forattr,valueinself.__dict__.items():yieldvalue# only yield the values# Create main functiondefmain(args):# Create config, will be replaced by a Factory in the futurecB=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 appmain_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 argumentsc3=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 appmain_app.context.add_context(c3)# Check build errorsifmain_app.args_parser.error:print(main_app.args_parser.error)return# Run main apprun_context=main_app.run()history=run_context.get_run_history()print(history)returnhistoryThis allows you to call themainfunction from the command line:pythonmain.py--version