Skip to main content

Noether

523 units, 60 prefixes

PyPI

Noether is a unit-enriched Python package, akin to Wolfram Alpha or gnu units. It has a large (and expanding) catalogue of up-to-date units and constants, allowing code to be written directly in the units they are concerned with while also ensuring e.g. you don't mistakenly add an energy to a length.

Just grab Python 3.10 or later and pip install noether to run!

Development is ongoing, especially in expanding the unit catalogue and improving unit display mechanisms.

Usage

Noether can be used as a Python package or as a CLI:

$ alias noe='python -im noether'
$ noe marathon
marathon  # length, 42195 m, Race length based on Greek legend, set by convention from 1908 Summer Olympics
$ noether 23degC @ degF
73.4 °F  # temperature
$ noether 'horsepower @ dB(kW)'
-1.33418061 dB(kW)  # power, 0.73549875 kW

The CLI allows a few niceties such as slightly terser syntax, but otherwise behaves identically to Python:

$ noether 5cm @ in --value
1.9685039370078738
$ python
>>> from noether import *
>>> 5*cm @ inch
1.9685039370078738 in  # length

In addition to @ for display, you can more permanently set display units:

>>> display(inch)
>>> 5 * cm
>>> mile
mile  # length, 63360 in

Units propagate uncertainty automatically under most operations:

>>> m(5, 0.1)**3
125 ± 7.5 m**3  # volume

You can define your own units and dimensions:

>>> foo = Unit(3e11 * furlong / fortnight, 'foo')
>>> c @ foo
6.008724999284181 foo  # speed

>>> health = Dimension.new('health', 'H')
>>> apple = Unit(health, 'apple', 'a')
>>> apple / day
apple / day  # health / time, 1.1574074074074073e-05 a / s

Various conf settings allow for customisation to behaviour:

>>> conf.info_spectrum = True
>>> nm(400)
4e-07 m  # length, visible, purple

Use conf.save() to save to (by default) ~/.config/noether.toml.

For more, see...

Other tools for working with units include:

  • Wolfram Alpha, a comprehensive online intelligence engine
  • gnu units, a command-line tool you likely already have
  • units, a simple Python package for defining your own units
  • unyt, a Python package with numpy support

📚 Did you know?

>>> lunation / (year % lunation)
2.7153489666011486

A lunation (about 29 days) separates one full moon from another. Every so often a thirteenth full moon occurs in a year - "a blue moon". "Once in a blue moon" is actually only every 2.71 years or so - not as rare as you'd think. Don't tell Sinatra!

Metadata

Release files for noether 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 noether 1.1
File Size Uploaded
noether-1.1.tar.gz 45.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for noether 1.1
File Interpreter ABI Platform
noether-1.1-py3-none-any.whl Python 3 none any Details

Total release size: 106.7 kB

Release files / noether-1.1.tar.gz

Download URL noether-1.1.tar.gz
Size 45.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0be875bfa58c9c7288f97ec71af4f35c2b674afb8b37ad4dd8a3594c2e58d6de
BLAKE2b-256 checksum
How to use checksums
648094887eb659f511ccbb6b2386a894ee514de4d604f2dd85f5b2aa3784ca9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / noether-1.1-py3-none-any.whl

Download URL noether-1.1-py3-none-any.whl
Size 60.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccd0f168842b1c912bc4b941643c3e16d49fe7947d70397d858e5b19e3196c23
BLAKE2b-256 checksum
How to use checksums
18843628495e25aa1fa2e375bbfdf01854ded918ad680653e3f02157f40454f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.3

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