-
-
Notifications
You must be signed in to change notification settings - Fork 639
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 Vox environment manager to xonsh #675
Conversation
|
||
print('Creating environment...') | ||
|
||
vbuiltins.__xonsh_env__.create(env_path, with_pip=True) |
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.
vbuiltins
?
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.
Thanks a lot for the correction! It's supposed to be venv
. When I autoreplaced ENV with builtins.xonsh_env, I totally overlooked this bit :-(
Fixed in moigagoo@b92969e
Looks like there are conflicts now, probably from the new parser being merged in to master. If you could resolve these that would be awesome! |
Also, a fair amount of this seems to be reimplementing what argparse does. We should probably just move to argparse. There are a lot of examples in xonsh that use it already. |
Conflict resolved, ready to merge. I didn't quite understand your last comment. Do you mean that I reimplemented argparse functionality in Vox? Or are you talking about the new parser? I can't see how Vox can be rewritten to utilize argparse since xonsh handles argument parsing already. If it were a standalone app, there would be a way to do it, but I'd still use a more high-level library. |
def new(name): | ||
"""Create a virtual environment in $VIRTUALENV_HOME with python3's ``venv``. | ||
|
||
:param name: virtual environment name |
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.
Please use numpydoc style docstrings.
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.
Fixed in moigagoo@60daf5e
Thanks for resolving the conflicts, @moigagoo! And thanks for withstanding my many comments. In addition to those, it would be great if you could add in some autodoc hooks in the
Yes, this.
You could stick an
Tools like cliar are great. However, we are trying to maintain maximum protablility by relying only on the Python standard library and PLY as required runtime dependencies. (And I have thought about moving a copy of PLY into xonsh so that it could be basically standalone.) I consider vox of core value, so it would be nice if it didn't rely on optional dependencies :) Also, note, that not using argeparse is not blocking this. It was just a suggestion. We have other many other aliases that don't use argparse, so it is a reasonable choice not to. |
@@ -384,6 +387,8 @@ def xonshconfig(env): | |||
default='xonsh.environ.DEFAULT_TITLE'), | |||
'VI_MODE': VarDocs( | |||
"Flag to enable 'vi_mode' in the 'prompt_toolkit' shell."), | |||
'VIRTUAL_ENV': VarDocs( | |||
"Path to the currently active Python environment."), |
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 should have configurable=False
, I would think.
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.
home_path = builtins.__xonsh_env__['USERPROFILE'] | ||
|
||
elif os.name == 'posix': | ||
home_path = os.path.expanduser('~') |
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.
Sorry, not just this line, but this whole conditional can be replaced with the expanduser(). Rather than having the if-elif-else blocks, you can just have the one line.
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.
Sorry if that wasn't clear.
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 feel so stupid right now :-)
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'm sure this was my bad explanation in the early morning :)
On Sat, Feb 13, 2016 at 1:58 PM Konstantin Molchanov <
notifications@github.com> wrote:
In xonsh/vox.py
#675 (comment):
+import builtins
+
+
+class Vox:
- """Vox is a virtual environment manager for xonsh."""
- def init(self):
"""Ensure that $VIRTUALENV_HOME is defined and declare the available vox commands"""
if not builtins.**xonsh_env**.get('VIRTUALENV_HOME'):
if os.name == 'nt':
home_path = builtins.**xonsh_env**['USERPROFILE']
elif os.name
== 'posix':
home_path = os.path.expanduser('~')
I feel so stupid right now :-)
moigagoo/xonsh@17cb4cb
moigagoo@17cb4cb—
Reply to this email directly or view it on GitHub
https://github.com/scopatz/xonsh/pull/675/files#r52831995.
Asst. Prof. Anthony Scopatz
Nuclear Engineering Program
Mechanical Engineering Dept.
University of South Carolina
Affiliated Professor of the University of Haifa
scopatz@cec.sc.edu
Office: (803) 777-7629
Cell: (512) 827-8239
Check my calendar
https://www.google.com/calendar/embed?src=scopatz%40gmail.com
if os.name == 'nt': | ||
bin_dir = 'Scripts' | ||
|
||
elif os.name == 'posix': |
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.
You should probably import ON_WINDOWS
and ON_POSIX
from xonsh.tools
and use them here, for consistency.
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.
Fixed: moigagoo@1186637
OK @moigagoo, let us know when you think that this is ready to go in! |
I fixed all the issues you had reported except for the argparse one. Fingers crossed :-) First, thanks a lot for investing your time in reviewing and commenting on my commits. Second, I'd like to comment a bit on the argparse issue. I think it's a bit of an overkill in this case. Argparse has such an overcomplicated API, which, I believe, doesn't really pay off in this task. However, if you think it's the right thing to do, I'm ready to do it—xonsh is your project after all :-) |
🎆 |
Thank you for investing your time and effort in making xonsh better! Hopefully, that will continue :)
This is fine. As I said, I don't think argparse should block this since we have many other core utilities in xonsh that don't use it. Using argpare seems to be about 50%, so I don't think it is a big deal. If you think it is ready, let me know and I'll merge it in. |
Sure, go ahead. |
Add Vox environment manager to xonsh
Thanks a million, @moigagoo! |
vox
as a default alias.{env_name}
prompt variable.