Skip to main content

Perform calculation with various versions of variables

Project description

Varius

test License: MIT PyPI version

Perform computations using various versions of variables

Varius is the Latin word for "various."

Install

pip install varius

Usage Examples

import varius
from varius import *

# default variables
cst = vr('cost [usd]', 100)
rev = vr('revenue [usd]', 300)

# expressions: if values are not given the expressions will be symbolic
pft = ex('profit [usd]', rev - cst)
pmg = ex('profit margin', pft.expr/rev)

# show() will display the variables or expressions based on your python env
# if in jupyter notebooks, they will be displayed as beautiful latex equations otherwise as plain texts

with note('default') as d:
    show(cst, rev, pft, pmg)
    print(d)

# new case
with note('20% discount', copy='default') as d:
    rev(rev['default'] * 0.8)
    show(cst, rev, pft, pmg)
    print(d)


# another case
with note('50% discount', copy='default') as d:
    rev(rev['default'] * 0.5)
    show(cst, rev, pft, pmg)
    print(d)

You will get summaries as follows:

Scope version: default
  Variables:
    (cost [usd]) = 100
    (revenue [usd]) = 300
  Expressions:
    (profit [usd]) = 200
    (profit margin) = 2/3

Scope version: 20% discount
  Variables:
    (cost [usd]) = 100
    (revenue [usd]) = 240.0
  Expressions:
    (profit [usd]) = 140.000000000000
    (profit margin) = 0.5833333333333

Scope version: 50% discount
  Variables:
    (cost [usd]) = 100
    (revenue [usd]) = 150.0
  Expressions:
    (profit [usd]) = 50.0000000000000
    (profit margin) = 0.3333333333333

Project details


Download files

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

Source Distribution

varius-0.1.5.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

varius-0.1.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file varius-0.1.5.tar.gz.

File metadata

  • Download URL: varius-0.1.5.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for varius-0.1.5.tar.gz
Algorithm Hash digest
SHA256 d2ab345e2642f27c7d85748936d4442127591ed7b549cde9a5ee3bf8004416b8
MD5 ee82de9a267da740913470fb90efa8e4
BLAKE2b-256 5bfa90221b7e9fb3ffd32887ad3780d30693bd2a4e08daf401c39c606cf51af1

See more details on using hashes here.

File details

Details for the file varius-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: varius-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for varius-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3076e68196b89d4035bf0d9f1664fe9243e720a6bc7e46ea038ad66e2d337c24
MD5 9faf458f9a1283d9ebd78f2a6ced116c
BLAKE2b-256 f5a297a5533685176c556e8c3478dd38edc677005fd9b0ec6e786ca94c7be51f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page