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

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.2
File Size Uploaded Provenance Actions
onshape_sdk_pr-0.1.2.tar.gz 22.9 kB Without provenance Details for onshape_sdk_pr-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 51.8 kB

Release files / onshape_sdk_pr-0.1.2.tar.gz

Download URL onshape_sdk_pr-0.1.2.tar.gz
Size 22.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9819d1372392f2d541b609293179db937292b632e82baa9906860e9c683592c5
BLAKE2b-256 checksum
How to use checksums
23a5530b76fe70cd2fb994d303550ad184d4bb05671a1f803568b3e589296c3e
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.2-py3-none-any.whl

Download URL onshape_sdk_pr-0.1.2-py3-none-any.whl
Size 28.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a80b3376e52c1af77510aff509443304a7a5670d4fa5d65d5cedbc93fe6d9f19
BLAKE2b-256 checksum
How to use checksums
0deb341306a8df58259de5a245001e67de18b766b273bac7d5e62e2316b86553
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.2

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