Name | rsc JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | The simplest calculator library in Python with variable support, math functions, and assignments |
upload_time | 2025-08-02 18:16:16 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.6 |
license | MIT License
Copyright (c) 2025 Rasa Dariush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
keywords |
calculator
math
expression
variables
safe-eval
factorial
math-functions
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 📐 RSC (Really Simple Calculator)
RSC is the simplest calculator library in Python!
It lets you safely evaluate complex math expressions with support for variables, assignments, factorials, and many math functions.
Version: **0.3.0** – *Now with math functions, factorials, assignments & better error handling!*
---
## 🔧 Installation
```bash
pip install rsc
````
or for a specific version:
```bash
pip install rsc==0.3.0
```
---
## 🚀 Quick Start
```python
import rsc
print(rsc.calculate("2 + 3 * (4 - 1)")) # ➜ 11
print(rsc.calculate("5 ^ 2 + 10")) # ➜ 35
print(rsc.calculate("sin(pi / 2)")) # ➜ 1.0
print(rsc.calculate("5! + 10")) # ➜ 130
```
You can also assign variables:
```python
rsc.assign_var("a", 10)
rsc.assign_var("b", 20)
rsc.assign_var("c", 10)
print(rsc.calculate("a + b - c")) # ➜ 20
print(rsc.calculate("d = (a + b) * c")) # ➜ 300
print(rsc.calculate("d / 2")) # ➜ 150.0
```
---
## ✅ Supported Features
* Operators: `+`, `-`, `*`, `x` (multiplication), `/`, `//`, `%`, `**`, `^`
* Factorial operator: `!` (e.g. `5!`)
* Parentheses for grouping
* Variables and assignments (e.g. `a = 5 + 3`)
* Built-in math functions: `sin`, `cos`, `tan`, `log`, `log10`, `sqrt`, `factorial`, etc.
* Built-in constants: `pi`, `e`, `tau`
* Safe evaluation using `asteval`
* Friendly error messages
---
## 📘 Usage Reference
```python
rsc.calculate(expression: str) -> float | int | str
```
Evaluates the expression string and returns the result or error message.
```python
rsc.assign_var(name: str, value: float | int)
```
Assigns a variable for use in expressions.
```python
rsc.show_help()
```
Prints detailed usage instructions.
---
## 🌐 Links
* [GitHub Repo](https://github.com/Rasa8877/rs-calculator-rsc)
* Contact: [letperhut@gmail.com](mailto:letperhut@gmail.com)
---
## 🧠 Author
Made with ❤️ by Rasa8877
RSC — the simplest calculator library in Python!
Raw data
{
"_id": null,
"home_page": null,
"name": "rsc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "calculator, math, expression, variables, safe-eval, factorial, math-functions",
"author": null,
"author_email": "Rasa8877 <letperhut@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/f1/44/3fbd66d474d7b8ecada848530c25b81e43a4c17fe8102fa369e02ec3ea62/rsc-0.3.0.tar.gz",
"platform": null,
"description": "# \ud83d\udcd0 RSC (Really Simple Calculator)\r\n\r\nRSC is the simplest calculator library in Python! \r\nIt lets you safely evaluate complex math expressions with support for variables, assignments, factorials, and many math functions.\r\n\r\nVersion: **0.3.0** \u2013 *Now with math functions, factorials, assignments & better error handling!*\r\n\r\n---\r\n\r\n## \ud83d\udd27 Installation\r\n\r\n```bash\r\npip install rsc\r\n````\r\n\r\nor for a specific version:\r\n\r\n```bash\r\npip install rsc==0.3.0\r\n```\r\n\r\n---\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n```python\r\nimport rsc\r\n\r\nprint(rsc.calculate(\"2 + 3 * (4 - 1)\")) # \u279c 11\r\nprint(rsc.calculate(\"5 ^ 2 + 10\")) # \u279c 35\r\nprint(rsc.calculate(\"sin(pi / 2)\")) # \u279c 1.0\r\nprint(rsc.calculate(\"5! + 10\")) # \u279c 130\r\n```\r\n\r\nYou can also assign variables:\r\n\r\n```python\r\nrsc.assign_var(\"a\", 10)\r\nrsc.assign_var(\"b\", 20)\r\nrsc.assign_var(\"c\", 10)\r\n\r\nprint(rsc.calculate(\"a + b - c\")) # \u279c 20\r\nprint(rsc.calculate(\"d = (a + b) * c\")) # \u279c 300\r\nprint(rsc.calculate(\"d / 2\")) # \u279c 150.0\r\n```\r\n\r\n---\r\n\r\n## \u2705 Supported Features\r\n\r\n* Operators: `+`, `-`, `*`, `x` (multiplication), `/`, `//`, `%`, `**`, `^`\r\n* Factorial operator: `!` (e.g. `5!`)\r\n* Parentheses for grouping\r\n* Variables and assignments (e.g. `a = 5 + 3`)\r\n* Built-in math functions: `sin`, `cos`, `tan`, `log`, `log10`, `sqrt`, `factorial`, etc.\r\n* Built-in constants: `pi`, `e`, `tau`\r\n* Safe evaluation using `asteval`\r\n* Friendly error messages\r\n\r\n---\r\n\r\n## \ud83d\udcd8 Usage Reference\r\n\r\n```python\r\nrsc.calculate(expression: str) -> float | int | str\r\n```\r\n\r\nEvaluates the expression string and returns the result or error message.\r\n\r\n```python\r\nrsc.assign_var(name: str, value: float | int)\r\n```\r\n\r\nAssigns a variable for use in expressions.\r\n\r\n```python\r\nrsc.show_help()\r\n```\r\n\r\nPrints detailed usage instructions.\r\n\r\n---\r\n\r\n## \ud83c\udf10 Links\r\n\r\n* [GitHub Repo](https://github.com/Rasa8877/rs-calculator-rsc)\r\n* Contact: [letperhut@gmail.com](mailto:letperhut@gmail.com)\r\n\r\n---\r\n\r\n## \ud83e\udde0 Author\r\n\r\nMade with \u2764\ufe0f by Rasa8877\r\nRSC \u2014 the simplest calculator library in Python!\r\n",
"bugtrack_url": null,
"license": "MIT License\r\n \r\n Copyright (c) 2025 Rasa Dariush\r\n \r\n Permission is hereby granted, free of charge, to any person obtaining a copy\r\n of this software and associated documentation files (the \"Software\"), to deal\r\n in the Software without restriction, including without limitation the rights\r\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n copies of the Software, and to permit persons to whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n \r\n The above copyright notice and this permission notice shall be included in all\r\n copies or substantial portions of the Software.\r\n \r\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n SOFTWARE.",
"summary": "The simplest calculator library in Python with variable support, math functions, and assignments",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/Rasa8877/rs-calculator"
},
"split_keywords": [
"calculator",
" math",
" expression",
" variables",
" safe-eval",
" factorial",
" math-functions"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "aa2866ccbd177bfadb83f7035111a05dec6a9de46320e1d85082bb99c9d97c62",
"md5": "780d7b9cb83b2c16bdf80c4e6a83ad0c",
"sha256": "69071ec2012211b5893473a76124ddf864c41af968b9263000f110010ea72d75"
},
"downloads": -1,
"filename": "rsc-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "780d7b9cb83b2c16bdf80c4e6a83ad0c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5593,
"upload_time": "2025-08-02T18:16:15",
"upload_time_iso_8601": "2025-08-02T18:16:15.793180Z",
"url": "https://files.pythonhosted.org/packages/aa/28/66ccbd177bfadb83f7035111a05dec6a9de46320e1d85082bb99c9d97c62/rsc-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f1443fbd66d474d7b8ecada848530c25b81e43a4c17fe8102fa369e02ec3ea62",
"md5": "eb51a3e2ea8429e13305c34c9e6f96de",
"sha256": "d976320d76f72d8ee26b671994ab0c78f438bb10ccff0b71ff453ea0c0e4e025"
},
"downloads": -1,
"filename": "rsc-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "eb51a3e2ea8429e13305c34c9e6f96de",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5281,
"upload_time": "2025-08-02T18:16:16",
"upload_time_iso_8601": "2025-08-02T18:16:16.792577Z",
"url": "https://files.pythonhosted.org/packages/f1/44/3fbd66d474d7b8ecada848530c25b81e43a4c17fe8102fa369e02ec3ea62/rsc-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-02 18:16:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Rasa8877",
"github_project": "rs-calculator",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "rsc"
}