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

Services as a trait to the server. #31

Closed
Zsailer opened this issue Nov 26, 2018 · 4 comments
Closed

Services as a trait to the server. #31

Zsailer opened this issue Nov 26, 2018 · 4 comments

Comments

@Zsailer
Copy link
Member

Zsailer commented Nov 26, 2018

Right now, services and their corresponding managers are hardcoded as traits to the ServerApp. And the handlers are hardcoded into the web app.

I think we should make which services are loaded/registered a configurable option.

This would allow other applications to subclass the ServerApp and customize the services it uses. I mentioned this briefly in issue #29.

@Zsailer
Copy link
Member Author

Zsailer commented Nov 26, 2018

I'm drafting what a typical service might look like:

services = List(
    dict(
        # Passes manager to tornado settings using this name
    	name='service_name', 
        # Name of the service model to find handlers and manager.
        module='service_module',
        # Name of the manager class to import
        manager='manager_class',
    ),
    ...
)

A service module can include the following elements that the ServerApp will look for:

my_service
├── __init__.py
├── api_handlers.py
├── handlers.py
└── manager.py

handlers.py

class MyHandler(JupyterHandler):
    """Handlers for this service."""

handlers = [
    ('url', MyHandler)
]

api_handlers.py

class MyAPIHandler(APIHandler):
    """API Handlers for this service."""

api_handlers = [
    ('url', MyAPIHandler)
]

manager.py

class MyManager(traitlets.config.Configurable):
    """"""

@SylvainCorlay
Copy link
Contributor

Hey @Zsailer thanks for starting this. I was swamped with work earlier but I am getting into this on Wednesday, review the other PR and edit the JEP!

@Zsailer
Copy link
Member Author

Zsailer commented Nov 26, 2018

Hey @SylvainCorlay, no problem at all!

I'll move some of these points over to the JEP when I get a chance.

@Zsailer
Copy link
Member Author

Zsailer commented May 17, 2019

Closing this issue. I don't think this useful anymore after the Jupyter Server Workshop.

@Zsailer Zsailer closed this as completed May 17, 2019
Zsailer pushed a commit to Zsailer/jupyter_server that referenced this issue Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants