Skip to content
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

Move nmodl python files into subdirectory #462

Closed
ohm314 opened this issue Dec 18, 2020 · 3 comments · Fixed by #1147
Closed

Move nmodl python files into subdirectory #462

ohm314 opened this issue Dec 18, 2020 · 3 comments · Fixed by #1147

Comments

@ohm314
Copy link
Contributor

ohm314 commented Dec 18, 2020

Currently the nmodl python module files are in a top level directory called nmodl. Having the same name as the package itself it often leads to confusion especially when testing the python package. Various scenarios fail because python uses the current working dir as a search dir for modules. This way the local nmodl directory will take precedence over an installed nmodl python module (eg. in site-packages). We have several workarounds to address this, but we keep finding scenarios, where confusing errors show up.
A proper fix is needed. For example the nmodl directory should be moved into another dir, maybe named pkg. It is not sufficient to move the directory as this will entail a number of changes in the build system and CI:

  • CMakeLists.txt need to be checked and fixed
  • setup.py needs to be checked and fixed
  • azure CI will need checking for both the testing and wheel building pipelines
  • travis CI might also need a check

This list is non-exhaustive but should cover most of what is needed.

@ohm314 ohm314 added the good first issue Good for newcomers label Dec 18, 2020
@pramodk
Copy link
Contributor

pramodk commented Mar 3, 2021

@alkino : this is for the master branch.

@cattabiani
Copy link
Contributor

this is difficult to do in python since the name of the module IS the name of the top level folder (there there is __init __.py, the one that you want to rename). You could stuff the folder in another folder (i.e. nmodl/python/nmodl) but you need to change the source root in setup.py to something that is not .. This is very unusual for python. Also the docs build will probably fail since it leverages the fact that the module is in the local dir. Sometimes it is a feature, sometimes it is a bug

@cattabiani
Copy link
Contributor

anyway, if you really want to put it into something like: nmodl/pkg/nmodl you can follow this:

https://stackoverflow.com/questions/14417236/setup-py-renaming-src-package-to-project-name

@pramodk pramodk removed the good first issue Good for newcomers label Mar 26, 2021
@alkino alkino removed their assignment Aug 18, 2022
JCGoran added a commit that referenced this issue Feb 27, 2024
JCGoran added a commit that referenced this issue Mar 6, 2024
* replace `setup.py` with `pyproject.toml`
* move all Python package requirements to single `requirements.txt`
* remove checking Python package requirements in `CMakeLists.txt`
* move Python bindings to own dir (python/nmodl), fixes #462
* add separate script for generating docs
* add `packaging/change_name.py` script to as workaround to enable both
  NMODL and NMODL-nightly wheels in CI
* update documentation and CI to reflect above changes

---------

Co-authored-by: Luc Grosheintz <luc.grosheintz@gmail.com>
ohm314 pushed a commit that referenced this issue May 21, 2024
* replace `setup.py` with `pyproject.toml`
* move all Python package requirements to single `requirements.txt`
* remove checking Python package requirements in `CMakeLists.txt`
* move Python bindings to own dir (python/nmodl), fixes #462
* add separate script for generating docs
* add `packaging/change_name.py` script to as workaround to enable both
  NMODL and NMODL-nightly wheels in CI
* update documentation and CI to reflect above changes

---------

Co-authored-by: Luc Grosheintz <luc.grosheintz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants