Closed augustebaum closed 1 year ago
Hi @augustebaum! I have questions and notes but no definitive answer.
setup.cfg
, package_dir = =src
and where = src
, I think, require a folder in src that is the package. Your content in src
should go into the folder my_project/src/my_project
, and then you can import stuff from config.py
as from my_project.config as ...
.If you want to be closer to the pytask cookiecutter and solve your issue, do this:
pyproject.toml
.src
in another folder as explained above.I hope it helps!
Thanks for the quick answer.
I trouble-shooted this with a friend and they taught me about the pip install -e .
technique whereby you install your own codebase as a package, so that the path to src
is included in sys.path
. This suffices to make my tasks run properly and it is already included in the environment.yml
file from the template so I'll leave it at that, but yeah my next step would have been to fit the template structure more strictly.
Thanks again!
Question about pytask
I created a project using a
cookiecutter
template and usedconda
to create an environment. My project is structured as follows:so that
tasks
contains all the tasks andmy_project
contains all the reusable code that might be released as a package. There are__init__.py
files in all directories withinsrc
.However, when I run
pytask
in the root directory, while in myconda
environment, collection of any task fails becauseimport config
fails. When I printsys.path
I get this:So it doesn't contain
my_project/src
. Does it make sense to anyone why this doesn't work, and how I can make it work?In
pyproject.toml
I have:as I used
poetry
before changing toconda
.In
setup.cfg
I have:as I didn't change anything from the
cookiecutter
template.Any help or support would be very much appreciated. In any case, thanks for your attention and have a great day.