-
Notifications
You must be signed in to change notification settings - Fork 294
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
Warn when files could override Python modules #10787
Conversation
@@ -169,7 +170,9 @@ async function activateUnsafe( | |||
|
|||
const [serviceManager, serviceContainer] = initializeGlobals(context); | |||
activatedServiceContainer = serviceContainer; | |||
initializeTelemetryGlobals(serviceContainer); | |||
initializeTelemetryGlobals((interpreter) => |
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.
Just pass a callback instead of passing the entire interface, as we dont want the telemetry layer to have any dependencies on interpreter code.
let globalContainer: IServiceContainer | undefined = undefined; | ||
|
||
export function initializeGlobals(serviceContainer: IServiceContainer) { | ||
globalContainer = serviceContainer; |
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.
We no longer need to inject the entire service container, just a callback is sufficient.
Codecov Report
@@ Coverage Diff @@
## main #10787 +/- ##
=======================================
Coverage 63% 63%
=======================================
Files 476 481 +5
Lines 33058 33371 +313
Branches 5391 5437 +46
=======================================
+ Hits 20875 21087 +212
- Misses 10185 10255 +70
- Partials 1998 2029 +31
|
@@ -169,7 +170,9 @@ async function activateUnsafe( | |||
|
|||
const [serviceManager, serviceContainer] = initializeGlobals(context); | |||
activatedServiceContainer = serviceContainer; | |||
initializeTelemetryGlobals(serviceContainer); | |||
initializeTelemetryGlobals((interpreter) => | |||
serviceContainer.get<IInterpreterPackages>(IInterpreterPackages).getPackageVersions(interpreter) |
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.
Moved IInterpreterPackages from telemetry folder into Interprter folder, and passed just a callback into interpreters layer, we don't need everything, a callback is sufficient.
@@ -29,13 +29,13 @@ import { | |||
import { noop } from '../../platform/common/utils/misc'; | |||
import { IServiceContainer } from '../../platform/ioc/types'; | |||
import { sendTelemetryEvent, Telemetry } from '../../telemetry'; | |||
import { InterpreterPackages } from '../../platform/telemetry/interpreterPackages.node'; | |||
import { InterpreterPackages } from '../../platform/interpreter/interpreterPackages.node'; |
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 dependency issues, installation code does not need to depend on telemetry for things like getting packages
import { PythonEnvironment } from '../pythonEnvironments/info'; | ||
import { IInterpreterPackages } from '../../telemetry'; | ||
import { IInterpreterPackages } from './types'; |
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.
Moved out of telemetry into interpreter.
} | ||
|
||
export const IInterpreterPackages = Symbol('IInterpreterPackages'); | ||
export interface IInterpreterPackages { |
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.
Moved from telemetry folder
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 need to reference this from the new code, hence moved this from telemtry into Interrpeter & ensured telemetry doesnt depend on this.
@@ -50,6 +54,15 @@ export function registerTypes(serviceManager: IServiceManager) { | |||
KernelProgressReporter | |||
); | |||
|
|||
serviceManager.addSingleton<IInterpreterPackages>(IInterpreterPackages, InterpreterPackages); | |||
serviceManager.addSingleton<IExtensionSyncActivationService>( |
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.
These things that have to do with interpeters is now in interpeters folder and no longer in telemetry folder.
@@ -1,23 +0,0 @@ | |||
// Copyright (c) Microsoft Corporation. All rights reserved. |
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.
Yay (i think), service registrations in telemetry folder anymore
@@ -106,13 +105,6 @@ export type ResourceSpecificTelemetryProperties = Partial<{ | |||
kernelLiveCount: number; | |||
}>; | |||
|
|||
export const IInterpreterPackages = Symbol('IInterpreterPackages'); | |||
export interface IInterpreterPackages { |
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.
Moved out of here
50c2319
to
12d9f03
Compare
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.
Cool this will be great for customers (still want Python to own this, but that can always come later). One minor question was on the listPackages possibly guarding against python extension install internally.
12d9f03
to
0a1a16d
Compare
0a1a16d
to
1d1360a
Compare
Fixes #7538