semvec/pypi-packages huggingface dataset:
pts-lab-smp-psu 0.0.1
LAB-SMP PSU Diagnostic Package
License: MIT

# Lab-SMP-PSU

#### Interface to the LAB-SMP DC Power Supply source

## Clone repository
```
cd <path-to-directory>
git clone git@gitlab.com:pass-testing-solutions/lab-smp-psu.git
cd lab-smp-psu/
git pull origin main
git checkout -b <your-new-branch>  # Please follow the branch naming convention as mentioned in the coding guidelines
```
## Virtual environment on MacOS

### 1. Virtualenvwrapper
You can install virtualenv and virtualenvwrapper with:
```
pip3 install virtualenv
pip3 install virtualenvwrapper
mkdir ~/.virtualenvs
# Might need to query where the virtualenv and virtualenvwrapper.sh are
which virtualenv
which virtualenvwrapper.sh
which python3
```
Add these lines in the ~/.zshrc file 
````
# Setting PATH for Python 3 installed by brew
export PATH=<path-to-your-python3>:$PATH

# Configuration for virtualenv
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=<path-to-your-python3>
export VIRTUALENVWRAPPER_VIRTUALENV=<path-to-your-virtualenv>
source <path-to-your-virtualenvwrapper.sh>

source $ZSH/oh-my-zsh.sh
````
Make sure to save these changes in your file and close your terminal for them to take effect.
Now you can create a virtual environment by simply typing:
```
mkvirtualenv <name-of-your-virtual-env>
cd <your-git-repository>
workon <name-of-your-virtual-env>
deactivate <name-of-your-virtual-env>
```
To add the correct interpreter for your repository on PyCharm:
```
- PyCharm IDE > Preferences > Project > Python Interpreter
- Select the 'Add' button for interpreters
- Choose the 'Existing environments' in 'Virtualenv'
- Add the python3 file from /bin/ of your venv folder
E.g. - .virtualenvs/demo_repo_venv/bin/python3
```
After setting up the venv for the repo please install all the 
requirements and allow some time for the IDE to do indexing. If your repository has a requirements.txt: 
```
pip3 install -r requirements.txt
```

### 2. Pipenv
Install pipenv
```
pip3 install pipenv 
# or
brew install pipenv

pipenv shell         # will create a virtualenv for the project
pipenv install       # will install dependencies for the repo from the Pipfile and Pipfile.lock

# Install any further packages in this environment as

pipenv install rich  # rich is a python library to nicely print on terminal
```
Your pipenv environment will be in the ~./virtualenvs folder.
Make sure to add the interpreter on your IDE if not automatically added by navigating to the virtualenv folder for your repo and selecting the correct python3 file from /bin/.

***

## Maintainers
Maintainers: @julianpass and @shuparnadeb_pts
strmath 1.1
A module for evaluating math expressions without eval()
License: MIT
Requires Python: >=3.10,<4.0
Keywords: math,parse,str

![tests](https://github.com/Exenifix/strmath/actions/workflows/test.yml/badge.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/strmath)
![License](https://img.shields.io/github/license/Exenifix/strmath)
![CodeFactor](https://www.codefactor.io/repository/github/exenifix/strmath/badge)
![GitHub release](https://img.shields.io/github/v/release/Exenifix/strmath?label=version)

# strmath

A module for evaluating math expressions without eval(). Currently the module supports only simple math operations (eg.
multiplication, subtraction, division, %) but in the future there will be functions support.

## Installation
The module is available for installation from PyPI
```shell
$ pip install strmath
```

## Basic Usage
```python
from strmath import evaluate


result = evaluate("(90 + 2) // 4")
print(result)
```

## Accuracy
As [tests](https://github.com/Exenifix/strmath/actions/workflows/test.yml) show, the library is 100% accurate with python native evaluation:
```
+----------------+--------+---------+-----+-----------+-------------+
|                | Python | StrMath | PEE | Mathparse | InfixParser |
+----------------+--------+---------+-----+-----------+-------------+
| Failures       | 0      | 0       | 61  | 150       | 91          |
| Failures (%)   | 0%     | 0%      | 30% | 75%       | 45%         |
+----------------+--------+---------+-----+-----------+-------------+
```
In the test above, 198 randomly generated samples were submitted to Python `eval()` and several other parsing libraries, including `strmath`.
As you can see, the library has 0 failures and almost same speed with native python. You can see test implementation [here](https://github.com/Exenifix/strmath/blob/master/tests/test_expressions.py).

## Features
### Currently Supported
- basic math operations (+, -, /, //, *, **, %) eg. `"2 + 5 * 2" --> 12`
- float operations
- braces eg. `"(2 + 5) * 2" --> 20`
- functions from `math` module and some builtins

### Planned for Future
- custom functions registration
- correct `-` operator as neg (eg. `50+-30`)
- mathematical constants (i.e. PI)

## Principle
1. Tokenize expression (split it into operators and numbers)
2. Apply operations order
3. Build evaluation binary tree
4. Evaluate the tree

## License
This repository is licensed under MIT license. See [LICENSE](https://github.com/Exenifix/strmath/blob/master/LICENSE) for details.