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

#3 Implement IPython REPL #7

Closed
wants to merge 0 commits into from

Conversation

anxolerd
Copy link

@anxolerd anxolerd commented May 9, 2017

Added blueberrypy ishell command

Implement #3

@anxolerd
Copy link
Author

anxolerd commented May 9, 2017

It seems IPython 6.0.0 is not available for Python2.7 Do you plan to support Python2 ?
If no, should I downgrade IPython to lower version?

@@ -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":
Copy link
Member

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:
Copy link
Member

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?

Copy link
Author

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?

Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

see below

@webknjaz
Copy link
Member

should I downgrade

There's environment markers for this purpose

Copy link
Member

@webknjaz webknjaz left a 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"]
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

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

<=


import cherrypy
from IPython.terminal.interactiveshell import TerminalInteractiveShell
Copy link
Member

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

Copy link
Author

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

Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

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

Why shouldn't it?

Copy link
Member

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.

@webknjaz
Copy link
Member

can you borrow the whole logic from django-extensions?

@anxolerd
Copy link
Author

can you borrow the whole logic from django-extensions?

What do you mean by that?

@webknjaz
Copy link
Member

copy-paste driven development, I think

@anxolerd
Copy link
Author

anxolerd commented May 11, 2017

copy-paste driven development, I think

I do not understand what exactly you want me to copy-paste. Other shells support? Or what?

@anxolerd
Copy link
Author

Updated PR. @webknjaz pls review again =)

Copy link
Member

@webknjaz webknjaz left a 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"],
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

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

Agree


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
Copy link
Member

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?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it is.



def get_package_name(config):
return (
Copy link
Member

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)

Copy link
Author

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.

)


def _make_sa_engine(config):
Copy link
Member

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?

Copy link
Author

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 =(

@anxolerd
Copy link
Author

I think we'll stop on IPython for now. Will add other shells on demand.

@anxolerd
Copy link
Author

@webknjaz:

  • removed code duplication from setup.py
  • shorter import is used

I do not see any good way to share code with SQLAlchemy tool without overcomplicating the tool itself.

ns['cherrypy'] = importlib.import_module("cherrypy")
ns['blueberrypy'] = importlib.import_module("blueberrypy")

if config.use_sqlalchemy:
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

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.



def get_user_namespace(config, include_pkg=False):
assert isinstance(config, BlueberryPyConfiguration), type(config)
Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

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

Agree. Fixed in 44e80e3

@anxolerd
Copy link
Author

@webknjaz can this be merged, or any further changes are required?

@webknjaz
Copy link
Member

webknjaz commented Jun 26, 2017 via email

@anxolerd
Copy link
Author

@webknjaz I am not authorized to merge this pull request.

@webknjaz
Copy link
Member

This branch is out of sync with the base branch.
Changes from the base branch must be synced with this branch before merging.

Fix this first

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.

2 participants