Metadata-Version: 2.1
Name: barril
Version: 1.10.0
Summary: Python package to manage units for physical quantities
Home-page: https://github.com/ESSS/barril
Author: ESSS
Author-email: foss@esss.co
License: MIT license
Keywords: barril
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=3.6
Requires-Dist: attrs (>=18.1.0)
Requires-Dist: numpy (>=1.11.0)
Requires-Dist: oop-ext (>=0.2.4)
Provides-Extra: docs
Requires-Dist: sphinx (>=1.4) ; extra == 'docs'
Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints ; extra == 'docs'
Provides-Extra: testing
Requires-Dist: codecov ; extra == 'testing'
Requires-Dist: pytest ; extra == 'testing'
Requires-Dist: pytest-cov ; extra == 'testing'
Requires-Dist: pytest-mock ; extra == 'testing'
Requires-Dist: pre-commit ; extra == 'testing'
Requires-Dist: tox ; extra == 'testing'

======
Barril
======


.. image:: https://img.shields.io/pypi/v/barril.svg
    :target: https://pypi.python.org/pypi/barril

.. image:: https://img.shields.io/pypi/pyversions/barril.svg
    :target: https://pypi.org/project/barril

.. image:: https://github.com/ESSS/barril/workflows/build/badge.svg
    :target: https://github.com/ESSS/barril/actions

.. image:: https://codecov.io/gh/ESSS/barril/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/ESSS/barril

.. image:: https://img.shields.io/readthedocs/barril.svg
    :target: https://barril.readthedocs.io/en/latest/

What is Barril?
===============

Python package to manage units for physical quantities.

Quick example:

.. code-block:: python

    from barril.units import Scalar

    s1 = Scalar(10, 'm')
    s2 = Scalar(500, 'cm')
    assert s1 + s2 == Scalar(15, 'm')


Features
--------

* Pre-defined unit database containing several physical quantities for the Oil & Gas industry.
* Data types with an associated unit: ``Scalar``, ``Array``, ``Quantity``, ``FixedArray``.
* Automatic conversion during arithmetic operations.

Development
-----------

For complete description of what type of contributions are possible,
see the full `CONTRIBUTING <CONTRIBUTING.rst>`_ guide.

Here is a quick summary of the steps necessary to setup your environment to contribute to ``barril``.

#. Create a virtual environment and activate it::

    $ python -m virtualenv .env
    $ .env\Scripts\activate  # windows
    $ source .env/bin/activate  # linux


   .. note::

       If you use ``conda``, you can install ``virtualenv`` in the root environment::

           $ conda install -n root virtualenv

       Don't worry as this is safe to do.

#. Update ``pip``::

    $ python -m pip install -U pip

#. Install development dependencies::

    $ pip install -e .[testing]

#. Install pre-commit::

    $ pre-commit install

#. Run tests::

    $ pytest --pyargs barril

#. Generate docs locally::

    $ tox -e docs

   The documentation files will be generated in ``docs/_build``.

Release
-------

A reminder for the maintainers on how to make a new release.

Note that the VERSION should folow the semantic versioning as X.Y.Z
Ex.: v1.0.5

1. Create a ``release-VERSION`` branch from ``upstream/master``.
2. Update ``CHANGELOG.rst``.
3. Push a branch with the changes.
4. Once all builds pass, push a ``VERSION`` tag to ``upstream``.
5. Merge the PR.

Credits
-------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
.. _`GitHub page` :                   https://github.com/ESSS/barril
.. _Cookiecutter:                     https://github.com/audreyr/cookiecutter
.. _pytest:                           https://github.com/pytest-dev/pytest
.. _tox:                              https://github.com/tox-dev/tox


1.10.0 (2020-10-22)
-------------------

* Removing ``thermodynamic temperature`` as default category for ``degF`` and ``degR`` units.

1.9.0 (2020-02-20)
------------------

* New ``classmethod`` ``Array.FromScalars`` that creates an ``Array`` from a ``List[Scalar]``.
* Add new unit: "barrel per second" (``bbl/s``).

1.8.0 (2020-01-10)
------------------

* Add new category: "standard volume per standard volume".
* Move unit ``sm3/sm3`` from "volume per volume" to "standard volume per standard volume".

1.7.2 (2019-10-16)
------------------

* ``_foundation`` has been renamed to ``_util``, and a lot of functions which were not being
  used anymore have been removed.
* Add new unit category mass temperature per mol (``kg.K/mol``).
* Some units have been renamed as they were deemed out-of-place in the oil industry to something more usual (for example, ``1000ft3/d`` became ``Mcf/d``).
  The old representation of those units is still supported, but they will be automatically translated during ``Quantity`` creation, so this change should not affect users much.
* Fix division ``1.0 / a`` where ``a`` is a ``Scalar`` or ``Array`` and also add support for floor
  division, i.e., operations like ``a // b``  where ``a`` and ``b`` are ``Scalar`` or ``Array``
  (and combinations with ``float`` or ``int``).
* Add new unit category for Joule-Thomson coefficient (``K/Pa``).
* Add new temperature unit for density derivative in respect to temperature (``kg/m3.K``).

1.7.1 (2019-10-03)
------------------

* Fixed bug in ``/`` and ``-`` operators for ``FixedArray``.

1.7.0 (2019-06-18)
------------------

* Add unit system.

1.6.1 (2019-04-11)
------------------

* Change export to include ICurve and Curve and exclude IReadOnlyScalar.

1.6.0 (2019-04-10)
------------------

* Add curve implementation.
* Add support to interfaces from oop-ext.
* Drop support to Python 2.

1.5.0 (2019-01-09)
------------------

* ``Quantity.CheckValue`` now raises ``QuantityValidationError`` instead of ``ValueError``.

1.4.0 (2018-12-17)
------------------

* Add new category for "concentration ratio".

1.3.0 (2018-10-13)
------------------

* Add "per micrometre" unit to "per length" category.
* Remove internal ``barril.fixtures``  module as it is not necessary or part of the public API.

1.2.0 (2018-09-26)
------------------

* Add units for defining Spring-Dashpot movements.

1.1.0 (2018-09-24)
------------------

* Add ``number`` and ``fraction`` properties to ``FractionValue``.
* Add ``unit`` read-only property to ``Quantity``.


1.0.0 (2018-09-21)
------------------

* First feature release.

0.1.0 (2018-09-03)
------------------

* First release on PyPI.


