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

add pshell --list-shells and default_shell ini options #2012

Merged
merged 6 commits into from
Oct 23, 2015

Conversation

mmerickel
Copy link
Member

I'm malleable on the naming of default_shell. I considered preferred_shells as well.


$ $VENV/bin/pshell --list-shells
Available shells:
bpython [not available]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better just to omit listing any shell whose factory returns None in the default listing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most factories should not return None because their bindings should depend on their reqs. This is mainly for bpython and ipython and I wanted some way to indicate to the user that things are good, they just need to install bpython.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we've gone to the trouble to factor this with entry points, wouldn't it be better to split out pyramid_bpython and pyramid_ipython packages, each with appropriate dependencies, and registering the relevant entrypoint? Then, anybody who wants one of them just installs that (mostly-empty) package, just like any other shell.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conversely pyramid ships a cherrypy wsgi entry point for no apparent reason.

@tseaver
Copy link
Member

tseaver commented Oct 21, 2015

LGTM

@digitalresistor
Copy link
Member

👍

@mmerickel mmerickel changed the title add pshell --list and default_shell ini options add pshell --list-shells and default_shell ini options Oct 21, 2015
@mmerickel
Copy link
Member Author

@sontek please provide some thoughts before I merge as it's building on your work.

@invisibleroads
Copy link
Contributor

Great, now we can choose the shell for pshell.

@@ -77,6 +96,8 @@ def pshell_file_config(self, filename):
for k, v in items:
if k == 'setup':
self.setup = v
elif k == 'default_shell':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would preferred_shells be a better name for this in the config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started with that and changed to default_shell but I can change it back. I don't really care. Naming is hard. Next someone is going to ask to load the option from an environment variable anyway.

@sontek
Copy link
Member

sontek commented Oct 22, 2015

@mmerickel I love it =) I wanted to rip the shells out but didn't think we'd want to break backwards compatibility. Only thing I saw was the config default_shell as a list of preferred shells seemed like a weird name

@mmerickel
Copy link
Member Author

This is probably too much but I realized that none of the shells themselves depend on pyramid so maybe the entrypoint doesn't need to be called something pyramid-specific. For example my apps tend to have their own shell command that loads the database etc outside of pyramid and it'd be nice to use these shell implementations there. We could go a step further in the future and pull the whole "shell runner" framework out of pyramid as a dependency.

myshell=my_app:ptpython_shell_factory
"""
entry_points={
'pyramid.pshell': [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That has to be pyramid.pshell_runner. Everything else looks good to me 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thank you.

@digitalresistor
Copy link
Member

:shipit:

mmerickel added a commit that referenced this pull request Oct 23, 2015
add pshell --list-shells and default_shell ini options
@mmerickel mmerickel merged commit 1274aba into Pylons:master Oct 23, 2015
dakra added a commit to dakra/pyramid_ptpython that referenced this pull request Oct 23, 2015
``pyramid.pshell`` is now ``pyramid.pshell_runner`` see: Pylons/pyramid#2012
@mmerickel mmerickel deleted the feature/pshell-list branch November 29, 2020 03:12
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

Successfully merging this pull request may close these issues.

6 participants