-
Notifications
You must be signed in to change notification settings - Fork 1
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
#3 Implement IPython REPL #7
Conversation
It seems IPython 6.0.0 is not available for Python2.7 Do you plan to support Python2 ? |
src/blueberrypy/command.py
Outdated
@@ -445,6 +483,8 @@ def get_command_parser_and_callback(command): | |||
doc, callback = create.__doc__, create | |||
elif command == "console": | |||
doc, callback = console.__doc__, console | |||
elif command == "ishell": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go for extending existing command with autonegotiation of REPL, available for use. See django-extensions - > shell_plus
setup.py
Outdated
@@ -10,7 +10,20 @@ | |||
"docopt>=0.6", | |||
"Jinja2>=2.7", | |||
"PyYAML>=3.10", | |||
"python-dateutil>=2.2"] | |||
"python-dateutil>=2.2", | |||
# IPython dependencies: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you need to lock recursive deps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I do not need any surprises of unexpected updates.
Do you think I should not do that and lock only IPython dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a project of a library type you shouldn't restrict versioning strictly unless for corner cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I do not trust them enough to do that.
But if you wish I may fix that if you tell me which versions should I allow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see below
There's environment markers for this purpose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz also move ipython to extras
setup.py
Outdated
"traitlets==4.3.2", | ||
"wcwidth==0.1.7"] | ||
"ipython==5.3.0" if sys.version_info < (3, 3) | ||
else "ipython==6.0.0"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>=
setup.py
Outdated
"simplegeneric==0.8.1", | ||
"traitlets==4.3.2", | ||
"wcwidth==0.1.7"] | ||
"ipython==5.3.0" if sys.version_info < (3, 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<=
src/blueberrypy/command.py
Outdated
|
||
import cherrypy | ||
from IPython.terminal.interactiveshell import TerminalInteractiveShell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will fail if ipython isn't installed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ipython is in core dependencies so I guess it will be installed with the blueberrypy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and it shouldn't be there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it's not a runtime dependency, it should be optional; if one wants to use ipython they'll install it.
can you borrow the whole logic from django-extensions? |
What do you mean by that? |
copy-paste driven development, I think |
I do not understand what exactly you want me to copy-paste. Other shells support? Or what? |
Updated PR. @webknjaz pls review again =) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what about other shells?
setup.py
Outdated
@@ -75,7 +75,10 @@ | |||
"Routes>=2.0", | |||
"backlash>=0.0.5", | |||
"Shapely>=1.2", | |||
"GeoAlchemy2>=0.2.4"], | |||
"GeoAlchemy2>=0.2.4", | |||
"ipython<=5.3.0" if sys.version_info < (3, 3) else "ipython>=6.0.0"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional must be computed once and passed via variable; alternatively, you may wrap it into lambda. Copy-pasted code snippets lead to unexpected diversity increase of code base over time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
src/blueberrypy/command.py
Outdated
|
||
import cherrypy | ||
from docopt import docopt | ||
from cherrypy.process import servers | ||
from cherrypy.process.plugins import Daemonizer, DropPrivileges, PIDFile | ||
|
||
import blueberrypy | ||
import blueberrypy.shell as shell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't from blueberrypy import shell
shorter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is.
src/blueberrypy/shell.py
Outdated
|
||
|
||
def get_package_name(config): | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getattr(config, 'project_metadata', {}).get('package', None)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my version is more explicit.
src/blueberrypy/shell.py
Outdated
) | ||
|
||
|
||
def _make_sa_engine(config): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this code be shared with SQLAlchemy Tool module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it cannot be shared properly =(
I think we'll stop on IPython for now. Will add other shells on demand. |
I do not see any good way to share code with SQLAlchemy tool without overcomplicating the tool itself. |
src/blueberrypy/shell.py
Outdated
ns['cherrypy'] = importlib.import_module("cherrypy") | ||
ns['blueberrypy'] = importlib.import_module("blueberrypy") | ||
|
||
if config.use_sqlalchemy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could reuse this property https://github.com/open-craft-guild/blueberrypy/blob/master/src/blueberrypy/config.py#L270
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic I used was present in old blueberrypy console. This is why I kept it.
src/blueberrypy/shell.py
Outdated
|
||
|
||
def get_user_namespace(config, include_pkg=False): | ||
assert isinstance(config, BlueberryPyConfiguration), type(config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type(config)
doesn't look like sufficient error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Fixed in 44e80e3
@webknjaz can this be merged, or any further changes are required? |
Go ahead and merge it.
…On Jun 26, 2017 17:30, "Oleksandr Kovalchuk" ***@***.***> wrote:
@webknjaz <https://github.com/webknjaz> can this be merged, or any
further changes are required?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjT71JfY9JgNkqslyOIbtp93ysjmMU4ks5sH8CYgaJpZM4NVipO>
.
|
@webknjaz I am not authorized to merge this pull request. |
Fix this first |
Added blueberrypy ishell command
Implement #3