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)

Install

git clone <rep-url>

or don't and use uv:

uv tool run --from git+https://github.com/pawrequest/onshape-sdk onshape-sdk export

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.4

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.4
File Size Uploaded Provenance Actions
onshape_sdk_pr-0.1.4.tar.gz 19.9 kB Without provenance Details for onshape_sdk_pr-0.1.4.tar.gz

Built distribution (wheel)

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

Total release size: 47.7 kB

Release files / onshape_sdk_pr-0.1.4.tar.gz

Download URL onshape_sdk_pr-0.1.4.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4fa4743cdca69f320a63e46260246882ba3528471f4a9da30b4ff82eca243d9f
BLAKE2b-256 checksum
How to use checksums
b11590df5bc478f54439d436da8c7fcf931476d4963687f0f5867df6ff42cf3d
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.4-py3-none-any.whl

Download URL onshape_sdk_pr-0.1.4-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85ef46f72917e626dcb298f7d5e3c26f0948fea3e57040cb9a86b56a93b0af83
BLAKE2b-256 checksum
How to use checksums
ed5100a6b1eeeee127aae4696ab1809e397532ef80c475cd4985f288527ebe92
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.4

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