Skip to main content

Python package to manage units for physical quantities

Project description


.. image::

.. image::

.. image::

.. image::

.. image::

.. image::

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')


* 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.


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``.


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

.. _`audreyr/cookiecutter-pypackage`:
.. _`GitHub page` :
.. _Cookiecutter:
.. _pytest:
.. _tox:


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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
barril-1.5.0-py2.py3-none-any.whl (152.0 kB) Copy SHA256 hash SHA256 Wheel py2.py3
barril-1.5.0.tar.gz (166.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page