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

ANN: htmltree.py #337

Closed
Michael-F-Ellis opened this issue Jun 19, 2017 · 10 comments
Closed

ANN: htmltree.py #337

Michael-F-Ellis opened this issue Jun 19, 2017 · 10 comments

Comments

@Michael-F-Ellis
Copy link

I've put the htmltree.py module from NearlyPurePythonWebAppDemo into a repository of its own.
https://github.com/Michael-F-Ellis/htmltree
Will try to get it up on PyPI when I have time.

Cheers,
Mike

@fzzylogic
Copy link

Good idea, thanks. It's not there at the moment.

@JdeH
Copy link
Collaborator

JdeH commented Jun 19, 2017

I've tried to visit your repo, but the link gives me a 404.
Is it a private repo?

Kind regards
Jacques

@Michael-F-Ellis
Copy link
Author

Oops! Now it's public. https://github.com/Michael-F-Ellis/htmltree

@Michael-F-Ellis
Copy link
Author

Some major additions (72 tag wrappers) and a complete re-write of the readme emphasizing clean syntax.

@JdeH
Copy link
Collaborator

JdeH commented Jun 25, 2017

I've tried to describe the way I upload Transcrypt to PyPi here, but I think it's only confusing, since it's so specific and maybe even obsolete, by now there may be better ways, no idea.

Instead of that maybe it's better to refer to the article that helped me out originally, since rather than a specific recipe it give insight in that to do. I believe it was this one:

http://peterdowns.com/posts/first-time-with-pypi.html

and also, to a lesser degree, this one:

https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/

@JdeH
Copy link
Collaborator

JdeH commented Jun 25, 2017

@Michael-F-Ellis

I read the following in your docs:

You'll want to arrange for the htmltree.py file to be in or symbolically linked in the same directory as any other python files to be transpiled as part of your project. That's a current limitation of Transcrypt. It's on the list of issues at the Transcrypt repo and the author, Jacques de Hooge, has it on his list of upcoming enhancements.

This should not be necessary.
Unless something badly fell over it should be possible to put your modules in hierarchically organized directories that are rooted in multiple places, as described in:

http://www.transcrypt.org/docs/html/special_facilities.html#transcrypt-s-module-mechanism

So you could:

  1. Pip-install htmltree from PyPi and it will be found both by Transcrypt and CPython
  2. Put htmltree in Transcrypt's modules directory, it will be found only by Transcrypt
  3. Put it in the directory of your project (main file so to say)
  4. Add the htmltree directory (so the dir where htmltree.py resides) to your PYTHONPATH

All possibilities should work.
1 is what is used e.g. for NumScrypt, 2 is what's used for e.g. math and re, 3 is what's used for some demos and autotests, and 4 I've tested with htmltree, leaving out any symbolic links.

There's a fair chance I am completely missing the point, and you refer to a limitation that I overlooked,
or I misunderstand what you mean here altogether?
Please help me out on this one...

KR
Jacques

@Michael-F-Ellis
Copy link
Author

@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

  1. (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.

  2. (Transcrypt modules) It's good to know about this one. I'll add it to the README.

  3. (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.

  4. (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,
Mike

"There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch."

@Michael-F-Ellis
Copy link
Author

Released version 0.7.0 and uploaded to PyPI

@JdeH
Copy link
Collaborator

JdeH commented Jun 25, 2017

Hey, great!!
Will try to pip install it a.s.a.p.

@JdeH
Copy link
Collaborator

JdeH commented Jun 25, 2017

B.T.W. Transcrypt 3.6.28 has been uploaded, allowing you to augment the module search path either by a pragma or by a command switch.

@JdeH JdeH closed this as completed Dec 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants