Prudentia CLI (pevx)
A development CLI tool for Prudentia internal developers.
Prerequisites
Git Hooks
This project uses pre-commit to enforce code quality and commit standards.
Configured Hooks
- pre-push: Validates that branch names contain a JIRA link for the PRVS project
- commit-msg: Ensures commit messages contain a JIRA link for the PRVS project
Setup
-
Install dependencies (including pre-commit):
uv sync --all-groups
-
Install hooks:
uv run pre-commit install --install-hooks
Manual Hook Management
- Run hooks manually:
uv run pre-commit run --all-files - Update hooks:
uv run pre-commit autoupdate
AWS CLI
The AWS CLI is a system requirement for pevx. Install it following the official AWS CLI installation guide.
AWS Configuration
Configure AWS CLI with Prudentia SSO:
aws configure sso
Follow the prompts to set up SSO authentication with your Prudentia credentials.
AWS Profile Behavior:
-
pevxuses the default AWS profile (from~/.aws/credentialsor~/.aws/config) unless otherwise specified -
To use a different profile, set the
AWS_PROFILEenvironment variable:export AWS_PROFILE=my-profile pevx uv sync
Or inline:
AWS_PROFILE=my-profile pevx uv sync
Installation
From PyPI (when published)
pip install pevx
Development Mode
Clone the repository and install in development mode using uv:
git clone https://github.com/Prudentia-Sciences/pevx
cd pevx
uv sync
Usage
After installation, you can use the CLI with the pevx command:
# Show help
pevx --help
# Show version
pevx --version
Available Commands
uv [args]
Proxy to uv with AWS CodeArtifact authentication.
pevx uv add [package] --domain custom-domain --domain-owner 123456789 --repo custom-repo --region us-west-2
Important: This command requires access to the Prudentia 'Shared-Infra' AWS account. Ensure your AWS profile is configured with appropriate permissions for this account.
Default values:
- Domain: prudentia-sciences
- Domain Owner: 728222516696
- Repository: pypi-store
- Region: us-east-1
docker [args]
Proxy to docker with AWS ECR authentication.
aws-each [args]
Assume a role in each target AWS account using OIDC and run an AWS CLI command.
pevx aws-each --accounts '["111111111111","222222222222"]' s3 ls
Options:
--accounts: JSON list of AWS account IDs (required, or setTARGET_ACCOUNTSenv var)--role-name: IAM Role name to assume (default:github-actions-backend-role)--continue-on-error/--fail-fast: Continue with remaining accounts on failure
pyclient
Generate a Python client from a FastAPI OpenAPI spec.
pevx pyclient --app-path app.main:app
Options:
--pyproject: Path to pyproject.toml (default:pyproject.toml)--app-path: Python path to FastAPI app (default:app.main:app)--project-name: Distribution name for the generated client (default: the[project]name inpyproject.toml)
Set --project-name when the client must publish under a different name from the service
it is generated from, so that the two do not collide on publish:
pevx pyclient --project-name diligence-service-client
This renames three things together, not just the published distribution:
| Without the option | With --project-name diligence-service-client |
|
|---|---|---|
| Distribution name | diligence-service |
diligence-service-client |
| Output directory | ./diligence-service/ |
./diligence-service-client/ |
| Import package | diligence_service |
diligence_service_client |
The directory rename is the one that catches callers out. Under --meta poetry,
openapi-python-client derives the output directory from the distribution name, so
anything that cds into the generated tree afterwards - a build step, a CI workflow
input - has to use the same value. In [dot-github] backend-release-publish.yml that
means client_project_name and client_package_directory must be set in lockstep.
The version is deliberately not overridable: the client tracks the version of the service it was generated from.
Development
Adding New Commands
- Create a new file in the
src/pevx/commands/directory for your command - Implement your command using Click
- Import and register your command in
src/pevx/cli.py
Example:
# In src/pevx/commands/my_command.py
import click
@click.command()
def my_command():
"""Command description."""
click.echo("Running my command")
# In src/pevx/cli.py, add:
from pevx.commands.my_command import my_command
cli.add_command(my_command)
CI/CD and Versioning
This project uses semantic-release for automated versioning:
- Automated Testing: Runs tests on Python 3.12
- Semantic Versioning: Automatically determines version from commit messages
- Automated Publishing: Builds and publishes to PyPI on new versions
Commit Message Format
Use conventional commit messages:
<type>(<scope>): <description>
Common types:
fix: Bug fixes (PATCH bump)feat: New features (MINOR bump)feat!,fix!: Breaking changes (MAJOR bump)
Metadata
Release files for pevx 1.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pevx-1.7.0.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pevx-1.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.4 kB
Release files / pevx-1.7.0.tar.gz
| Download URL | pevx-1.7.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c952eab0e0bdbc08566dc51b1b1c17d00be71c9cff7f5f0d187cae9f2014e3ff
|
|
BLAKE2b-256 checksum How to use checksums |
8d48364bd82d6bd445c76488e1a849e677a8883876e1c0ba960f03d701ac53e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / pevx-1.7.0-py3-none-any.whl
| Download URL | pevx-1.7.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec5945874341e9ae77ac4f107d3eac466b8ce77717f643181fa342993f9ef7e0
|
|
BLAKE2b-256 checksum How to use checksums |
a52622f6caa49aa522382c5eee617cb826df30e4fabfa500ec3e68598358a00e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|