-
Notifications
You must be signed in to change notification settings - Fork 27
Python #1547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python #1547
Conversation
| f"You are using Python {python_version.major}.{python_version.minor}.{python_version.micro} " | ||
| f"You may experience unexpected errors or issues with the validation" | ||
| ) | ||
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AC requires that the validation exits if its not correct python version. With current code only warning will be logged but validation will continue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought this through and alterred this--code now enforces a minimum version and warns if it is a newer version of python >3.12 as these are untested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran a validation using python3.9 to validate the PR. I got following error.
python3 core.py validate -s sdtmig -v 3.4 -dp /Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/tests/resources/test_dataset.json
Traceback (most recent call last):
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/core.py", line 13, in <module>
from cdisc_rules_engine.config import config
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/__init__.py", line 1, in <module>
from .plugin_loader import PluginLoader
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/plugin_loader.py", line 10, in <module>
from cdisc_rules_engine.operations import OperationsFactory
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/operations/__init__.py", line 1, in <module>
from cdisc_rules_engine.operations.operations_factory import OperationsFactory
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/operations/operations_factory.py", line 4, in <module>
from cdisc_rules_engine.operations.base_operation import BaseOperation
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/operations/base_operation.py", line 1, in <module>
from cdisc_rules_engine.models.operation_params import OperationParams
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/models/operation_params.py", line 3, in <module>
from cdisc_rules_engine.models.external_dictionaries_container import (
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/models/external_dictionaries_container.py", line 1, in <module>
from cdisc_rules_engine.models.dictionaries.dictionary_types import DictionaryTypes
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/models/dictionaries/__init__.py", line 6, in <module>
from .abstract_factory import AbstractTermsFactory
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/models/dictionaries/abstract_factory.py", line 11, in <module>
from .meddra import MedDRATermsFactory
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/models/dictionaries/meddra/__init__.py", line 6, in <module>
from .meddra_terms_factory import MedDRATermsFactory
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/models/dictionaries/meddra/meddra_terms_factory.py", line 14, in <module>
from cdisc_rules_engine.utilities.utils import get_dictionary_path, decode_line
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/utilities/utils.py", line 35, in <module>
from cdisc_rules_engine.check_operators.helpers import is_valid_date
File "/Users/ramilabbasov/Desktop/ISSUES/ISS-1485/cdisc-rules-engine/cdisc_rules_engine/check_operators/helpers.py", line 161, in <module>
def detect_datetime_precision(date_str: str) -> DatePrecision | None:
TypeError: unsupported operand type(s) for |: 'EnumMeta' and 'NoneType'
The error is because we are importing code before performing python check. I think it would be better to move the python version test in top of core.py file before any imports. If version validates we can proceed on to import our library and continue with whatever operation user has selected.
RamilCDISC
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to highlight required version of python more strongly.
this PR adds a python version check and a warning if users are not using 3.12.