Skip to main content

A simple tool for generating client libraries from OpenAPI schemas

Project description

Crucible

Crucible is a CLI tool for generating and updating SDKs from OpenAPI specifications. It automates the creation of SDKs and ensures they remain up-to-date with the latest API changes.

Features

  • Generate a new SDK project with a predefined structure.
  • Update the SDK codebase based on the latest OpenAPI specification.
  • Supports automatic updates via GitHub Actions.
  • Manages dependencies and packaging using Poetry.

Installation

To install Crucible, you can use pipx:

Usage

pipx install crucible

Create a New SDK Project

To create a new SDK project:

crucible create_project my_sdk_project

This command will generate a new project with the following structure:

my_sdk_project/
├── causadb/
│   ├── __init__.py
│   ├── ...
├── tests/
│   ├── __init__.py
│   ├── test_example.py
├── pyproject.toml
├── README.md
├── setup.cfg
└── LICENSE

Update the SDK Codebase

To update the SDK codebase based on the latest OpenAPI specification:

crucible update_sdk crucible.yaml openapi.yaml causadb

This command will regenerate the code in the causadb/ directory while keeping other files like README, version, and tests persistent.

Integration with GitHub Actions

You can automate the update process by integrating Crucible with GitHub Actions. Create a workflow file .github/workflows/generate_sdk.yml:

name: Generate SDK

on:
  push:
    paths:
      - openapi.yaml

jobs:
  generate-sdk:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.8'

    - name: Install Poetry
      run: |
        curl -sSL https://install.python-poetry.org | python3 -
        export PATH="$HOME/.poetry/bin:$PATH"
        poetry --version

    - name: Install dependencies
      run: |
        export PATH="$HOME/.poetry/bin:$PATH"
        poetry install

    - name: Update SDK
      run: |
        export PATH="$HOME/.poetry/bin:$PATH"
        crucible update_sdk crucible.yaml openapi.yaml causadb

    - name: Commit and push changes
      run: |
        git config --global user.name 'github-actions'
        git config --global user.email 'github-actions@github.com'
        git add causadb/
        git commit -m 'Regenerate SDK from updated OpenAPI specification'
        git push
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

crucible_sdk-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

crucible_sdk-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file crucible_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: crucible_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.10 Darwin/23.4.0

File hashes

Hashes for crucible_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ea1aa4d6098e0ccaa6b256ac0772406da5fccb7470f44d02c7ffbae346476581
MD5 06187c4838564e36363dafc00a03b56e
BLAKE2b-256 54d6383ac09ecfe2a9c3232f90f48f0c98053575bc09f40c05e9e99d35405b38

See more details on using hashes here.

Provenance

File details

Details for the file crucible_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: crucible_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.10 Darwin/23.4.0

File hashes

Hashes for crucible_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8ac6b917eeabfe5a9a76bf42e6c795d8ce1461649b0cd10fdfcc1eac36e31e4
MD5 ae11215237b19de0a8d87dec957bf683
BLAKE2b-256 cd76266895f8fe77147b241a38cbec3cde9c19973a84d86e005ebbf44ec4d370

See more details on using hashes here.

Provenance

Supported by

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