toqito icon indicating copy to clipboard operation
toqito copied to clipboard

Refactor: The channel_dim function should live in channel_props

Open vprusso opened this issue 2 years ago • 3 comments

Right now, the channel_dim.py file lives in helper/ but should most likely live in channel_props/.

vprusso avatar Nov 15 '23 12:11 vprusso

Attempt 1 to fix this issue led to some object not callable errors. Fixing this issue will also mean we need to tackle the pytest import issues.

if python test_some_file.py was used, there were no errors. But using pytest does cause problems.

https://pytest.org/en/7.4.x/explanation/pythonpath.html#pytest-vs-python-m-pytest https://blog.ionelmc.ro/2014/05/25/python-packaging/#alternatives https://pytest-with-eric.com/introduction/pytest-pythonpath/#How-Does-Python-Find-The-Execution-Path https://docs.pytest.org/en/7.1.x/explanation/pythonpath.html

In pytest documentation, following is recommended. This also does not fix the errors. https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html#tests-outside-application-code

[tool.pytest.ini_options]
addopts = [
    "--import-mode=importlib",
]

Need to spend more time understanding PYTHONPATH and pytest issues. Using python -m pytest does not fix the multiple errors.

Trying out a toqito/src/toqito directory with a pytest.ini file also did not fix the errors.

Specifying the full path toqito.some_module.some_file import some_func does fix the errors but this is not recommended considering other functions imported via toqito.some_module import some_func do not lead to errors.

purva-thakre avatar Nov 16 '23 17:11 purva-thakre

Attempt 3 to resolve this issue also resulted in similar test failures.

Even after we changed the directory structure, moving the function to channel_props caused some import issues where we have to specify the full import path from toqito.channel_props.channel_dim import channel_dim. It's not like there are 2 functions labeled channel_dim?

Plus, with the full import path, there were a couple of test failures.

purva-thakre avatar Apr 09 '24 01:04 purva-thakre

Check all import paths:

https://stackoverflow.com/a/6466248 https://docs.python.org/3/reference/import.html

purva-thakre avatar May 01 '24 01:05 purva-thakre

Replaced by #677

purva-thakre avatar Jul 15 '24 21:07 purva-thakre