https://github.com/esss/barril
Python package to manage units for physical quantities
https://github.com/esss/barril
hacktoberfest units-converter units-of-measure
Last synced: 6 months ago
JSON representation
Python package to manage units for physical quantities
- Host: GitHub
- URL: https://github.com/esss/barril
- Owner: ESSS
- License: mit
- Created: 2018-04-29T03:39:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-05T10:47:34.000Z (8 months ago)
- Last Synced: 2025-03-29T16:08:59.340Z (7 months ago)
- Topics: hacktoberfest, units-converter, units-of-measure
- Language: Python
- Homepage: https://barril.readthedocs.io
- Size: 1.09 MB
- Stars: 39
- Watchers: 18
- Forks: 11
- Open Issues: 5
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
======
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_barrilWhat 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 `_ 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.51. 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