#Writing Python Modules
1 messages · Page 1 of 1 (latest)
@frigid warren if you get a chance can you let me know if all that looks right to you? If so, I will work on adding this to our docs.
It's already in the docs, and the sdk/python/dev module is an example of this.
I'd probably put db under src/main/db, depending on what you plan on putting there. Remember that soon that'll become src/my_module/db.
Oh that is great, thanks so much Helder!
The only thing that is confusing to me is still that we have code inside of __init__.py in the docs example, I thought this was an antipattern in python?
So instead of src/main/__init__.py I would expect there to be somethign like src/main/foo.py that contains the actual logic of whats inside of src/main/__init__.py
Ok, maybe I needed to split that into two code blocks. If you notice, there's comments pointing that they're two different files, but I can see how that's easily overlooked. By the way, that section is more visible in the new docs: https://deploy-preview-8087--devel-docs-dagger-io.netlify.app/api/structure-packaging#module-layout
Ah I see my confusion
# src/main/main.py import dagger
I kind of glossed over that, I would suggest making this two code blocks to make it crystal clear (even in the new doc)
But otherwise this is great, glad its already in the docs!
Do you mind making that change?
Otherwise I can do it tomorrow.
You can also see a bit further that I've added instructions to put a single main.py next to pyproject.toml.
Yeah I am happy to do it!