Skip to main content

onshape-sdk-pawrequest

A lightweight, typed Python SDK for the Onshape REST API.

Upstream Documentation: https://zachariahsharma.github.io/onshape-sdk/

Upstream didn't work for some routes and it's api_version is old, so i forked.

I have not tested all routes, ymmv.

Major Fork changes:

  • Updated API version from 6 to 10
  • Fixed some broken routes
  • Added pydantic-settings
  • Changed the auth setup. (onshape_sdk.auth.OnshapeHmacAuth)
  • uv native

Install

git clone <rep-url>

or don't and use uv:

# export optionally name-filtered parts from a partstudio
uv tool run --from onshape-sdk-pr onshape-sdk export -u <partstudio url> -o <output_path> -pf <filter_text> 

Configuration

Create Onshape API access and secret keys via the developer portal on OnShape's website.

PydanticSettings are built from .env file or environment variables.
Place a .env with required inputs in default location "<project_root>/.env" (sibling of this readme)
Or do one of:

  • Pass custom .env locations to OnshapeSettings(_env_file=<path_to_env_file>),
  • Set the required inputs in your environment,
  • Instantiate OnshapeSettings with the required inputs.

required inputs

ONSHAPE_ACCESS_KEY=your_access_key
ONSHAPE_SECRET_KEY=your_secret_key

Usage

cli

cli entry is via uv from src/main.py - see there fore details.
uv sets onshape-sdk as the program name onshape-sdk <command> <command options>
atm i mostly use this project as an exporter to speed up iterating from onshape to slicer.

Commands:

  • Export
onshape-sdk export /
    -u <url-to-partstudio> /
    -o <optional output file or dir> /  # save exported stl bytes
    -pf <optional part-name filter> /
    -l <optionally launch the exported file in system default app>

python

from onshape_sdk import OnshapeClient, OnshapeIdsTup, OnshapeSettings

settings = OnshapeSettings()  # optional - otherwise read default .env location or env_vars 
client = OnshapeClient(settings)  # or just `OnshapeClient() for defaults`
url = '<ONSHAPE_URL>'
ids = OnshapeIdsTup.from_url(url)
bom = client.assemblies.get_bom(*ids)
for row in bom.rows:
    print(row.part_number, row.name, row.quantity, row.material_name)

License

MIT

Metadata

Release files for onshape-sdk-pr 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onshape-sdk-pr 0.1.5
File Size Uploaded Provenance Actions
onshape_sdk_pr-0.1.5.tar.gz 20.0 kB Without provenance Details for onshape_sdk_pr-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for onshape-sdk-pr 0.1.5
File Interpreter ABI Platform Actions
onshape_sdk_pr-0.1.5-py3-none-any.whl Python 3 none any Details for onshape_sdk_pr-0.1.5-py3-none-any.whl

Total release size: 47.8 kB

Release files / onshape_sdk_pr-0.1.5.tar.gz

Download URL onshape_sdk_pr-0.1.5.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
beadae6f1a88847df2de8911725b1a535870205e4813ded62de459ff9c88543e
BLAKE2b-256 checksum
How to use checksums
b5aaf1295090b01efa97bf7d0d7159fd9095e3d63c0e909a5a817b39842f346d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / onshape_sdk_pr-0.1.5-py3-none-any.whl

Download URL onshape_sdk_pr-0.1.5-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07873d8575e60ebaa06009fbff5f9841abe31912c56664d6369ebf9c249421b1
BLAKE2b-256 checksum
How to use checksums
3a7a31c7b4fe21899cc4c88b41921101e2ed82020bb41cd04152dba155fbfea4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for onshape-sdk-pr 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page