Skip to main content

ocp-viewer-core

The shared half of the OCP viewer ecosystem: one show suite, one tessellation, one set of config semantics, used by four viewers that each keep their own transport and their own settings storage.

Currently supported hosts (viewers):

viewer ecosystem

The user-facing documentation of the shared behavior — the show commands, the config system, the viewer window and its tools — lives in docs/. Each host documents only its own specifics and refers there for the rest.

Published as one project to two registries: ocp-viewer-core on PyPI for the Python half, ocp-viewer-core on npm for the JavaScript half. Their major.minor is the contract and must match; the patch level is each half's own, so a one-sided fix ships without an artificial release of the other half. See Development.md.

The idea

Each host provides a Comms — a Python encoder and a JavaScript decoder, shipped as a pair — and a settings source. Everything above that is shared and knows nothing about which host it is running in.

Per-host imports stay per host:

  • from ocp_vscode import * or from ocp_vscode import show, set_defaults, ...
  • from build123d_studio import * or from build123d_studio import show, set_defaults, ...
  • from jupyter_cadquery import * or from jupyter_cadquery import show, set_defaults, ...
  • from ocp_viewer import * or from ocp_viewer import show, set_defaults, ...

Layout

path what
ocp_viewer_core/ the Python half
ocp_viewer_core/config.py the config keys, each mapped to the name three-cad-viewer knows it by, and the precedence over them
ocp_viewer_core/comms.py the transport a host implements, and the session that caches what it answers
ocp_viewer_core/logo.py the splash logo as measurable geometry, for a host's measurement backend
js/src/logo.js the splash logo as tessellated data plus its config, for the renderer
js/ the JavaScript half, published to npm
tests/ including the conformance kit

ocp_viewer_core/__init__.py is import-free by design: hosts import the submodule they need, so that importing the package never pulls in the tessellator or OCP.

Use

A host writes one class and supplies one list. exclude_keys names the keywords it may not be told, because its surface decides them - the show signature is the superset of every host's, so a keyword one host owns is a keyword another has to refuse by name rather than ignore.

comms = MyComms()
session = Session(comms)                        # sets session cache to None
config = Config(session, ("cad_width", "height"))
show(objects)

What a host persists between sessions is its own business and needs no key list here: it answers with values, from Comms.workspace_config(). Which of the viewer's reported state counts as configuration - and so survives into the next show - is keys.CONFIG, derived from the vocabulary, because that set is a property of three-cad-viewer's state and not of any host's settings.

Dependencies

No OCP provider is declared — the same OCP namespace is supplied by cadquery_ocp, cadquery_ocp_novtk and conda's OCP, and naming one would break users of the other two. The host or the user chooses.

Licence

Apache-2.0.

Metadata

Release files for ocp-viewer-core 1.1.1

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

Source distribution (sdist)

Source distribution for ocp-viewer-core 1.1.1
File Size Uploaded
ocp_viewer_core-1.1.1.tar.gz 120.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ocp-viewer-core 1.1.1
File Interpreter ABI Platform
ocp_viewer_core-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 238.2 kB

Release files / ocp_viewer_core-1.1.1.tar.gz

Download URL ocp_viewer_core-1.1.1.tar.gz
Size 120.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c85d555fec91c253a1cf225e860d727b26ce716620ff7fb8f4e803f1cc3ce4d0
BLAKE2b-256 checksum
How to use checksums
eb53c8ea5a94846083e1da4ade46be8cc99234f667d4745399037e1ebcffac7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / ocp_viewer_core-1.1.1-py3-none-any.whl

Download URL ocp_viewer_core-1.1.1-py3-none-any.whl
Size 117.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd1c05398c77b972e7d07a15af96efc7de3ad1296f64421094e50d7b40f261d6
BLAKE2b-256 checksum
How to use checksums
96fc96b944a00e44eb6c92bbfc2b071aa918434c6725ef0b8ce6fa04f7afc840
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

1.1.2

2 release files

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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