Skip to main content

Nucleus

https://dashboard.scale.com/nucleus

Aggregate metrics in ML are not good enough. To improve production ML, you need to understand their qualitative failure modes, fix them by gathering more data, and curate diverse scenarios.

Scale Nucleus helps you:

  • Visualize your data
  • Curate interesting slices within your dataset
  • Review and manage annotations
  • Measure and debug your model performance

Nucleus is a new way—the right way—to develop ML models, helping us move away from the concept of one dataset and towards a paradigm of collections of scenarios.

Installation

$ pip install scale-nucleus

CLI installation

We recommend installing the CLI via pipx (https://pypa.github.io/pipx/installation/). This makes sure that the CLI does not interfere with you system packages and is accessible from your favorite terminal.

For MacOS:

brew install pipx
pipx ensurepath
pipx install scale-nucleus
# Optional installation of shell completion (for bash, zsh or fish)
nu install-completions

Otherwise, install via pip (requires pip 19.0 or later):

python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install scale-nucleus
# Optional installation of shell completion (for bash, zsh or fish)
nu install-completions

Common issues/FAQ

Outdated Client

Nucleus is iterating rapidly and as a result we do not always perfectly preserve backwards compatibility with older versions of the client. If you run into any unexpected error, it's a good idea to upgrade your version of the client by running

pip install --upgrade scale-nucleus

Usage

For the most up to date documentation, reference: https://dashboard.scale.com/nucleus/docs/api?language=python.

For Developers

Clone from github and install as editable

git clone git@github.com:scaleapi/nucleus-python-client.git
cd nucleus-python-client
pip3 install poetry
poetry install

Please install the pre-commit hooks by running the following command:

poetry run pre-commit install

When releasing a new version please add release notes to the changelog in CHANGELOG.md.

Best practices for testing: (1). Please run pytest from the root directory of the repo, i.e.

poetry run pytest tests/test_dataset.py

(2) To skip slow integration tests that have to wait for an async job to start.

poetry run pytest -n auto -m "not integration"

Note: "-n auto" is used for pytest-xdist parallelization

Pydantic Models

Prefer using Pydantic models rather than creating raw dictionaries or dataclasses to send or receive over the wire as JSONs. Pydantic is created with data validation in mind and provides very clear error messages when it encounters a problem with the payload.

The Pydantic model(s) should mirror the payload to send. To represent a JSON payload that looks like this:

{
  "example_json_with_info": {
    "metadata": {
      "frame": 0
    },
    "reference_id": "frame0",
    "url": "s3://example/scale_nucleus/2021/lidar/0038711321865000.json",
    "type": "pointcloud"
  },
  "example_image_with_info": {
    "metadata": {
      "author": "Picasso"
    },
    "reference_id": "frame0",
    "url": "s3://bucket/0038711321865000.jpg",
    "type": "image"
  }
}

Could be represented as the following structure. Note that the field names map to the JSON keys and the usage of field validators (@validator).

import os.path
from pydantic import BaseModel, validator
from typing import Literal


class JsonWithInfo(BaseModel):
    metadata: dict  # any dict is valid
    reference_id: str
    url: str
    type: Literal["pointcloud", "recipe"]

    @validator("url")
    def has_json_extension(cls, v):
        if not v.endswith(".json"):
            raise ValueError(f"Expected '.json' extension got {v}")
        return v


class ImageWithInfo(BaseModel):
    metadata: dict  # any dict is valid
    reference_id: str
    url: str
    type: Literal["image", "mask"]

    @validator("url")
    def has_valid_extension(cls, v):
        valid_extensions = {".jpg", ".jpeg", ".png", ".tiff"}
        _, extension = os.path.splitext(v)
        if extension not in valid_extensions:
            raise ValueError(f"Expected extension in {valid_extensions} got {v}")
        return v


class ExampleNestedModel(BaseModel):
    example_json_with_info: JsonWithInfo
    example_image_with_info: ImageWithInfo

# Usage:
import requests
payload = requests.get("/example")
parsed_model = ExampleNestedModel.parse_obj(payload.json())
requests.post("example/post_to", json=parsed_model.dict())

Migrating to Pydantic

  • When migrating an interface from a dictionary use nucleus.pydantic_base.DictCompatibleModel. That allows you to get the benefits of Pydantic but maintaints backwards compatibility with a Python dictionary by delegating __getitem__ to fields.
  • When migrating a frozen dataclass use nucleus.pydantic_base.ImmutableModel. That is a base class set up to be immutable after initialization.

Updating documentation: We use Sphinx to autogenerate our API Reference from docstrings.

To test your local docstring changes, run the following commands from the repository's root directory:

poetry shell
cd docs
sphinx-autobuild . ./_build/html --watch ../nucleus

sphinx-autobuild will spin up a server on localhost (port 8000 by default) that will watch for and automatically rebuild a version of the API reference based on your local docstring changes.

Custom Metrics using Shapely in scale-validate

Certain metrics use Shapely and rasterio which is added as optional dependencies.

pip install scale-nucleus[metrics]

Note that you might need to install a local GEOS package since Shapely doesn't provide binaries bundled with GEOS for every platform.

#Mac OS
brew install geos
# Ubuntu/Debian flavors
apt-get install libgeos-dev

To develop it locally use

poetry install --extras metrics

Metadata

Release files for scale-nucleus 0.23.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 scale-nucleus 0.23.1
File Size Uploaded Provenance Actions
scale_nucleus-0.23.1.tar.gz 183.7 kB Without provenance Details for scale_nucleus-0.23.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for scale-nucleus 0.23.1
File Actions
scale_nucleus-0.23.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for scale_nucleus-0.23.1-cp314-cp314-win_amd64.whl
scale_nucleus-0.23.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details for scale_nucleus-0.23.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
scale_nucleus-0.23.1-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for scale_nucleus-0.23.1-cp314-cp314-macosx_11_0_arm64.whl
scale_nucleus-0.23.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for scale_nucleus-0.23.1-cp313-cp313-win_amd64.whl
scale_nucleus-0.23.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details for scale_nucleus-0.23.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
scale_nucleus-0.23.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for scale_nucleus-0.23.1-cp313-cp313-macosx_11_0_arm64.whl
scale_nucleus-0.23.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for scale_nucleus-0.23.1-cp312-cp312-win_amd64.whl
scale_nucleus-0.23.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details for scale_nucleus-0.23.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
scale_nucleus-0.23.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for scale_nucleus-0.23.1-cp312-cp312-macosx_11_0_arm64.whl
scale_nucleus-0.23.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for scale_nucleus-0.23.1-cp311-cp311-win_amd64.whl
scale_nucleus-0.23.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details for scale_nucleus-0.23.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
scale_nucleus-0.23.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for scale_nucleus-0.23.1-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 3.0 MB

Release files / scale_nucleus-0.23.1.tar.gz

Download URL scale_nucleus-0.23.1.tar.gz
Size 183.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c9d8ea4dbe3646749fe0b7c4bc6cee90be404c02db8ed0daaa61f2fd7c78b626
BLAKE2b-256 checksum
How to use checksums
8a59f21e382d0923f1cef94e3f150a017251c4680fcfab83cfce8cbfb7fa887b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp314-cp314-win_amd64.whl

Download URL scale_nucleus-0.23.1-cp314-cp314-win_amd64.whl
Size 230.9 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
1941f36e71bc2e5fe4be7dfa6069e5682545e5b8e1536853ad67fcf0ce05cd5e
BLAKE2b-256 checksum
How to use checksums
7cca8bd590b687b431ecffb44e904ae10e799f2c9c60bed0fff58839a39b8f7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.23.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 246.0 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
2f983fb4d66f3524289313cc09827048867d55a5edf6900e0e01eba13b1eec28
BLAKE2b-256 checksum
How to use checksums
d8be38d5f3b6fe8ad6f3022c6ec62e5bfffbde678b640eb771d2546f1d344a00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp314-cp314-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.23.1-cp314-cp314-macosx_11_0_arm64.whl
Size 229.5 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8cb6f515d0d97ff308f58e5538ed923a6e0b33647ec71712fd384720ed7e36e3
BLAKE2b-256 checksum
How to use checksums
52566010904c26ee356a363e5bcc6afec601cdb920e2b7777470e7b6d365c6a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp313-cp313-win_amd64.whl

Download URL scale_nucleus-0.23.1-cp313-cp313-win_amd64.whl
Size 231.0 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
86f831012f5521044be2f641ae226a097a18c0c77f60c2bc8b59457856cc8356
BLAKE2b-256 checksum
How to use checksums
af0f132098f0f9d593e2038a845652e640be041ea38ec44072728564215ccaf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.23.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 245.9 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
7bf026c2f6062a24fec82135a6690d4ee3ada8a9d1bb28f63ecee8b912a3a06b
BLAKE2b-256 checksum
How to use checksums
aa2428ed1463974f14b5c59aa2766c0980e297e7372b389bcbed7f67586a098d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.23.1-cp313-cp313-macosx_11_0_arm64.whl
Size 229.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d4c36829bb70c1ebdd33683a70b265197bbf68ee9b8965172e5cbfaca1c0a9e2
BLAKE2b-256 checksum
How to use checksums
afff8a576dc67ae4252a85df8e1886cff679c0333ea1233a00a5e1a1660e1d86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp312-cp312-win_amd64.whl

Download URL scale_nucleus-0.23.1-cp312-cp312-win_amd64.whl
Size 231.0 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
4d05f7bb2a9c3cabc59daa6e6c985c35c847102160760e7075c33008a83ac801
BLAKE2b-256 checksum
How to use checksums
9eb67d71dbec3a9cad6ef96d3519d86aa5e3da877d035d6959df70b8d44872b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.23.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 245.9 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
cc46f837c27b1be92c28812d4543f96ed7be30921d50f7d21b4fba72f8a82d24
BLAKE2b-256 checksum
How to use checksums
ca77a20588b8497516fcd105251917c29029a8403e1e9076fb373fbc4ba0353b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.23.1-cp312-cp312-macosx_11_0_arm64.whl
Size 229.5 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4623ec8a963b45dd9ec0c837a2057dec72df88d8d2d9c46b734897a712b49d01
BLAKE2b-256 checksum
How to use checksums
342343b9f39f394a0e1fcf4ee53c9b95add60e3dec2e37a504db243b6f583f33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp311-cp311-win_amd64.whl

Download URL scale_nucleus-0.23.1-cp311-cp311-win_amd64.whl
Size 231.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
4d718bbf7f95e57dc6afbb92fd50ecaf0e909784fdce2106e018b1645a1b79b7
BLAKE2b-256 checksum
How to use checksums
207d5f8250fd463f4e959b50cbacff5ced54577977cc0a9903c32368189d1fb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL scale_nucleus-0.23.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 245.5 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
31d262d8f81f17edc2b0335f1ce809f8910a19b7bfd5fd28d90092d19b92021c
BLAKE2b-256 checksum
How to use checksums
8011f9bc11a14c0aaf42b3136d378a10ef888b9ef08d966c66dee8eacb92cd79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Release files / scale_nucleus-0.23.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL scale_nucleus-0.23.1-cp311-cp311-macosx_11_0_arm64.whl
Size 229.5 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
95a6b65fa42aa1d65dfa5530335c6fb73825e1ec5bea931a8abbdb1d094c86cf
BLAKE2b-256 checksum
How to use checksums
1ce108ea2a12f6b0da7095502b179b5bc2432a53b2ca6e8712fb9fb2c3a9930f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.18 Linux/7.0.0-1016-aws

Security for scale-nucleus 0.23.1

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.

Release history Release notifications | RSS feed

This release

0.23.1 This release

13 release files No provenance

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