# py_eio_logic
A simple Python package for evaluating multiple boolean conditions provided as strings.
**WARNING: This package uses `eval()` internally. It is EXTREMELY DANGEROUS to use this package with UNTRUSTED INPUT STRINGS. Malicious input can lead to arbitrary code execution on your system.**
Please ensure all `conditions` passed to `eio()` are from trusted, internal sources only.
## Installation
```bash
pip install py-eval-in-order
from py_eio_logic import eio
# Example 1: Passing individual condition strings
x = 10
y = 5
result = eio("x > 5", "y < 10")
print(f"Result 1: {result}") # Expected: True
result = eio("x == 10", "y == 6")
print(f"Result 2: {result}") # Expected: False
# Example 2: Passing a list of condition strings
z = 7
conditions_list = ["z >= 7", "x + y == 15"]
result = eio(conditions_list)
print(f"Result 3: {result}") # Expected: True
conditions_list_fail = ["z < 5", "x > 0"]
result = eio(conditions_list_fail)
print(f"Result 4: {result}") # Expected: False
# Example 3: When no conditions are passed (evaluates to True)
result = eio()
print(f"Result 5: {result}") # Expected: True
from py_eio import eio
# 'undefined_var' does not exist.
# The second condition would cause a NameError if evaluated.
# Case 1: Error condition is after a False condition
result = eio("1 == 2", "undefined_var > 0")
print(f"Result with error condition after False: {result}")
# Output: Result with error condition after False: False
# (No error message for 'undefined_var' because "1 == 2" is False, and evaluation stops)
# Case 2: Error condition is the first one, or after a True condition
# This will print an error message from the function (due to the try-except block)
# and return None.
result = eio("1 == 1", "another_undefined_var > 0")
print(f"Result with error condition evaluated: {result}")
# Output: Error evaluating condition 'another_undefined_var > 0': name 'another_undefined_var' is not defined
# Result with error condition evaluated: False
git clone [https://github.com/MostafaHanii/py_eio.git](https://github.com/MostafaHanii/py_eio.git)
cd py_eio
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
Raw data
{
"_id": null,
"home_page": "https://github.com/MostafaHanii/py_eio",
"name": "py-eval-in-order",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "boolean eval conditions logic",
"author": "Mostafa Hani",
"author_email": "mostafahanii213@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/14/a6/e69b899ad21059e3c294bf86fd3b10ea426aab24e1af317aa56e32592556/py_eval_in_order-0.1.3.tar.gz",
"platform": null,
"description": "# py_eio_logic\r\n\r\nA simple Python package for evaluating multiple boolean conditions provided as strings.\r\n\r\n**WARNING: This package uses `eval()` internally. It is EXTREMELY DANGEROUS to use this package with UNTRUSTED INPUT STRINGS. Malicious input can lead to arbitrary code execution on your system.**\r\nPlease ensure all `conditions` passed to `eio()` are from trusted, internal sources only.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install py-eval-in-order\r\n\r\nfrom py_eio_logic import eio\r\n\r\n# Example 1: Passing individual condition strings\r\nx = 10\r\ny = 5\r\nresult = eio(\"x > 5\", \"y < 10\")\r\nprint(f\"Result 1: {result}\") # Expected: True\r\n\r\nresult = eio(\"x == 10\", \"y == 6\")\r\nprint(f\"Result 2: {result}\") # Expected: False\r\n\r\n# Example 2: Passing a list of condition strings\r\nz = 7\r\nconditions_list = [\"z >= 7\", \"x + y == 15\"]\r\nresult = eio(conditions_list)\r\nprint(f\"Result 3: {result}\") # Expected: True\r\n\r\nconditions_list_fail = [\"z < 5\", \"x > 0\"]\r\nresult = eio(conditions_list_fail)\r\nprint(f\"Result 4: {result}\") # Expected: False\r\n\r\n# Example 3: When no conditions are passed (evaluates to True)\r\nresult = eio()\r\nprint(f\"Result 5: {result}\") # Expected: True\r\n\r\n\r\nfrom py_eio import eio\r\n\r\n# 'undefined_var' does not exist.\r\n# The second condition would cause a NameError if evaluated.\r\n\r\n# Case 1: Error condition is after a False condition\r\nresult = eio(\"1 == 2\", \"undefined_var > 0\")\r\nprint(f\"Result with error condition after False: {result}\")\r\n# Output: Result with error condition after False: False\r\n# (No error message for 'undefined_var' because \"1 == 2\" is False, and evaluation stops)\r\n\r\n# Case 2: Error condition is the first one, or after a True condition\r\n# This will print an error message from the function (due to the try-except block)\r\n# and return None.\r\nresult = eio(\"1 == 1\", \"another_undefined_var > 0\")\r\nprint(f\"Result with error condition evaluated: {result}\")\r\n# Output: Error evaluating condition 'another_undefined_var > 0': name 'another_undefined_var' is not defined\r\n# Result with error condition evaluated: False\r\n\r\ngit clone [https://github.com/MostafaHanii/py_eio.git](https://github.com/MostafaHanii/py_eio.git)\r\ncd py_eio\r\npython -m venv venv\r\nsource venv/bin/activate # On Windows: venv\\Scripts\\activate\r\npip install -e .\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for evaluating multiple boolean conditions (uses eval) IN ORDER.",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/MostafaHanii/py_eio"
},
"split_keywords": [
"boolean",
"eval",
"conditions",
"logic"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4a045e03b636cab21b8c77c467b78700833fbfef412a6fcde7bdfaa36fbf5677",
"md5": "ef511dd7e609a4a37b6c98b7a9ea0a33",
"sha256": "a1f33c27f913e2d1ffe30edd61de848d3c543be2813f11400f308679c4b220fa"
},
"downloads": -1,
"filename": "py_eval_in_order-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ef511dd7e609a4a37b6c98b7a9ea0a33",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4552,
"upload_time": "2025-07-29T11:31:45",
"upload_time_iso_8601": "2025-07-29T11:31:45.481772Z",
"url": "https://files.pythonhosted.org/packages/4a/04/5e03b636cab21b8c77c467b78700833fbfef412a6fcde7bdfaa36fbf5677/py_eval_in_order-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "14a6e69b899ad21059e3c294bf86fd3b10ea426aab24e1af317aa56e32592556",
"md5": "1335c4765c190d2816eb7e8f7eb2bf3f",
"sha256": "db49958f8b6a8eb12b559cc336737d24195b36c3dc9f03b95a67116eac7ab086"
},
"downloads": -1,
"filename": "py_eval_in_order-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "1335c4765c190d2816eb7e8f7eb2bf3f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5450,
"upload_time": "2025-07-29T11:31:46",
"upload_time_iso_8601": "2025-07-29T11:31:46.614116Z",
"url": "https://files.pythonhosted.org/packages/14/a6/e69b899ad21059e3c294bf86fd3b10ea426aab24e1af317aa56e32592556/py_eval_in_order-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-29 11:31:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MostafaHanii",
"github_project": "py_eio",
"github_not_found": true,
"lcname": "py-eval-in-order"
}