-
Notifications
You must be signed in to change notification settings - Fork 201
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
re-factor to make it easy to deploy and support other web technologies. #57
Comments
Hi John! Sorry about the slow response. d3py is a bit of a slow-burn project! As for the model / view split - it all sounds good! I'm very keen to do the following;
I think splitting this out along the lines you describe would be a good idea! Would you be up for implementing it? If you can get a pull request together, I'd love to take a look, and I'm sure @mynameisfiber would be too. |
Hello Mike, Yes, I would like to implement it. This week I'll be going to pyData but should have time to work on it after that. Regards, |
Awesome! I'm looking forward to it. Enjoy pyData! |
…eb technologies. - the displayable module knows how to display figures - the deployable module knows how to deploy figures - favor os.sep of hardcoding / in path - replaced string replace calls with jinja2 template module
@kern3020 You can add the following into
and then use
And be able to just refresh my browser to see the changes Another note.... do you think we could change the terminology to be more specific? Namely, display doesn't always mean display through HTTP. Similarly, deploy doesn't necessarily always mean save to disk. |
Hello Micha, Thanks for your feedback. It got me thinking about a refinement which will Here is what an example looks like with this pull request
By default, why does the user of d3py need to know about the SimpleServer? What if Figure contained both a displayable and deployable and provided defaults from them. [aside: there is a typo in the pull request. SimpleServer is spelled SimplyServer.] Then the code fragment becomes...
If someone wanted a custom displayable, they would need to create a SimpleServer or IPython when that work is completed and provide it as an argument to figure constructor. What do you think about this refinement? -jk |
Hello Mike,
Unfortunately, the word 'removed' is ambiguous here. It has not been deleted. It has been moved into the SimpleServer class. So, with pull request #64 it became
I think the modifications I mentioned in response to Micha's feedback would address your feedback, too. Both the displayable and deployable will be encapsulated in figure. By default, the user won't need to know anything about them.
Everyone shares the importance adhering to a public API. I didn't understand that adding a function to the examples directory represented d3py's API. The util module will be deleted along with the display function. Any bits which are still interesting will be encapsulated into a well-known class.
I think so.
Good idea! I would like add an example showing how to configure d3py for something other than localhost. -jk |
Thanks for all this John! I think it makes sense to use the examples as a guide for d3py's set of idioms, so that we can get a hearty discussion going each time there's a change. With the advent of trifacta's vega project, I think d3py's set of idioms are going to become even more important! There's an opportunity for us to shape how plotting in python will take place over the next few years! |
Hello Mike,
I was looking at the d3py python module. At the moment, it is tightly coupled with python’s SimpleHTTPServer. From a desktop, this works well interactively.
Have you considered a Model/View split? This would provide a good way to deploy d3. Figure and its subclasses would make fine models, but all code which is specific to a web server would be refactored into a class which knows about the Simple HTTP Server. Another class would know how to write to the file system. It might look something like:
// encapsulates all code related to the SimpleHTTPServer implementation.
vHttp = createHTTP(“www.example.com”, 8080)
// creates a class which knows one to write the d3 code to the filesystem for deployment.
vFs = createFS(“~/workspace/opportunity/static”)
// This call is just a placeholder. It will take fewer args as web specific args
// would be passed to creatHTTP().
fig = PandasFigure(...)
// The user can show it. The functionality will be the as it is now.
vHttp.show(fig)
// and/or they can save it to a file system which could be handed off to deploy on the website.
vFs.save(fig)
The added benefit of this pattern is it can extended. This may be particularly useful for HTTP as there are a plethora of web servers and web technologies. New classes could be created for integration and/or deployment.
What do you think?
Regards,
John
The text was updated successfully, but these errors were encountered: