drivendataorg / cookiecutter-data-science

A logical, reasonably standardized, but flexible project structure for doing and sharing data science work.
https://cookiecutter-data-science.drivendata.org/
MIT License
7.99k stars 2.41k forks source link

config import fails when using V2 scaffolding #370

Closed pjbull closed 1 month ago

pjbull commented 1 month ago

At: https://github.com/drivendataorg/cookiecutter-data-science/blob/master/%7B%7B%20cookiecutter.repo_name%20%7D%7D/%7B%7B%20cookiecutter.module_name%20%7D%7D/__init__.py#L1

Should be from {{ cookiecutter.module_name }} import config # noqa: F401


Discussed in https://github.com/drivendataorg/cookiecutter-data-science/discussions/369

Originally posted by **wrighteap** May 27, 2024 Hi! New cookiecutter user here. I just tried using your new v2 release. I created a project project, repo repo and module module, using the code scaffold option. I selected conda as my environment manager, and requirements.txt for my dependency file. pip list shows the package module installed at /path/to/repo. When I try to import module, I get a ModuleNotFoundError: No module named 'config', due to the import config under module/__init__.py -- Is this a design choice to invite me to add /path/to/repo/module to sys path or to modify the config directly? Sorry in advance if the question is inane or lacking in detail - happy to be told so or asked for additional information.
pjbull commented 1 month ago

@wrighteap This should be fixed now. Would you mind testing for your use case? Make sure that when cookiecutter asks to re-clone the repo, you say yes so you get the latest.

wrighteap commented 2 weeks ago

@pjbull Hi. Sorry, clearly late on this. Using your latest version and things work as expected. Thank you very much!