FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix #1147 (search environments.txt file for conda environments) by DonJayamanne · Pull Request #1240 · DonJayamanne/pythonVSCode · GitHub

fix #1147 (search environments.txt file for conda environments) - #1240

Merged
DonJayamanne merged 9 commits into
masterfrom
1147envfile
Sep 26, 2017
Merged

fix #1147 (search environments.txt file for conda environments)#1240
DonJayamanne merged 9 commits into
masterfrom
1147envfile

Conversation

Copy link
Copy Markdown
Owner

environments.txt file returns conda environments not returned by the command conda info --envs

return getInterpreterDisplayName(pythonPath)
.catch(() => defaultValue);
}
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Missing a newline.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

fixed.

private locators: IInterpreterLocatorService[] = [];
constructor(private virtualEnvMgr: VirtualEnvironmentManager) {
const versionService = new InterpreterVersionService();
// The order of the services is important

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is not ending comments in a period a thing in the TypeScript world? (Serious question because it's definitely a thing to always use a period in Python.) Otherwise I would definitely use an exclamation point here. 😄 (And if you don't have a preference then I vote for putting in periods to know that a comment definitely is finished and not accidentally incomplete.)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is not ending comments in a period a thing in the TypeScript world

Never heard of this.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Now i have

}
public getInterpreters() {
if (this.interpreters.length > 0) {
return Promise.resolve(this.interpreters);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No async/await yet in the version of TypeScript that VS Code uses?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Old habbits die hard, async await is available and used.
I'm using promises as well, in most of these places as we I to maximize parallelism... (i.e. return promises) and await on ALL where possible

}, []))
.then(interpreters => this.interpreters = interpreters);
}
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Missing a newline.

.then(interpreters => _.flatten(interpreters))
.then(items => items.map(fixInterpreterDisplayName))
.then(items => items.map(fixInterpreterPath))
.then(items => items.reduce<PythonInterpreter[]>((prev, current) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The name prev is misleading since it's a collection and not a single item like current. Maybe rename it accum or accumulator (typical name from functional programming)?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

agreed

* However all these environments seem to be listed in the environments.txt file (confirmed on windows and linux)
* @export
* @class CondaEnvFileProvider
* @implements {IInterpreterLocatorService}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What are these comments for? They seem to (be trying to) mirror what the code already says so I'm wondering what the benefit is.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I thought it would be best to write the comments out. Else one might ask whey use environments.txt as well as conda info --env. This makes it obvious that environments.txt can contain additional items. Comment removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry for the ambiguity of that comment, I meant the @export comments and such more than the block comments. (I totally support block comments 😄 )

* Environments created using the command 'conda create --p python=x.x' are not returned by the above command
* However all these environments seem to be listed in the environments.txt file (confirmed on windows and linux)
* @export
* @class CondaEnvFileProvider

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This doesn't match the CondaEnvFileService name below.

})
.then(promises => Promise.all(promises))
.then(interpreterPaths => {
return interpreterPaths.filter(item => item.trim().length > 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is it worth keeping the paths trimmed instead of tossing the trimmed result? I.e.

interpreterPaths.map(String.prototype.trim).filter(item => item.length > 0);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Agreed

Comment thread src/client/interpreter/helpers.ts Outdated
if (stdout.length === 0) {
return '';
}
const lines = stdout.split(/\r?\n/g).filter(line => line.trim().length > 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Any reason not to keep the trimmed version?

return this.versionService.getVersion(interpreter, path.basename(interpreter))
.then(version => {
// Strip company name from version
const startOfCompanyName = version.indexOf(`:: ${AnacondaCompanyName}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is going to be tricky once Anaconda Co starts to use that name instead of Continuum Analytics.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Will add both company names. I'm not too concerned even if it doesn't work as its merely a formatting issue.

DonJayamanne merged commit b46ae28 into master Sep 26, 2017
DonJayamanne deleted the 1147envfile branch October 11, 2017 18:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL