-
Notifications
You must be signed in to change notification settings - Fork 8
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
All modules in the same directory: #3
Comments
(the following is a duplicate of my reply to TranscryptOrg/Transcrypt#337) @JdeH I'm sure the misunderstanding must be mine. After more than a decade of active Python development, I confess I still dont really understand the module/package/import system. I wrote the Transcrypt section of the README in more haste than I should have and with issue #321 in the back of my mind. BTW, thanks for the pointer in your earlier comment to Peter Downs's article on PyPi. Re: your list of options (pip) I like this for general users -- who may or may not be using Transcrypt. The only thing that's hanging me up is not knowing how to set things up so that users can do from htmtree import ... instead of from from htmltree.htmltree import ... after pip installing the package. (Transcrypt modules) It's good to know about this one. I'll add it to the README. (in the project) I've done this in a more elaborate way (with git submodule) in NearlyPurePythonWebAppDemo Using git submodule allows discretion to bring in new versions of the htmltree project. I still end up with having to import from htmltree.htmltree. (PYTHONPATH) Have to say I've never liked environment variables like PYTHONPATH, but I'll certainly mention it. I find symlinks easy to create and delete at the command line without editing .bashrc or whatever is the WIndows equivalent. My current thought is to update the README (once I've solved the htmltree.htmltree issue) with a recommendation to use option 1 and a link to a separate doc that enumerates and discusses the other options. Cheers, "There should be one-- and preferably only one --obvious way to do it. |
Looks like https://stackoverflow.com/a/36515301/426853 has the answer to the |
Indeed, I think using an __init__,py is what your looking for. About obvious... It's very good that sometimes someone else points out to me that what seems to be obvious after having developed an arbitrary habit, isn't so obvious after all. I'm afraid in developing Transcrypt I've also developed some blind spots. Sometimes I forgot how to do something, want to look it up in the docs, but it isn't there, because at that time I thought it was 'obvious', or didn't think at all... |
And about environment vars: I don't like the use of them as well. They get me entangled with something organically grown like Windows more than I feel comfortable with. Maybe Transcrypts module search path should be alterable in a different way. |
I will try to come up with an alternative for 4 that doesn't use envir vars. |
In the newest version of TS, about to be committed, you'll be able to one of the following: EITHER use the
OR use a pragma
|
Hi Michael,
I am curious about:
See my comment at:
TranscryptOrg/Transcrypt#337
In short, all of the following should work:
To avoid the need for a symlink, 1 or 4 would be best. Since 1 isn't yet supported, 4 remains.
KR
Jacques de Hooge
The text was updated successfully, but these errors were encountered: