sciform 0.37.0__py3-none-any.whl → 0.38.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sciform/__init__.py +0 -3
- sciform/api/formatter.py +12 -22
- sciform/api/global_configuration.py +5 -9
- sciform/format_utils/exponents.py +2 -3
- sciform/format_utils/make_strings.py +32 -22
- sciform/format_utils/numbers.py +13 -14
- sciform/format_utils/rounding.py +17 -21
- sciform/formatting/fsml.py +23 -8
- sciform/formatting/number_formatting.py +68 -39
- sciform/options/conversion.py +2 -1
- sciform/options/finalized_options.py +2 -8
- sciform/options/global_options.py +3 -5
- sciform/options/input_options.py +2 -3
- sciform/options/option_types.py +12 -46
- sciform/options/populated_options.py +4 -6
- sciform/options/validation.py +69 -59
- {sciform-0.37.0.dist-info → sciform-0.38.1.dist-info}/METADATA +65 -54
- sciform-0.38.1.dist-info/RECORD +31 -0
- {sciform-0.37.0.dist-info → sciform-0.38.1.dist-info}/WHEEL +1 -1
- sciform-0.37.0.dist-info/RECORD +0 -31
- {sciform-0.37.0.dist-info → sciform-0.38.1.dist-info}/LICENSE +0 -0
- {sciform-0.37.0.dist-info → sciform-0.38.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sciform
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.38.1
|
4
4
|
Summary: A package for formatting numbers into scientific formatted strings.
|
5
5
|
Author-email: Justin Gerber <justin.gerber48@gmail.com>
|
6
6
|
Project-URL: homepage, https://github.com/jagerber48/sciform
|
@@ -21,42 +21,53 @@ Classifier: Topic :: Utilities
|
|
21
21
|
Requires-Python: >=3.8
|
22
22
|
Description-Content-Type: text/x-rst
|
23
23
|
License-File: LICENSE
|
24
|
-
Provides-Extra:
|
25
|
-
Requires-Dist:
|
26
|
-
Requires-Dist:
|
27
|
-
Requires-Dist:
|
28
|
-
|
29
|
-
Requires-Dist: sphinx
|
30
|
-
Requires-Dist:
|
24
|
+
Provides-Extra: all
|
25
|
+
Requires-Dist: sciform[docs] ; extra == 'all'
|
26
|
+
Requires-Dist: sciform[test] ; extra == 'all'
|
27
|
+
Requires-Dist: sciform[examples] ; extra == 'all'
|
28
|
+
Provides-Extra: docs
|
29
|
+
Requires-Dist: sphinx ; extra == 'docs'
|
30
|
+
Requires-Dist: sphinx-rtd-dark-mode ; extra == 'docs'
|
31
|
+
Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
|
32
|
+
Requires-Dist: sphinx-toolbox ; extra == 'docs'
|
31
33
|
Provides-Extra: examples
|
32
34
|
Requires-Dist: numpy ; extra == 'examples'
|
33
35
|
Requires-Dist: scipy ; extra == 'examples'
|
34
36
|
Requires-Dist: matplotlib ; extra == 'examples'
|
35
37
|
Requires-Dist: tabulate ; extra == 'examples'
|
36
38
|
Requires-Dist: jupyter ; extra == 'examples'
|
39
|
+
Provides-Extra: test
|
40
|
+
Requires-Dist: coverage[toml] ; extra == 'test'
|
41
|
+
Requires-Dist: numpy ; extra == 'test'
|
42
|
+
Requires-Dist: ruff ==0.5.5 ; extra == 'test'
|
43
|
+
Requires-Dist: sciform[docs] ; extra == 'test'
|
37
44
|
|
38
|
-
..
|
45
|
+
.. container::
|
46
|
+
|
47
|
+
|Repo Status| |pyOpenSci| |Documentation Status| |PyPI Version| |PyPI Python| |Coverage Status| |GH Workflow Status| |Zenodo|
|
48
|
+
|
49
|
+
.. |Repo Status| image:: https://www.repostatus.org/badges/latest/wip.svg
|
39
50
|
:target: https://www.repostatus.org/#wip
|
40
51
|
:alt: Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.
|
41
|
-
.. image:: https://tinyurl.com/y22nb8up
|
52
|
+
.. |pyOpenSci| image:: https://tinyurl.com/y22nb8up
|
42
53
|
:target: https://github.com/pyOpenSci/software-review/issues/121
|
43
54
|
:alt: pyOpenSci
|
44
|
-
.. image:: https://img.shields.io/readthedocs/sciform?logo=readthedocs&link=https%3A%2F%2Fsciform.readthedocs.io%2Fen%2Fstable%2F
|
55
|
+
.. |Documentation Status| image:: https://img.shields.io/readthedocs/sciform?logo=readthedocs&link=https%3A%2F%2Fsciform.readthedocs.io%2Fen%2Fstable%2F
|
45
56
|
:target: https://sciform.readthedocs.io/en/stable/
|
46
57
|
:alt: Read the Docs
|
47
|
-
.. image:: https://img.shields.io/pypi/v/sciform?logo=pypi
|
58
|
+
.. |PyPI Version| image:: https://img.shields.io/pypi/v/sciform?logo=pypi
|
48
59
|
:target: https://pypi.org/project/sciform/
|
49
60
|
:alt: PyPI - Version
|
50
|
-
.. image:: https://img.shields.io/pypi/pyversions/sciform?logo=python
|
61
|
+
.. |PyPI Python| image:: https://img.shields.io/pypi/pyversions/sciform?logo=python
|
51
62
|
:target: https://pypi.org/project/sciform/
|
52
63
|
:alt: PyPI - Python Version
|
53
|
-
.. image:: https://img.shields.io/codecov/c/github/jagerber48/sciform?logo=codecov
|
64
|
+
.. |Coverage Status| image:: https://img.shields.io/codecov/c/github/jagerber48/sciform?logo=codecov
|
54
65
|
:target: https://codecov.io/gh/jagerber48/sciform
|
55
66
|
:alt: Codecov
|
56
|
-
.. image:: https://img.shields.io/github/actions/workflow/status/jagerber48/sciform/python-package.yml?logo=github%20actions
|
67
|
+
.. |GH Workflow Status| image:: https://img.shields.io/github/actions/workflow/status/jagerber48/sciform/python-package.yml?logo=github%20actions
|
57
68
|
:target: https://github.com/jagerber48/sciform/blob/main/.github/workflows/python-package.yml
|
58
69
|
:alt: GitHub Workflow Status
|
59
|
-
.. image:: https://zenodo.org/badge/645611310.svg
|
70
|
+
.. |Zenodo| image:: https://zenodo.org/badge/645611310.svg
|
60
71
|
:target: https://zenodo.org/doi/10.5281/zenodo.10645272
|
61
72
|
:alt: Zenodo
|
62
73
|
|
@@ -65,9 +76,9 @@ Requires-Dist: jupyter ; extra == 'examples'
|
|
65
76
|
sciform
|
66
77
|
#######
|
67
78
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
| **Repository:** `<https://github.com/jagerber48/sciform>`_
|
80
|
+
| **Documentation:** `<https://sciform.readthedocs.io/en/stable/>`_
|
81
|
+
| **PyPi:** `<https://pypi.org/project/sciform/>`_
|
71
82
|
|
72
83
|
We would greatly appreciate you taking the time to fill out the
|
73
84
|
`User Experience Survey <https://forms.gle/TkkKgywYyEMKu9U37>`_ to help
|
@@ -114,55 +125,55 @@ For many more details see
|
|
114
125
|
|
115
126
|
``sciform`` provides a wide variety of formatting options which can be
|
116
127
|
controlled when constructing ``Formatter`` objects which are then used
|
117
|
-
to format numbers into strings according to the selected options
|
118
|
-
|
119
|
-
>>> from sciform import Formatter
|
120
|
-
>>> formatter = Formatter(
|
121
|
-
... round_mode="dec_place", ndigits=6, upper_separator=" ", lower_separator=" "
|
122
|
-
... )
|
123
|
-
>>> print(formatter(51413.14159265359))
|
124
|
-
51 413.141 593
|
125
|
-
>>> formatter = Formatter(round_mode="sig_fig", ndigits=4, exp_mode="engineering")
|
126
|
-
>>> print(formatter(123456.78))
|
127
|
-
123.5e+03
|
128
|
+
to format numbers into strings according to the selected options::
|
129
|
+
|
130
|
+
>>> from sciform import Formatter
|
131
|
+
>>> formatter = Formatter(
|
132
|
+
... round_mode="dec_place", ndigits=6, upper_separator=" ", lower_separator=" "
|
133
|
+
... )
|
134
|
+
>>> print(formatter(51413.14159265359))
|
135
|
+
51 413.141 593
|
136
|
+
>>> formatter = Formatter(round_mode="sig_fig", ndigits=4, exp_mode="engineering")
|
137
|
+
>>> print(formatter(123456.78))
|
138
|
+
123.5e+03
|
128
139
|
|
129
140
|
Users can also format numbers by constructing ``SciNum`` objects and
|
130
141
|
using string formatting to format the ``SciNum`` instances according
|
131
|
-
to a custom FSML
|
142
|
+
to a custom FSML::
|
132
143
|
|
133
|
-
>>> from sciform import SciNum
|
134
|
-
>>> num = SciNum(12345)
|
135
|
-
>>> print(f"{num:!2f}")
|
136
|
-
12000
|
137
|
-
>>> print(f"{num:!2r}")
|
138
|
-
12e+03
|
144
|
+
>>> from sciform import SciNum
|
145
|
+
>>> num = SciNum(12345)
|
146
|
+
>>> print(f"{num:!2f}")
|
147
|
+
12000
|
148
|
+
>>> print(f"{num:!2r}")
|
149
|
+
12e+03
|
139
150
|
|
140
151
|
In addition to formatting individual numbers, ``sciform`` can be used
|
141
152
|
to format pairs of numbers as value/uncertainty pairs.
|
142
153
|
This can be done by passing two numbers into a ``Formatter`` call or by
|
143
|
-
using the ``SciNum`` object
|
154
|
+
using the ``SciNum`` object::
|
144
155
|
|
145
|
-
>>> formatter = Formatter(ndigits=2, upper_separator=" ", lower_separator=" ")
|
146
|
-
>>> print(formatter(123456.654321, 0.00345))
|
147
|
-
123 456.654 3 ± 0.003 4
|
148
|
-
>>> formatter = Formatter(ndigits=4, exp_mode="engineering")
|
149
|
-
>>> print(formatter(123456.654321, 0.00345))
|
150
|
-
(123.456654321 ± 0.000003450)e+03
|
156
|
+
>>> formatter = Formatter(ndigits=2, upper_separator=" ", lower_separator=" ")
|
157
|
+
>>> print(formatter(123456.654321, 0.00345))
|
158
|
+
123 456.654 3 ± 0.003 4
|
159
|
+
>>> formatter = Formatter(ndigits=4, exp_mode="engineering")
|
160
|
+
>>> print(formatter(123456.654321, 0.00345))
|
161
|
+
(123.456654321 ± 0.000003450)e+03
|
151
162
|
|
152
|
-
>>> num = SciNum(123456.654321, 0.00345)
|
153
|
-
>>> print(f"{num:!2f}")
|
154
|
-
123456.6543 ± 0.0034
|
155
|
-
>>> print(f"{num:!2f()}")
|
156
|
-
123456.6543(34)
|
163
|
+
>>> num = SciNum(123456.654321, 0.00345)
|
164
|
+
>>> print(f"{num:!2f}")
|
165
|
+
123456.6543 ± 0.0034
|
166
|
+
>>> print(f"{num:!2f()}")
|
167
|
+
123456.6543(34)
|
157
168
|
|
158
169
|
Note that the above examples demonstrate that ``sciform`` uses
|
159
170
|
`"round-to-even" <https://en.wikipedia.org/wiki/Rounding#Rounding_half_to_even>`_
|
160
|
-
rounding
|
171
|
+
rounding::
|
161
172
|
|
162
|
-
>>> print(f"{SciNum(865):!2}")
|
163
|
-
860
|
164
|
-
>>> print(f"{SciNum(875):!2}")
|
165
|
-
880
|
173
|
+
>>> print(f"{SciNum(865):!2}")
|
174
|
+
860
|
175
|
+
>>> print(f"{SciNum(875):!2}")
|
176
|
+
880
|
166
177
|
|
167
178
|
See `Formatting Options <https://sciform.readthedocs.io/en/stable/options.html>`_,
|
168
179
|
`Format Specification Mini-Language <https://sciform.readthedocs.io/en/stable/fsml.html>`_
|
@@ -0,0 +1,31 @@
|
|
1
|
+
sciform/__init__.py,sha256=Lnb1fep9vjJ7n4U5YdNqRkq9saXuRvppedpW1TZm99Y,781
|
2
|
+
sciform/api/__init__.py,sha256=kWXKOuVgwn3580EBGGs4t2uK7_uBgjfvQq2r8b9ZPrM,24
|
3
|
+
sciform/api/formatted_number.py,sha256=VdQGRXmUy_Pwc2SeYT8KlZMJBJDu0maI0HHv9DXu1fQ,2804
|
4
|
+
sciform/api/formatter.py,sha256=0eOLQmrNnhDO05rbMMOhPjYUYYkW5fT-SiUAxGKXWEI,15554
|
5
|
+
sciform/api/global_configuration.py,sha256=iSmGcnfs-2cvWz27t9ka9ibDuN732sLwDsLJTi8SA-g,6866
|
6
|
+
sciform/api/scinum.py,sha256=XF4QiBAlehEKnk_NwDDVWmLnRDwfEalmuzC8b2qUE4Q,3363
|
7
|
+
sciform/format_utils/__init__.py,sha256=9tCbjsOOiqvw0DoMUo9qcIC8pFykfVZZ8wkEIRAh-OE,132
|
8
|
+
sciform/format_utils/exp_translations.py,sha256=uh9ZxDKcGcMVSNwj7qkr5TSA6MINIaU1RHZeqKVwEQ0,575
|
9
|
+
sciform/format_utils/exponents.py,sha256=khG9mkHRG-qb2Xnd_lpkLXwV8KcHUJekgC8MwgfSL_U,3976
|
10
|
+
sciform/format_utils/grouping.py,sha256=1hZjjVKRUy477LGGFniZwwEHHBDaSb6E0K3SAeCACVY,1641
|
11
|
+
sciform/format_utils/make_strings.py,sha256=4g1E3UBDLeoF272OpIGCiuzeZ4KsDjWNiXvbMIfr3sg,5258
|
12
|
+
sciform/format_utils/numbers.py,sha256=L3J8B7GR6RWNaYthDmnY5d4bLYBviCYw-Evqb754VTw,5799
|
13
|
+
sciform/format_utils/rounding.py,sha256=VkvIg_UNpGfBG8QQQVGLZPwNfw5Tj3jlM8Wgx1r6ils,3491
|
14
|
+
sciform/formatting/__init__.py,sha256=T_DnF4vkeAQx1xuzff7rRZbWj-hEbNI6Pj2D2831L9E,38
|
15
|
+
sciform/formatting/fsml.py,sha256=J2Zd7RD4E32hNTP2Vo_2PEvzHBt3aIUerhLT72stovQ,3843
|
16
|
+
sciform/formatting/number_formatting.py,sha256=_4SxAzo3VLp6_ThrJfn9yQu3rH_0_27NOftNSPfIMA8,12268
|
17
|
+
sciform/formatting/output_conversion.py,sha256=TdcfQa0p7S7iIkqcwVYbxCGwoGu4mPOV3XzjABnaGmA,5523
|
18
|
+
sciform/formatting/parser.py,sha256=58noOOyg5m3NKJwGfEEwiUivzm5vGPG3K1_OXIrrVAk,16310
|
19
|
+
sciform/options/__init__.py,sha256=tw_CZHaNrdixZoQyG6ZD5UMKkQxXok0qBQCxt28Gh20,51
|
20
|
+
sciform/options/conversion.py,sha256=2ad0Mwwb7qqJ5xClevxaUVkVznokQBmAVVewh_5-7jU,4146
|
21
|
+
sciform/options/finalized_options.py,sha256=r38T1qp2sLD0mVIOovfax2Q46zb7yjjypr1CpUsqMCA,1262
|
22
|
+
sciform/options/global_options.py,sha256=T_OXFKi2qO5PV-LTZt9ClppWYsUmStBgyQqFuoX6idM,697
|
23
|
+
sciform/options/input_options.py,sha256=ibUMS9q_hdf9lms90hA6FzbEZpe-KVdZg5K-A1H7j3Q,3806
|
24
|
+
sciform/options/option_types.py,sha256=nZa_HZHlRf6ILbKxXbP1lqB3s9WoJRYv0uLQonY5ud8,2346
|
25
|
+
sciform/options/populated_options.py,sha256=7TBuSxBvcUopF16NIMQuGoAT6B0vq0HLigO7qrIld1A,4961
|
26
|
+
sciform/options/validation.py,sha256=b70AE6AqbNjEsBkVXwYDQRCQnwVbqWWJ7eUxh2jkyqU,8092
|
27
|
+
sciform-0.38.1.dist-info/LICENSE,sha256=-oyCEZu-6HLrRSfRg44uuNDE0c59GVEdqYIgidqSP70,1056
|
28
|
+
sciform-0.38.1.dist-info/METADATA,sha256=VOjvIRctGtmIIcf7aaiq5EbLScH12vB3nKPx1OGtj6M,8990
|
29
|
+
sciform-0.38.1.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
30
|
+
sciform-0.38.1.dist-info/top_level.txt,sha256=mC01YOQ-1u5pDk9BJia-pQKLUMvkreMsldDpFcp7NV8,8
|
31
|
+
sciform-0.38.1.dist-info/RECORD,,
|
sciform-0.37.0.dist-info/RECORD
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
sciform/__init__.py,sha256=gE7q7AYCOqjjy98_H1mIW3CSqPBbkP-SI8clpVFVKZw,881
|
2
|
-
sciform/api/__init__.py,sha256=kWXKOuVgwn3580EBGGs4t2uK7_uBgjfvQq2r8b9ZPrM,24
|
3
|
-
sciform/api/formatted_number.py,sha256=VdQGRXmUy_Pwc2SeYT8KlZMJBJDu0maI0HHv9DXu1fQ,2804
|
4
|
-
sciform/api/formatter.py,sha256=t0AduoIny7HlCBzjlBwFPXzN00tiaMvZCTs8tWqHfnA,16083
|
5
|
-
sciform/api/global_configuration.py,sha256=jqX-bWTtYjghtfyx3B7S5OIi88PMZC4YMmRBtaNxGVE,7052
|
6
|
-
sciform/api/scinum.py,sha256=XF4QiBAlehEKnk_NwDDVWmLnRDwfEalmuzC8b2qUE4Q,3363
|
7
|
-
sciform/format_utils/__init__.py,sha256=9tCbjsOOiqvw0DoMUo9qcIC8pFykfVZZ8wkEIRAh-OE,132
|
8
|
-
sciform/format_utils/exp_translations.py,sha256=uh9ZxDKcGcMVSNwj7qkr5TSA6MINIaU1RHZeqKVwEQ0,575
|
9
|
-
sciform/format_utils/exponents.py,sha256=fXRoZ1pqY2kuW9UliTDs0fdcKMJTtWFnHpqe2e2AidE,4017
|
10
|
-
sciform/format_utils/grouping.py,sha256=1hZjjVKRUy477LGGFniZwwEHHBDaSb6E0K3SAeCACVY,1641
|
11
|
-
sciform/format_utils/make_strings.py,sha256=REyFe7taSq6ay5IgM2iPvfB5A9SAFT7Ie4Uo6_6I5PU,4802
|
12
|
-
sciform/format_utils/numbers.py,sha256=DTkHxAhTrwKqOdbjt5qjTVJwdyJP4lTar-olmyLWbq4,5845
|
13
|
-
sciform/format_utils/rounding.py,sha256=Ie09AIpQmiCaSi4cH98VyR34u3gsBxM1X5AWqZ3CgbE,3655
|
14
|
-
sciform/formatting/__init__.py,sha256=T_DnF4vkeAQx1xuzff7rRZbWj-hEbNI6Pj2D2831L9E,38
|
15
|
-
sciform/formatting/fsml.py,sha256=r22RiBPrkDaiPgE2VQrtGms9aBmWqolymsmmnp-z57s,3378
|
16
|
-
sciform/formatting/number_formatting.py,sha256=mvT15rwSFtogaM_JFqXzFQMA9zdT5vmW8QWfYMrJ-AM,10947
|
17
|
-
sciform/formatting/output_conversion.py,sha256=TdcfQa0p7S7iIkqcwVYbxCGwoGu4mPOV3XzjABnaGmA,5523
|
18
|
-
sciform/formatting/parser.py,sha256=58noOOyg5m3NKJwGfEEwiUivzm5vGPG3K1_OXIrrVAk,16310
|
19
|
-
sciform/options/__init__.py,sha256=tw_CZHaNrdixZoQyG6ZD5UMKkQxXok0qBQCxt28Gh20,51
|
20
|
-
sciform/options/conversion.py,sha256=HdFUoUmYFhcMjhB5i-LikE20seDJkb9sq3RblERxkck,4079
|
21
|
-
sciform/options/finalized_options.py,sha256=CdNTcASBYnYIr9wDZ_NLN8HiU3fdbtoL2CQbfJhV7go,1487
|
22
|
-
sciform/options/global_options.py,sha256=bSOd3J7-U-R-t-JqZdQI2Jo2F6O9xNijmCkTpcrOybY,805
|
23
|
-
sciform/options/input_options.py,sha256=c3mihX5BjmFNeqH4N1rJ9emtOFQf43Enj2YLmy8RP4Y,3885
|
24
|
-
sciform/options/option_types.py,sha256=8slohyIPHeAdgq3aszoNq9RJl6ibageFqDMxeC9NhrQ,3893
|
25
|
-
sciform/options/populated_options.py,sha256=eo2MNTXUElTMnhgp1CcEp9ym5G9E6v9GxSZwHt3AnKI,5085
|
26
|
-
sciform/options/validation.py,sha256=ghkfGBp29AMdGsgYU90YFtfuj8KxCiYDJngsAMuJ0ys,8064
|
27
|
-
sciform-0.37.0.dist-info/LICENSE,sha256=-oyCEZu-6HLrRSfRg44uuNDE0c59GVEdqYIgidqSP70,1056
|
28
|
-
sciform-0.37.0.dist-info/METADATA,sha256=vNibMXv4XqUkcaZXw7XbXNd8iYkNpQUUVsvFEqaIzB0,8351
|
29
|
-
sciform-0.37.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
30
|
-
sciform-0.37.0.dist-info/top_level.txt,sha256=mC01YOQ-1u5pDk9BJia-pQKLUMvkreMsldDpFcp7NV8,8
|
31
|
-
sciform-0.37.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|