CLI
This comprehensive guide aims to provide you with all the necessary information to effectively utilize the command-line interface (CLI) tools offered by petisco. Whether you are a beginner or an experienced developer, this documentation will help you harness the full potential of our CLI tools and streamline your development process.
You can check installed version of petisco with:
Or generate a random UUID v4 with:
And also print the current utcnow
:
petisco-dev
¶
Provides various commands to help you interact with and manage your petisco-based application.
This is what petisco-dev
provides us:
$ petisco-dev --help
petisco dev tools to inspect your application
options:
-h, --help show this help message and exit
-i, --info show petisco app info.
-deps, --dependencies
show petisco app dependencies.
-configs, --configurers
show petisco app configurers.
-sql-models, --sql-models
show petisco sql models.
-declarative-base DECLARATIVE_BASE, --declarative-base DECLARATIVE_BASE
path to DeclarativeBase, a class to gather all the SQL models
--application APPLICATION
Module path (default app.application)
Info
If rich
package is installed, information will use it to show valuable information in a fancy way.
Show info¶
$ petisco-dev --info
โญโโโโโโโโโโ Petisco Application โโโโโโโโโโโโฎ
โ name: my-petisco-app โ
โ version: 1.0.1 โ
โ organization: alice โ
โ deployed_at: 2023-05-16 10:41:39 โ
โ dependencies: 1 โ
โ configurers: 2 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Show dependencies¶
$ petisco-dev --dependencies
โโโโโโโโโโโโณโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโ
โ TypeโDefault โImplementation โENV โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โRepositoryโSqlRepositoryโfake: FakeRepositoryโREPOSITORY_TYPEโ
โโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโ
Show configurers¶
$ petisco-dev --configurers
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Configurer โ execute_after_dependencies โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ PersistenceConfigurer โ False โ
โ RabbitMqMessageConfigurer โ True โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Help
This information is obtained from instantiating a petisco.Application
.
By default, petisco-dev
searches this application in the module app.application
:
from petisco.extra.fastapi import FastApiApplication
from app import (
APPLICATION_LATEST_DEPLOY,
APPLICATION_NAME,
APPLICATION_VERSION,
ORGANIZATION,
)
from app.fastapi import fastapi_configurer
from app.petisco.configurers.configurers import configurers
from app.petisco.dependencies.dependencies_provider import dependencies_provider
application = FastApiApplication(
name=APPLICATION_NAME,
version=APPLICATION_VERSION,
organization=ORGANIZATION,
deployed_at=APPLICATION_LATEST_DEPLOY,
dependencies_provider=dependencies_provider,
configurers=configurers,
fastapi_configurer=fastapi_configurer,
)
If your application is defined in other file, you can modify it with petisco-dev --info --application app.other.module.application
.
Show SQL Models¶
To show SQL models inheriting from petisco.extra.sqlalchemy.SqlBase
use the following command:
$ petisco-dev --sql-models
โโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Model โ Filename โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ SqlUser โ app/src/infrastructure/models/sql_user.py โ
โ SqlClient โ app/src/infrastructure/models/sql_client.py โ
โโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
If you want to specify your own implementation of your DeclarativeBase
just pass the path to your extension
$ petisco-dev --sql-models --declarative-base app.models.extended_declarative_base.ExtendedDeclarativeBase
โโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Model โ Filename โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ OtherUser โ app/models/other_user.py โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ