Skip to content

Commit 809f464

Browse files
committed
Transition from setup.py to pyproject.toml
* Move static package configuration from setup.py to pyproject.toml - Minimal changes were made to the configuration, so it still lists Python 2.7 as the minimum version, though it hasn't been tested what the minimum version of Python is that can install the package with a pyproject.toml file and no setup.py. - The `future` dependency was restricted to `python < 3.1'` since it is not needed with Python 3 and is not actively maintained. * Merge long description content in setup.py into README.rst * Capture development dependencies listed in setup.py in requirements-dev.txt * Save change log which was in long description in setup.py in its own file, CHANGES.rst.
1 parent 69f9eea commit 809f464

File tree

4 files changed

+153
-223
lines changed

4 files changed

+153
-223
lines changed
Lines changed: 1 addition & 210 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,3 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
3-
4-
import os
5-
import sys
6-
7-
# Common options for distutils/setuptools's setup():
8-
setup_options = dict(
9-
name='uncertainties',
10-
version='3.1.7',
11-
author='Eric O. LEBIGOT (EOL)',
12-
author_email='eric.lebigot@normalesup.org',
13-
url='http://uncertainties-python-package.readthedocs.io/',
14-
license='Revised BSD License',
15-
description=('Transparent calculations with uncertainties on the'
16-
' quantities involved (aka error propagation);'
17-
' fast calculation of derivatives'),
18-
long_description='''\
19-
Overview
20-
========
21-
22-
``uncertainties`` allows **calculations** such as (2 +/- 0.1)*2 = 4 +/-
23-
0.2 to be **performed transparently**. Much more complex mathematical
24-
expressions involving numbers with uncertainties can also be evaluated
25-
directly.
26-
27-
The ``uncertainties`` package **takes the pain and complexity out**
28-
of uncertainty calculations.
29-
30-
**Detailed information** about this package can be found on its `main
31-
website`_.
32-
33-
Basic examples
34-
==============
35-
36-
.. code-block:: python
37-
38-
>>> from uncertainties import ufloat
39-
40-
>>> x = ufloat(2, 0.25)
41-
>>> x
42-
2.0+/-0.25
43-
44-
>>> square = x**2 # Transparent calculations
45-
>>> square
46-
4.0+/-1.0
47-
>>> square.nominal_value
48-
4.0
49-
>>> square.std_dev # Standard deviation
50-
1.0
51-
52-
>>> square - x*x
53-
0.0 # Exactly 0: correlations taken into account
54-
55-
>>> from uncertainties.umath import * # sin(), etc.
56-
>>> sin(1+x**2)
57-
-0.95892427466313845+/-0.2836621854632263
58-
59-
>>> print (2*x+1000).derivatives[x] # Automatic calculation of derivatives
60-
2.0
61-
62-
>>> from uncertainties import unumpy # Array manipulation
63-
>>> random_vars = unumpy.uarray([1, 2], [0.1, 0.2])
64-
>>> print random_vars
65-
[1.0+/-0.1 2.0+/-0.2]
66-
>>> print random_vars.mean()
67-
1.50+/-0.11
68-
>>> print unumpy.cos(random_vars)
69-
[0.540302305868+/-0.0841470984808 -0.416146836547+/-0.181859485365]
70-
71-
Main features
72-
=============
73-
74-
- **Transparent calculations with uncertainties**: **no or little
75-
modification of existing code** is needed. Similarly, the Python_ (or
76-
IPython_) shell can be used as **a powerful calculator** that
77-
handles quantities with uncertainties (``print`` statements are
78-
optional, which is convenient).
79-
80-
- **Correlations** between expressions are correctly taken into
81-
account. Thus, ``x-x`` is exactly zero, for instance (most
82-
implementations found on the web yield a non-zero uncertainty for
83-
``x-x``, which is incorrect).
84-
85-
- **Almost all mathematical operations** are supported, including most
86-
functions from the standard math_ module (sin,...). Comparison
87-
operators (``>``, ``==``, etc.) are supported too.
88-
89-
- Many **fast operations on arrays and matrices** of numbers with
90-
uncertainties are supported.
91-
92-
- **Extensive support for printing** numbers with uncertainties
93-
(including LaTeX support and pretty-printing).
94-
95-
- Most uncertainty calculations are performed **analytically**.
96-
97-
- This module also gives access to the **derivatives** of any
98-
mathematical expression (they are used by error
99-
propagation theory, and are thus automatically calculated by this
100-
module).
101-
102-
103-
Installation or upgrade
104-
=======================
105-
106-
Installation instructions are available on the `main web site
107-
<http://uncertainties-python-package.readthedocs.io/en/latest/index.html#installation-and-download>`_
108-
for this package.
109-
110-
Contact
111-
=======
112-
113-
Please send **feature requests, bug reports, or feedback** to
114-
`Eric O. LEBIGOT (EOL)`_.
115-
1161
Version history
1172
===============
1183

@@ -247,102 +132,8 @@
247132
- 1.0.9: ``correlations()`` renamed more appropriately as
248133
``covariance_matrix()``.
249134

250-
.. _Python: http://docs.python.org/tutorial/interpreter.html
251-
.. _IPython: http://ipython.readthedocs.io/en/stable/
252-
.. _NumPy: http://numpy.scipy.org/
253135
.. _math: http://docs.python.org/library/math.html
254136
.. _PEP 8: http://www.python.org/dev/peps/pep-0008/
255-
.. _error propagation theory: http://en.wikipedia.org/wiki/Propagation_of_uncertainty
256-
.. _Eric O. LEBIGOT (EOL): mailto:eric.lebigot@normalesup.org
257-
.. _PayPal: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4TK7KNDTEDT4S
258-
.. _main website: http://uncertainties-python-package.readthedocs.io/
259137
.. _code updater: http://uncertainties-python-package.readthedocs.io/en/latest/index.html#migration-from-version-1-to-version-2
260-
.. _formatting: http://uncertainties-python-package.readthedocs.io/en/latest/user_guide.html#printing''',
261-
classifiers=[
262-
'Development Status :: 5 - Production/Stable',
263-
'Intended Audience :: Developers',
264-
'Intended Audience :: Education',
265-
'Intended Audience :: Other Audience',
266-
'Intended Audience :: Science/Research',
267-
'License :: OSI Approved :: BSD License',
268-
'Operating System :: OS Independent',
269-
'Programming Language :: Python',
270-
'Programming Language :: Python :: 3',
271-
'Programming Language :: Python :: 3.8',
272-
'Programming Language :: Python :: 3.9',
273-
'Programming Language :: Python :: 3.10',
274-
'Programming Language :: Python :: 3.11',
275-
'Programming Language :: Python :: 3.12',
276-
'Programming Language :: Python :: Implementation :: Jython',
277-
'Programming Language :: Python :: Implementation :: PyPy',
278-
'Topic :: Education',
279-
'Topic :: Scientific/Engineering',
280-
'Topic :: Scientific/Engineering :: Mathematics',
281-
'Topic :: Scientific/Engineering :: Physics',
282-
'Topic :: Software Development',
283-
'Topic :: Software Development :: Libraries',
284-
'Topic :: Software Development :: Libraries :: Python Modules',
285-
'Topic :: Utilities'
286-
],
287-
288-
keywords=[
289-
'error propagation', 'uncertainties', 'uncertainty calculations',
290-
'standard deviation', 'derivatives', 'partial derivatives',
291-
'differentiation'
292-
],
293-
294-
# Files are defined in MANIFEST (which is automatically created by
295-
# python setup.py sdist bdist_wheel):
296-
packages=[
297-
'uncertainties', 'uncertainties.unumpy', 'uncertainties.lib1to2',
298-
'uncertainties.lib1to2.fixes'
299-
],
300-
301-
# The code runs with both Python 2 and Python 3:
302-
options={"bdist_wheel": {"universal": True}}
303-
)
304-
305-
# The best available setup() is used (some users do not have
306-
# setuptools):
307-
try:
308-
from setuptools import setup
309-
310-
# Some setuptools-specific options can be added:
311-
312-
addtl_setup_options = dict(
313-
314-
project_urls={
315-
'Documentation':
316-
'https://uncertainties-python-package.readthedocs.io/',
317-
'Source': 'https://github.com/lebigot/uncertainties'
318-
},
319-
320-
install_requires=['future'],
321-
322-
tests_require=['nose', 'numpy'],
323-
324-
# Optional dependencies install using:
325-
# `easy_install uncertainties[optional]`
326-
extras_require={
327-
'optional': ['numpy'],
328-
'docs': ['sphinx'],
329-
}
330-
)
331-
332-
# easy_install uncertainties[tests] option:
333-
addtl_setup_options['extras_require']['tests'] = (
334-
addtl_setup_options['tests_require'])
335-
336-
# easy_install uncertainties[all] option: all dependencies are
337-
# gathered
338-
addtl_setup_options['extras_require']['all'] = set(
339-
sum(addtl_setup_options['extras_require'].values(), []))
340-
341-
setup_options.update(addtl_setup_options)
342-
343-
except ImportError:
344-
from distutils.core import setup
345-
346-
# End of setup definition
138+
.. _formatting: http://uncertainties-python-package.readthedocs.io/en/latest/user_guide.html#printing
347139

348-
setup(**setup_options)

README.rst

Lines changed: 89 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,101 @@ uncertainties
1515

1616
**Call for maintainers**: if you want this project to keep living and are ready to maintain it (pull requests management, issue resolution…), please contact me! I am ready to share my knowledge of the code logic by participating in discussions (notably around pull requests and issues).
1717

18-
This is the ``uncertainties`` Python package, which performs **transparent
19-
calculations with uncertainties** (aka "error propagation"):
18+
``uncertainties`` allows **calculations** such as (2 +/- 0.1)*2 = 4 +/-
19+
0.2 to be **performed transparently**. Much more complex mathematical
20+
expressions involving numbers with uncertainties can also be evaluated
21+
directly.
22+
23+
The ``uncertainties`` package **takes the pain and complexity out**
24+
of uncertainty calculations.
25+
26+
**Detailed information** about this package can be found on its `main
27+
website`_.
28+
29+
Basic examples
30+
--------------
31+
32+
.. code-block:: python
2033
2134
>>> from uncertainties import ufloat
22-
>>> from uncertainties.umath import * # sin(), etc.
23-
>>> x = ufloat(1, 0.1) # x = 1+/-0.1
24-
>>> print(2*x)
25-
2.00+/-0.20
26-
>>> sin(2*x) # In a Python shell, "print" is optional
27-
0.9092974268256817+/-0.08322936730942848
2835
29-
This package also **automatically calculates derivatives of arbitrary functions**:
36+
>>> x = ufloat(2, 0.25)
37+
>>> x
38+
2.0+/-0.25
39+
40+
>>> square = x**2 # Transparent calculations
41+
>>> square
42+
4.0+/-1.0
43+
>>> square.nominal_value
44+
4.0
45+
>>> square.std_dev # Standard deviation
46+
1.0
3047
31-
>>> (2*x+1000).derivatives[x]
48+
>>> square - x*x
49+
0.0 # Exactly 0: correlations taken into account
50+
51+
>>> from uncertainties.umath import * # sin(), etc.
52+
>>> sin(1+x**2)
53+
-0.95892427466313845+/-0.2836621854632263
54+
55+
>>> print (2*x+1000).derivatives[x] # Automatic calculation of derivatives
3256
2.0
3357
34-
The main documentation is available at
35-
https://uncertainties.readthedocs.io/.
58+
>>> from uncertainties import unumpy # Array manipulation
59+
>>> random_vars = unumpy.uarray([1, 2], [0.1, 0.2])
60+
>>> print random_vars
61+
[1.0+/-0.1 2.0+/-0.2]
62+
>>> print random_vars.mean()
63+
1.50+/-0.11
64+
>>> print unumpy.cos(random_vars)
65+
[0.540302305868+/-0.0841470984808 -0.416146836547+/-0.181859485365]
66+
67+
Main features
68+
-------------
69+
70+
- **Transparent calculations with uncertainties**: **no or little
71+
modification of existing code** is needed. Similarly, the Python_ (or
72+
IPython_) shell can be used as **a powerful calculator** that
73+
handles quantities with uncertainties (``print`` statements are
74+
optional, which is convenient).
75+
76+
- **Correlations** between expressions are correctly taken into
77+
account. Thus, ``x-x`` is exactly zero, for instance (most
78+
implementations found on the web yield a non-zero uncertainty for
79+
``x-x``, which is incorrect).
80+
81+
- **Almost all mathematical operations** are supported, including most
82+
functions from the standard math_ module (sin,...). Comparison
83+
operators (``>``, ``==``, etc.) are supported too.
84+
85+
- Many **fast operations on arrays and matrices** of numbers with
86+
uncertainties are supported.
87+
88+
- **Extensive support for printing** numbers with uncertainties
89+
(including LaTeX support and pretty-printing).
90+
91+
- Most uncertainty calculations are performed **analytically**.
92+
93+
- This module also gives access to the **derivatives** of any
94+
mathematical expression (they are used by `error
95+
propagation theory`_, and are thus automatically calculated by this
96+
module).
97+
98+
99+
Installation or upgrade
100+
-----------------------
101+
102+
Installation instructions are available on the `main web site
103+
<http://uncertainties-python-package.readthedocs.io/en/latest/index.html#installation-and-download>`_
104+
for this package.
105+
106+
36107

37108
Git branches
38109
------------
39110

40111
The ``release`` branch is the latest stable release. It should pass the tests.
41112

42-
43113
``master*`` branches in the Github repository are bleeding-edge, and do not
44114
necessarily pass the tests. The ``master`` branch is the latest, relatively
45115
stable versions (while other ``master*`` branches are more experimental).
@@ -69,3 +139,9 @@ History
69139
This package was created back around 2009 by `Eric O. LEBIGOT <https://github.com/lebigot>`_.
70140

71141
Ownership of the package was taken over by the `lmfit GitHub organization <https://github.com/lmfit>`_ in 2024.
142+
143+
.. _Python: http://docs.python.org/tutorial/interpreter.html
144+
.. _IPython: http://ipython.readthedocs.io/en/stable/
145+
.. _math: http://docs.python.org/library/math.html
146+
.. _error propagation theory: http://en.wikipedia.org/wiki/Propagation_of_uncertainty
147+
.. _main website: http://uncertainties-python-package.readthedocs.io/

0 commit comments

Comments
 (0)