Python package to manage units for physical quantities
What is Barril?
Python package to manage units for physical quantities.
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 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
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.
$ python -m pip install -U pip
Install development dependencies:
$ pip install -e .[testing]
$ pre-commit install
$ pytest --pyargs barril
Generate docs locally:
$ tox -e docs
The documentation files will be generated in docs/_build.
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
- Create a release-VERSION branch from upstream/master.
- Update CHANGELOG.rst.
- Push a branch with the changes.
- Once all builds pass, push a VERSION tag to upstream.
- Merge the PR.
- New classmethod Array.FromScalars that creates an Array from a List[Scalar].
- Add new unit: “barrel per second” (bbl/s).
- Add new category: “standard volume per standard volume”
- Move unit sm3/sm3 from “volume per volume” to “standard volume per standard volume”
- _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).
- Fixed bug in / and - operators for FixedArray.
- Add unit system.
- Change export to include ICurve and Curve and exclude IReadOnlyScalar.
- Add curve implementation.
- Add support to interfaces from oop-ext.
- Drop support to Python 2.
- Quantity.CheckValue now raises QuantityValidationError instead of ValueError.
- Add new category for “concentration ratio”.
- Add “per micrometre” unit to “per length” category.
- Remove internal barril.fixtures module as it is not necessary or part of the public API.
- Add units for defining Spring-Dashpot movements.
- Add number and fraction properties to FractionValue.
- Add unit read-only property to Quantity.
- First feature release.
- First release on PyPI.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size barril-1.9.0-py2.py3-none-any.whl (151.2 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size barril-1.9.0.tar.gz (171.0 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for barril-1.9.0-py2.py3-none-any.whl