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>

python

from src.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.3

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

Built distribution (wheel)

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

Total release size: 47.8 kB

Release files / onshape_sdk_pr-0.1.3.tar.gz

Download URL onshape_sdk_pr-0.1.3.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
efb1c1435da14eaaff35a8ef23899fcfe8d5e98a3af7de2510513b4b1699b7ea
BLAKE2b-256 checksum
How to use checksums
a9e62471113eb55e869bf5bd94dc5b8bd2e83d732f69fc530fb0e6036f604e22
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.3-py3-none-any.whl

Download URL onshape_sdk_pr-0.1.3-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2242b2c9203106d7bbd49ea225090686889382659baee7f21e47829c0fcd16d
BLAKE2b-256 checksum
How to use checksums
1ced11ed088bd14b7b236cfcce9720e4fd4d82ce4f341294a3511229888595de
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.3

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