-
Notifications
You must be signed in to change notification settings - Fork 39
Improve virtualenv aware by searching subdirectories #57
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
Improve virtualenv aware by searching subdirectories #57
Conversation
The common way of using |
In my case, I usually put the
In this case, |
@uoo723 Thanks for elaborating. I'm not familiar with virtual envs but I think this makes sense to add. |
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 for the PR 🎉
Could you update the code to use asynchronous methods as much as possible, so ide-python
won't block the UI.
lib/main.js
Outdated
var venvPath = ""; | ||
|
||
new Directory(projectPath) | ||
.getEntriesSync() |
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.
Could you use the asynchronous method getEntries()
because getEntriesSync()
can block the UI if it takes too long?
Personally I'd wrap it in a Promise to be able to use it with async
/await
but you can also use native callbacks. What ever you prefer.
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 just updated.
lib/main.js
Outdated
.forEach(entry => { | ||
if (entry.isDirectory()) { | ||
if (entry.getBaseName() === 'bin' && | ||
entry.getFile('python').existsSync()) { |
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.
Would prefer async here too.
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 for converting everything to async. 👍
I added one commit that ran prettier
on the code and switched from var to let
/const
.
I think there's still room for simplification here and a small unit test for this functionality would be great but we can iterate on this in future PRs.
@uoo723 Are you interested in helping us maintain this package?
I’d be happy to help you with this package. |
🆒Added you as a collaborator to the repo. |
The common pattern of creating virtualenv is creating subdirectory.
So, I added code that searches that directory and assigns proper value for VIRTUAL_ENV.