Skip to main content

PhysicalDType

⚠️ This is a work in progress. The API is not stable and may change without notice. DO NOT use this in production code.

Overview

PhysicalDType is an experimental NumPy parametric DType for representing physical dimensions and units using NEP-41 and NEP-43.

The goal is to create a DType that can represent both physical dimension (e.g. Length, Mass, Time) and physical units (e.g. m, km, ms).

⚠️ Physical dimension is only supported for now. Physical unit support is supposed to be implemented in the near future.

How to build this repo

Only Linux is supported for now.

uv sync --extra dev
make build

Usage

import numpy as np
from physicaldtype import PhysicalDType


mass = np.array([1, 2, 3], dtype=PhysicalDType({"M": 1}))
acc = np.array([1, 2, 3], dtype=PhysicalDType({"L": 1, "T": -2}))

force = mass * acc
print(force.dtype) 
# PhysicalDType('PhysicalDimension({'L': 1.0, 'M': 1.0, 'T': -2.0, 'I': 0.0, 'Theta': 0.0, 'N': 0.0, 'J': 0.0})')

License

This project is licensed under the MIT License. See the LICENSE file for details.

References

To create a parametric DType, I referred to the following resources:

  • unytdtype

    • This library creates a parametric DType for physical units utilizing the unyt library.
  • numpy-quaddtype

    • This library creates a cross-platform Quad (128-bit) float Data-Type for NumPy.

Current status

PhysicalDType is currently experimental.

Supported:

  • Physical dimensions represented by SI base dimensions
  • NumPy array creation with PhysicalDType
  • Basic arithmetic operations such as addition and multiplication

Not yet supported:

  • Physical units and unit conversion
  • Many NumPy ufuncs and operations
  • Platforms other than Linux

Metadata

Release files for physicaldtype 0.0.1

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

Built distribution (wheel)

Table of built distributions (wheels) for physicaldtype 0.0.1
File Interpreter ABI Platform
physicaldtype-0.0.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.28+ x86-64, Linux glibc 2.5+ x86-64 Details

Release files / physicaldtype-0.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL physicaldtype-0.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 18.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
ae8ef3e4d405f1f4e8e46d6cd6b6ec2b31daca7e62f65d0ce0aa581374602836
BLAKE2b-256 checksum
How to use checksums
e29d8c2799c439e5d5e0d916a9a855c65a31173cebccf4b5583168f6c883152f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Security for physicaldtype 0.0.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.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for physicaldtype-0.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

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.0.1 This release

1 release file Full 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