======
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/test/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/
.. image:: https://sonarcloud.io/api/project_badges/measure?project=ESSS_barril&metric=alert_status
:target: https://sonarcloud.io/project/overview?id=ESSS_barril
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
2.0.1 (2024-02-15)
------------------
* Added support for Python 3.11 and 3.12.
* Dropped support for EOL Python 3.6 and 3.7.
* Add categorie and quantity type ``henry solubility coefficient`` (``mol/m3.Pa``)
* Add categorie and quantity type ``crystallization kinetic rate`` (``mol/m2.s.Pa``)
1.19.0 (2023-08-10)
-------------------
* Define the category and quantity type ``density derivative in respect to enthalpy``(default unit: ``kg2/m3.J``).
1.18.0 (2023-06-01)
-------------------
* Define categories ``forchheimer linear productivity index`` and ``forchheimer linear productivity index``.
* Define quantity types ``forchheimer linear productivity index`` and ``forchheimer quadratic productivity index``.
* Add units to categories ``forchheimer linear productivity index`` and ``forchheimer quadratic productivity index``.
1.17.0 (2023-05-02)
-------------------
* Standardize the usage of ``lbmol``
* Add more valid units for ``mole per mass`` category
1.16.0 (2023-04-26)
-------------------
* Add more units for ``mole per mass`` quantity.
* Define a ``molality`` category.
1.15.0 (2023-04-03)
-------------------
* Add ``cubic meter per day per kilogram-force per square centimeter`` (``m3/d/kgf/cm2``) unit to ``productivity index`` category.
* Add gauge pressures units ``Pa(g)``, ``kPa(g)``, ``bar(g)``, and ``kgf/cm2(g)`` to ``pressure`` category.
1.14.1 (2022-11-03)
-------------------
* Add ``mole per mass`` quantity (``mol/kg``).
1.13.0 (2021-11-30)
-------------------
* Update ``Newton second per meter`` unit from ``Ns/m`` to ``N.s/m`` to get unit display consistent with other units in the same category (support for the old unit input added).
* Add ``force per velocity squared`` quantity (``N.s2/m2``, ``lbf.s2/ft2``, ``lbf.s2/in2``, ``kgf.s2/m2``).
1.12.0 (2021-11-08)
-------------------
* ``barril`` is now fully type annotated, being tested with ``mypy``.
* ``Array`` and ``FixedArray`` are ``Generic`` subclasses, parametrized by the container type.
1.11.1 (2021-10-08)
-------------------
* Fixed typos in unit names: ``kilkodynes`` (unit=kdyne) fixed to ``kilodynes``, ``killowatts/cubic metre degree Kelvin`` (unit=kW/m3.K) fixed to ``kilowatts/cubic metre degree Kelvin``.
1.11.0 (2021-06-18)
-------------------
* Add new unit: "Stokes" (``St``).
* Use ``TypeCheckingSupport`` from ``oop-ext 1.1``.
* Add ``cubic feet per day per psi`` (``ft3/psi.d``) unit to ``productivity index`` category.
* Add ``calories/metre hour degree Celsius`` (``cal/m.h.degC``) unit to ``thermal conductivity`` category.
* Add ``calorie/hour square metre deg C`` (``cal/h.m2.degC``) unit to ``heat transfer coefficient`` category.
* Add ``std cubic metres/second`` (``sm3/s``) unit to ``standard volume per time`` category.
* Add ``million std cubic feet/stock tank barrel`` (``MMscf/stb``), ``stock tank barrel/std cubic feet`` (``stb/scf``) and ``stock tank barrel/million std cubic feet`` (``stb/MMscf``) units to ``standard volume per standard volume`` category.
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/ESSS/barril",
"name": "barril",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "barril",
"author": "ESSS",
"author_email": "foss@esss.co",
"download_url": "https://files.pythonhosted.org/packages/0e/9d/7687483cbaafb9e1b53a9c8939426874622d41c08609bd5b187b9c91b499/barril-2.0.1.tar.gz",
"platform": null,
"description": "======\nBarril\n======\n\n\n.. image:: https://img.shields.io/pypi/v/barril.svg\n :target: https://pypi.python.org/pypi/barril\n\n.. image:: https://img.shields.io/pypi/pyversions/barril.svg\n :target: https://pypi.org/project/barril\n\n.. image:: https://github.com/ESSS/barril/workflows/test/badge.svg\n :target: https://github.com/ESSS/barril/actions\n\n.. image:: https://codecov.io/gh/ESSS/barril/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/ESSS/barril\n\n.. image:: https://img.shields.io/readthedocs/barril.svg\n :target: https://barril.readthedocs.io/en/latest/\n\n.. image:: https://sonarcloud.io/api/project_badges/measure?project=ESSS_barril&metric=alert_status\n :target: https://sonarcloud.io/project/overview?id=ESSS_barril\n\n\nWhat is Barril?\n===============\n\nPython package to manage units for physical quantities.\n\nQuick example:\n\n.. code-block:: python\n\n from barril.units import Scalar\n\n s1 = Scalar(10, \"m\")\n s2 = Scalar(500, \"cm\")\n assert s1 + s2 == Scalar(15, \"m\")\n\n\nFeatures\n--------\n\n* Pre-defined unit database containing several physical quantities for the Oil & Gas industry.\n* Data types with an associated unit: ``Scalar``, ``Array``, ``Quantity``, ``FixedArray``.\n* Automatic conversion during arithmetic operations.\n\nDevelopment\n-----------\n\nFor complete description of what type of contributions are possible,\nsee the full `CONTRIBUTING <CONTRIBUTING.rst>`_ guide.\n\nHere is a quick summary of the steps necessary to setup your environment to contribute to ``barril``.\n\n#. Create a virtual environment and activate it::\n\n $ python -m virtualenv .env\n $ .env\\Scripts\\activate # windows\n $ source .env/bin/activate # linux\n\n\n .. note::\n\n If you use ``conda``, you can install ``virtualenv`` in the root environment::\n\n $ conda install -n root virtualenv\n\n Don't worry as this is safe to do.\n\n#. Update ``pip``::\n\n $ python -m pip install -U pip\n\n#. Install development dependencies::\n\n $ pip install -e .[testing]\n\n#. Install pre-commit::\n\n $ pre-commit install\n\n#. Run tests::\n\n $ pytest --pyargs barril\n\n#. Generate docs locally::\n\n $ tox -e docs\n\n The documentation files will be generated in ``docs/_build``.\n\nRelease\n-------\n\nA reminder for the maintainers on how to make a new release.\n\nNote that the VERSION should folow the semantic versioning as X.Y.Z\nEx.: v1.0.5\n\n1. Create a ``release-VERSION`` branch from ``upstream/master``.\n2. Update ``CHANGELOG.rst``.\n3. Push a branch with the changes.\n4. Once all builds pass, push a ``VERSION`` tag to ``upstream``.\n5. Merge the PR.\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n.. _`GitHub page` : https://github.com/ESSS/barril\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _pytest: https://github.com/pytest-dev/pytest\n.. _tox: https://github.com/tox-dev/tox\n\n\n2.0.1 (2024-02-15)\n------------------\n\n* Added support for Python 3.11 and 3.12.\n* Dropped support for EOL Python 3.6 and 3.7.\n* Add categorie and quantity type ``henry solubility coefficient`` (``mol/m3.Pa``)\n* Add categorie and quantity type ``crystallization kinetic rate`` (``mol/m2.s.Pa``)\n\n1.19.0 (2023-08-10)\n-------------------\n\n* Define the category and quantity type ``density derivative in respect to enthalpy``(default unit: ``kg2/m3.J``).\n\n1.18.0 (2023-06-01)\n-------------------\n\n* Define categories ``forchheimer linear productivity index`` and ``forchheimer linear productivity index``.\n* Define quantity types ``forchheimer linear productivity index`` and ``forchheimer quadratic productivity index``.\n* Add units to categories ``forchheimer linear productivity index`` and ``forchheimer quadratic productivity index``.\n\n1.17.0 (2023-05-02)\n-------------------\n\n* Standardize the usage of ``lbmol``\n* Add more valid units for ``mole per mass`` category\n\n1.16.0 (2023-04-26)\n-------------------\n\n* Add more units for ``mole per mass`` quantity.\n* Define a ``molality`` category.\n\n1.15.0 (2023-04-03)\n-------------------\n\n* Add ``cubic meter per day per kilogram-force per square centimeter`` (``m3/d/kgf/cm2``) unit to ``productivity index`` category.\n* Add gauge pressures units ``Pa(g)``, ``kPa(g)``, ``bar(g)``, and ``kgf/cm2(g)`` to ``pressure`` category.\n\n1.14.1 (2022-11-03)\n-------------------\n\n* Add ``mole per mass`` quantity (``mol/kg``).\n\n1.13.0 (2021-11-30)\n-------------------\n\n* Update ``Newton second per meter`` unit from ``Ns/m`` to ``N.s/m`` to get unit display consistent with other units in the same category (support for the old unit input added).\n* Add ``force per velocity squared`` quantity (``N.s2/m2``, ``lbf.s2/ft2``, ``lbf.s2/in2``, ``kgf.s2/m2``).\n\n1.12.0 (2021-11-08)\n-------------------\n\n* ``barril`` is now fully type annotated, being tested with ``mypy``.\n* ``Array`` and ``FixedArray`` are ``Generic`` subclasses, parametrized by the container type.\n\n1.11.1 (2021-10-08)\n-------------------\n\n* Fixed typos in unit names: ``kilkodynes`` (unit=kdyne) fixed to ``kilodynes``, ``killowatts/cubic metre degree Kelvin`` (unit=kW/m3.K) fixed to ``kilowatts/cubic metre degree Kelvin``.\n\n1.11.0 (2021-06-18)\n-------------------\n\n* Add new unit: \"Stokes\" (``St``).\n* Use ``TypeCheckingSupport`` from ``oop-ext 1.1``.\n* Add ``cubic feet per day per psi`` (``ft3/psi.d``) unit to ``productivity index`` category.\n* Add ``calories/metre hour degree Celsius`` (``cal/m.h.degC``) unit to ``thermal conductivity`` category.\n* Add ``calorie/hour square metre deg C`` (``cal/h.m2.degC``) unit to ``heat transfer coefficient`` category.\n* Add ``std cubic metres/second`` (``sm3/s``) unit to ``standard volume per time`` category.\n* Add ``million std cubic feet/stock tank barrel`` (``MMscf/stb``), ``stock tank barrel/std cubic feet`` (``stb/scf``) and ``stock tank barrel/million std cubic feet`` (``stb/MMscf``) units to ``standard volume per standard volume`` category.\n\n1.10.0 (2020-10-22)\n-------------------\n\n* Removing ``thermodynamic temperature`` as default category for ``degF`` and ``degR`` units.\n\n1.9.0 (2020-02-20)\n------------------\n\n* New ``classmethod`` ``Array.FromScalars`` that creates an ``Array`` from a ``List[Scalar]``.\n* Add new unit: \"barrel per second\" (``bbl/s``).\n\n1.8.0 (2020-01-10)\n------------------\n\n* Add new category: \"standard volume per standard volume\".\n* Move unit ``sm3/sm3`` from \"volume per volume\" to \"standard volume per standard volume\".\n\n1.7.2 (2019-10-16)\n------------------\n\n* ``_foundation`` has been renamed to ``_util``, and a lot of functions which were not being\n used anymore have been removed.\n* Add new unit category mass temperature per mol (``kg.K/mol``).\n* 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``).\n 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.\n* Fix division ``1.0 / a`` where ``a`` is a ``Scalar`` or ``Array`` and also add support for floor\n division, i.e., operations like ``a // b`` where ``a`` and ``b`` are ``Scalar`` or ``Array``\n (and combinations with ``float`` or ``int``).\n* Add new unit category for Joule-Thomson coefficient (``K/Pa``).\n* Add new temperature unit for density derivative in respect to temperature (``kg/m3.K``).\n\n1.7.1 (2019-10-03)\n------------------\n\n* Fixed bug in ``/`` and ``-`` operators for ``FixedArray``.\n\n1.7.0 (2019-06-18)\n------------------\n\n* Add unit system.\n\n1.6.1 (2019-04-11)\n------------------\n\n* Change export to include ICurve and Curve and exclude IReadOnlyScalar.\n\n1.6.0 (2019-04-10)\n------------------\n\n* Add curve implementation.\n* Add support to interfaces from oop-ext.\n* Drop support to Python 2.\n\n1.5.0 (2019-01-09)\n------------------\n\n* ``Quantity.CheckValue`` now raises ``QuantityValidationError`` instead of ``ValueError``.\n\n1.4.0 (2018-12-17)\n------------------\n\n* Add new category for \"concentration ratio\".\n\n1.3.0 (2018-10-13)\n------------------\n\n* Add \"per micrometre\" unit to \"per length\" category.\n* Remove internal ``barril.fixtures`` module as it is not necessary or part of the public API.\n\n1.2.0 (2018-09-26)\n------------------\n\n* Add units for defining Spring-Dashpot movements.\n\n1.1.0 (2018-09-24)\n------------------\n\n* Add ``number`` and ``fraction`` properties to ``FractionValue``.\n* Add ``unit`` read-only property to ``Quantity``.\n\n\n1.0.0 (2018-09-21)\n------------------\n\n* First feature release.\n\n0.1.0 (2018-09-03)\n------------------\n\n* First release on PyPI.\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Python package to manage units for physical quantities",
"version": "2.0.1",
"project_urls": {
"Homepage": "https://github.com/ESSS/barril"
},
"split_keywords": [
"barril"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ac37f4ad1b9e8e96d236277a217ce99be1cd51cdeabba7437e0654989807a88b",
"md5": "42e1dada0b815ee7315af992b1ad6ba3",
"sha256": "ab90dee6121233604de95c9e0580e002b7c914053dda2cf4cd1fd6a2cd5febd1"
},
"downloads": -1,
"filename": "barril-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "42e1dada0b815ee7315af992b1ad6ba3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 160595,
"upload_time": "2024-02-15T15:31:20",
"upload_time_iso_8601": "2024-02-15T15:31:20.364730Z",
"url": "https://files.pythonhosted.org/packages/ac/37/f4ad1b9e8e96d236277a217ce99be1cd51cdeabba7437e0654989807a88b/barril-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0e9d7687483cbaafb9e1b53a9c8939426874622d41c08609bd5b187b9c91b499",
"md5": "4cb32714bcfb4afd10abfd84f5891c95",
"sha256": "f344dacf795d3410c8191f585eba663bb85d0db1f1db6a6348b52fa9ecb52f7f"
},
"downloads": -1,
"filename": "barril-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "4cb32714bcfb4afd10abfd84f5891c95",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 180816,
"upload_time": "2024-02-15T15:31:22",
"upload_time_iso_8601": "2024-02-15T15:31:22.529713Z",
"url": "https://files.pythonhosted.org/packages/0e/9d/7687483cbaafb9e1b53a9c8939426874622d41c08609bd5b187b9c91b499/barril-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-15 15:31:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ESSS",
"github_project": "barril",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "barril"
}