Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: memory info #23

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Feature: memory info #23

wants to merge 18 commits into from

Conversation

madcampos
Copy link

@madcampos madcampos commented Feb 10, 2025

There is a new option for displaying memory information.

display_type property

The attribute schema has a new property called display_type, for now it only supports the memory value. The reasoning behind adding a new property instead of extending the editable attribute one is that this only affects the display of the attribute, does not make it editable and don't add any options for changing the display.

The updated attribute schema looks like this:

interface Attribute {
  key: string,
  value: string,
  editable?: { ... };
  display_type?: 'memory';
}

Notes on the value

The value for the attribute should be a floating point number, serialized as a string. Javascript only has one number type1 encoded as an IEEE 754 double precision 64bit floating point.

So, in general, whatever conforms to Python's float type will be interpreted the same in javascript.

The UI is making the following assumptions:

  • value is a floating point number that is not NaN
  • value is grater than or equal to 0
  • value is smaller than or equal to 1

Display example

Here is how the attribute is displayed:
image

Footnotes

  1. Technically, there are two number formats, the other one being BigInt for arbitraty precision integers, but using that requires changes on math operations and potentially the use of a specialized library for doing division and other operations that yield fractional/floating point numbers. The all porpouse number type is Number.

@madcampos madcampos self-assigned this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant