FUS statistics consists of two parts:
1. Interpreter (i.e "venv" or "conda")
2. Project generator type ("Django" or "Flask")
`com.jetbrains.python.newProjectWizard.collector.PythonNewProjectWizardCollector.GENERATOR_FIELD` was a class without any limitation and `DirectoryProjectGenerator` instance was reported (i.e one for Django).
When migrated to NPW, we:
1. Dropped most old generator classes
2. Called this function providing `this::class` by accident, and it was `CoroutineScope`, so we finished with lots of `CoroutineScope` as generator type in FUS.
We must:
1. Provide old names for project types to preserve statistics.
2. Make it type-safe this time.
We also found that interpreter statistics is nullable for `PySdkCreator` which isn't true: SDK creation statistics is always not null.
So we:
* Introduce interface for project generators that reports "name for the statistics"
* Implement it both for DS and PyCharm by returning class name by default
* Overwrite it for several well-known generators to preserve statistics (use old named of now-deleted classes)
* Make interpreter statistics not null.
(cherry picked from commit bdfa73ba043d3584c6ba1871bca7a464a550bc21)
KT-CR-19191
GitOrigin-RevId: 53f874c18d67d33083cf8508a58be257b5e89ab7
Associate poetry files ("poetry.lock", "pyproject.toml") with the Python Packages toolwindow.
Separate UI error handling from package management logic.
Add tests to check the installation and removal of packages using poetry and "pyproject.toml" modification.
Merge-request: IJ-MR-146002
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
(cherry picked from commit 2ab0816f10c970f738d6d931dc123481030cad38)
Merge-request: IJ-MR-148435
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
GitOrigin-RevId: be957c5343b73264c78134f156ad0e4034b912f9
In SDK:
* `v1`: legacy API that should be dropped (but still used by Python Plugin and DS)
* `v2`: slightly better API used both for new project and interpreter settings. Supports DSL UI validation. Must be adopted by DS and Python Plugin somehow.
In NPW:
* `newProject`, `newProject/steps` (aka `v1`) deprecated, used only by DS and Python Plugin.
* `newProjectWizard` (aka PyV3): the right new API to use. Sooner or later will be adopted by DS and Python Plugin
GitOrigin-RevId: c3d49ce95079dc5ba589955381ddfe42326295fd
Add general service for running coroutines in com.jetbrains.python.sdk.
Delete PoetryConfigLoader.kt and PoetryConfigService.kt.
Merge-request: IJ-MR-145094
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
GitOrigin-RevId: 474bbee10812bbe4ce5fd2db96602f12e9fa023b
Try to install Poetry and Pipenv if they are not found
Merge-request: IJ-MR-141839
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
GitOrigin-RevId: 535426090df23b358ba61a9e21c2f0954c201945
`BrowseFolderRunnable` and `*WithBrowseButton` family: getting rid of separate "title" and "description" parameters in favor of the chooser descriptor object, to avoid cloning the latter down the road.
GitOrigin-RevId: 33ec5968a1db953c60848974135055c288accf85
Implement version tracking for Python specified in pyproject.toml files.
Validate base interpreters using a Python version from pyproject.toml.
Merge-request: IJ-MR-142231
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
GitOrigin-RevId: ddd685240b6d58ef8d2e6c5668c89c96d8992d27
This commit partially reverts changes from 4da3e7da. While the consolidation of reStructuredText support into a single module is retained, it needs to be available as a plugin since some IDEs do not include it by default but can still benefit from its capabilities.
Merge-request: IJ-MR-139650
Merged-by: Andrey Lisin <andrey.lisin@jetbrains.com>
GitOrigin-RevId: bc5cde2970a0760e32ceaee61ceef8427e8f8fe5
Add a new setting Python Integrated Tools: Detect tests in Jupyter Notebooks.
Exclude Jupyter Notebook files from the scope for test detection by default.
Add tests
Merge-request: IJ-MR-134248
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
GitOrigin-RevId: 0bee082bde4fa608cb1907b8fbd64b97bb9755a0
- refactored NPW to use target-specific model
- creating interpreter through widget reuses the same UI (can be turned off by python.unified.interpreter.configuration)
- interpreter discovery and virtualenv creation using Targets API
- no more PyDetectedSdk in dialog
(cherry picked from commit 581b2d40254d26f02eb3aa61bc2e842854b87a3e)
IJ-MR-140986
GitOrigin-RevId: be29188304882ef5f0fb88bb60c538714a2d8746
Previously, such names were visible only on so-called "extended" completion,
activated when the hotkey for the basic completion was hit twice. The main reason
was that collecting such variants from indexes was a slow process, and we
didn't want to harm the responsiveness of completion for basic names.
Now it becomes possible thanks to a number of performance optimizations:
* Instead of using three separate indexes for classes, functions and variables,
we use one -- PyExportedModuleAttributeIndex. By definition, it includes only top-level
"importable" names, so we additionally save time by not filtering out irrelevant
entries. Also, it doesn't contain private definitions starting with an underscore.
It might bother some users, but given that the previous completion was used
extremely rarely, and the new one is going to be visible everywhere, it seems
that pruning unlikely entries as much as possible is a fare tradeoff. In the future,
we might enable them back on the "extended" completion if there is a demand.
Also, this index binds its keys to the project (`traceKeyHashToVirtualFileMapping`),
further eliminating useless index lookups.
* Thanks to the recent fixes in the platform (IJPL-265), it's now possible to
simultaneously iterate over all keys in an index and request values for a given key
without deadlocks, which is much faster than eagerly fetching all keys first.
* While scanning through all matching entries from indexes, we terminate
the lookup if the number of items exceeds the size of the lookup list.
We can further reduce this number by adjusting the "ide.completion.variant.limit"
registry value.
* Calculating expensive "canonical" import paths (e.g. "pkg.private.Name" is importable as
"pkg.Name") is offloaded to a background thread thanks to the `withExpensiveRenderer` API.
We still calculate these paths synchronously, though, for names whose raw qualified names
contain components starting with an underscore to decide whether these private names are
publicly re-exported and, hence, should be displayed.
The rest of the work has been put into reducing the number of entries on the list, e.g.
* The prefix under caret is now matched from the beginning of a name, e.g. `Bar<caret>`
matches `BarBaz`, but not `FooBar`.
* We don't suggest imported names clashing with those already available in scope.
* Some kinds of definitions are not suggested in specific contexts, e.g.
functions and variables are not suggested inside patterns and type hints.
* Nothing is suggested at the top-level of a class body, where dangling
reference expressions or calls are not normally expected.
Additionally, we don't suggest names from .pyi stubs at the moment, because
it pollutes the suggestion list with entries coming from the stubs for
third-party packages in Typeshed. We should probably enable them back once
we are able to properly disable Typeshed entries for not installed packages.
Some legacy forms of completion are left in the extended mode. In particular,
qualified names of classes are offered inside string literals only in this mode.
Also, module and package names are suggested only in the extended mode, because
top-level packages and modules are already suggested for the basic completion
by PyModuleNameCompletionContributor.
A few tests in PyClassNameCompletionTest were updated or removed entirely because
* we no longer suggest private names
* we no longer suggest names from private modules not re-exported in a public module
* we no longer suggest names clashing with those already available in scope
* prefix matching policy was changed to start at the beginning of an identifier
The whole feature can be disabled with the option "Suggest importable classes,
functions and variables in basic completion" in settings.
GitOrigin-RevId: 0787d42ce337b73b01a60f0bb7aa434fee43e659