Skip to main content

CLI interface to devhub

Project description

devhub

PyPI Changelog Tests License

CLI interface to devhub

Installation

Install this tool using pip:

pip install devhub-cli

Usage

For help, run:

devhub --help

You can also use:

python -m devhub --help

Theme Commands

The DevHub CLI provides powerful theme management capabilities for synchronizing and managing your DevHub theme components locally.

Initial Setup

Before using theme commands, you need to initialize your environment:

devhub theme init

This command will:

  • Create a .env file with your DevHub API credentials
  • Generate a .gitignore file with appropriate exclusions
  • Create a devhub.conf.json configuration file

You'll be prompted to enter:

  • DEVHUB_API_KEY - Your OAuth1 API key
  • DEVHUB_API_SECRET - Your OAuth1 API secret
  • DEVHUB_BASE_URL - Your DevHub instance URL (e.g., https://yourbrand.cloudfrontend.net)
  • DEVHUB_SITE_ID - Your site identifier

Available Commands

devhub theme list

Lists all available theme templates and components that can be synchronized.

devhub theme list

devhub theme status

Shows the synchronization status of all theme components, indicating which files have changes compared to the remote version.

devhub theme status

devhub theme sync

Synchronizes theme components from your DevHub instance to local files.

# Sync all components
devhub theme sync

# Sync specific components only
devhub theme sync layouts/headers/DefaultHeader.html components/HeroSection/HeroSection.jinja

The sync command will:

  • Download theme files (CSS, headers, footers, localization) to the layouts/ directory
  • Download template components to the components/ directory as .jinja files
  • Format templates using djlint with 2-space indentation
  • Convert component names from slug-case to PascalCase (e.g., hero-sectionHeroSection.jinja)
  • Perform checksum comparison to detect conflicts between local and remote changes

Project Structure

After initialization and synchronization, your project structure will look like:

your-project/
├── .env                    # Environment variables (not committed)
├── .gitignore             # Git exclusions
├── devhub.conf.json       # CLI configuration
├── layouts/               # Theme templates (headers, footers, CSS)
│   ├── headers/DefaultHeader.jinja
│   ├── footers/DefaultFooter.jinja
├── styles/               # CSS styles
│   └── globals.css
└── components/            # Template components
    ├── HeroSection/HeroSection.jinja
    ├── ProductCard/ProductCard.jinja
    └── NavigationMenu/NavigationMenu.jinja

Authentication & Environment

The CLI uses OAuth1 authentication to connect to your DevHub instance. All sensitive credentials are stored in the .env file, which should never be committed to version control.

Required environment variables:

  • DEVHUB_API_KEY - OAuth1 API key
  • DEVHUB_API_SECRET - OAuth1 API secret
  • DEVHUB_BASE_URL - Base URL for DevHub API
  • DEVHUB_SITE_ID - Site identifier

Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:

cd devhub-cli
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

python -m pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devhub_cli-0.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devhub_cli-0.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file devhub_cli-0.1.tar.gz.

File metadata

  • Download URL: devhub_cli-0.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for devhub_cli-0.1.tar.gz
Algorithm Hash digest
SHA256 5070a84fe8715d72a294dc99e31412443ddddadb3ce50dfcbd4c22ec1910683c
MD5 483a51342acd207cddf91ddb55a7552e
BLAKE2b-256 7a5a3478aec6f6b1b19e7d1d6133e55d7505d15cbc332e1989d19a5ebb9360cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for devhub_cli-0.1.tar.gz:

Publisher: publish.yml on devhub/devhub-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file devhub_cli-0.1-py3-none-any.whl.

File metadata

  • Download URL: devhub_cli-0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for devhub_cli-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 283a6db9490c4f7ab4ab0c30a9f68955f48c444cd00c156cc8af46dbb531eb3e
MD5 4deb0faa8f770936ec019651fc201a76
BLAKE2b-256 0c2956cd703f38d6aab7a952abde16311076e77bcf488daa824f41f785e70391

See more details on using hashes here.

Provenance

The following attestation bundles were made for devhub_cli-0.1-py3-none-any.whl:

Publisher: publish.yml on devhub/devhub-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page