CLI for Django and SaaS Pegasus
Project description
pegasus-cli
Demo
A demo is worth 1,000 words. Click the image below to see the Pegasus CLI in action:
Overview
The Pegasus CLI is a command-line tool that streamlines the process of working in a Django project. It is currently designed to work with the SaaS Pegasus Django boilerplate, but can be used more generally for any Django project (and will be updated to work with generic Django projects in the future).
It is currently geared around the startapp command. This will create a new app in your Django project,
and (optionally) spin up an entire Create / Update / Delete (CRUD) interface for it, built with
Django forms and HTMX.
Example usage:
pegasus startapp todos Project Todo
This will create a todos app in your Django project with models, URLs, views and templates to
work with a Project and Todo model.
Installation
Install this tool using pip:
pip install pegasus-cli
Usage
For help, run:
pegasus --help
You can also use:
python -m pegasus --help
Configuration
You can run pegasus startapp --help for configuration options.
In addition to the command-line options, you can also set default values for configuration
options by creating a pegasus-config.yaml file in your project directory.
The format of the file is:
cli:
app_directory: apps
module_path: apps
template_directory: templates
base_model: apps.teams.models.BaseTeamModel
use_teams: true
The above configuration is the recommended configuration for SaaS Pegasus projects
(with teams turned on, else set use_teams: false and base_model: apps.utils.models.BaseModel).
A recommended default configuration for your project will be included in your project's pegasus-config.yaml
file if you are on Pegasus version 2024.9 or later.
The Pegasus config will create your apps in the apps directory, and will use the templates directory for your templates.
Pushing to GitHub
You can use the CLI to push your Pegasus project to GitHub directly from the command line.
Setup
First, authenticate with your Pegasus API key:
pegasus auth
This will prompt for your API key and save it to ~/.pegasus/credentials.
You can also set the PEGASUS_API_KEY environment variable instead.
Listing projects
To see your available projects:
pegasus projects list
Pushing to GitHub
To push a project to GitHub by ID:
pegasus projects push <project_id>
If you don't specify a project ID, you'll be prompted to choose from your projects:
pegasus projects push
To upgrade to the latest Pegasus version before pushing:
pegasus projects push <project_id> --upgrade
To upgrade to the latest development build instead of the stable release:
pegasus projects push <project_id> --upgrade --dev
The CLI will show progress as the build runs and print the pull request or repository URL when complete.
Custom server URL
By default, commands use https://www.saaspegasus.com.
To use a different server, pass --base-url or set PEGASUS_BASE_URL:
pegasus projects --base-url https://your-server.com list
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd cli
python -m venv venv
source venv/bin/activate
Now install the dependencies and dev dependencies:
pip install -e '.[dev]'
To run the tests:
pytest
Setup pre-commit hooks:
pre-commit install
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pegasus_cli-0.12.tar.gz.
File metadata
- Download URL: pegasus_cli-0.12.tar.gz
- Upload date:
- Size: 23.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08af247ee811a397b1267700b054d7bc3f07bafc9a297561c4d6c23ac39595f7
|
|
| MD5 |
3545463f10b81b25afe891df0c6e0d69
|
|
| BLAKE2b-256 |
7e39c2ef5266d8a40bbe6768274e036cdc94c9750c5c025e3153de732e14953f
|
Provenance
The following attestation bundles were made for pegasus_cli-0.12.tar.gz:
Publisher:
publish.yml on saaspegasus/pegasus-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pegasus_cli-0.12.tar.gz -
Subject digest:
08af247ee811a397b1267700b054d7bc3f07bafc9a297561c4d6c23ac39595f7 - Sigstore transparency entry: 936673154
- Sigstore integration time:
-
Permalink:
saaspegasus/pegasus-cli@c7200652e8e519c3681a727b444a33437ea54f30 -
Branch / Tag:
refs/tags/v0.12 - Owner: https://github.com/saaspegasus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c7200652e8e519c3681a727b444a33437ea54f30 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pegasus_cli-0.12-py3-none-any.whl.
File metadata
- Download URL: pegasus_cli-0.12-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70f7207b10cf36bc2e6a334076890f3000611f9dec22620327ee76b0b595605d
|
|
| MD5 |
a8c9199537551ea402695227c1f402b5
|
|
| BLAKE2b-256 |
b007ec9fdf4f91e737818fecfe67e7e75ea7be12d4a970d1066bf8ce9472f087
|
Provenance
The following attestation bundles were made for pegasus_cli-0.12-py3-none-any.whl:
Publisher:
publish.yml on saaspegasus/pegasus-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pegasus_cli-0.12-py3-none-any.whl -
Subject digest:
70f7207b10cf36bc2e6a334076890f3000611f9dec22620327ee76b0b595605d - Sigstore transparency entry: 936673176
- Sigstore integration time:
-
Permalink:
saaspegasus/pegasus-cli@c7200652e8e519c3681a727b444a33437ea54f30 -
Branch / Tag:
refs/tags/v0.12 - Owner: https://github.com/saaspegasus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c7200652e8e519c3681a727b444a33437ea54f30 -
Trigger Event:
release
-
Statement type: