koxudaxi / poetry-pycharm-plugin

A PyCharm plugin for poetry

Home Page:https://koxudaxi.github.io/poetry-pycharm-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

extension points

koxudaxi opened this issue · comments

We must list the extension points that will implement.

Extension points

@vlasovskikh
Would you please share a list of extension points to support the plugin in PyCharm?
these extension points would not exist yet.

@koxudaxi Meanwhile, I've begun switching some of my personal projects to Poetry as an experiment and I've installed your plugin to get a hands-on experience with it.

See a PR to my own repository vlasovskikh/funcparserlib/pull/61. Feel free to review it if you're interested :)

@koxudaxi Could you please set me as the assignee for this issue? It would be easier for me to track it in my list of assigned and pending issues. I will look into the extension points we need and into our PyCharm API around environments and package management in general. I hope I'll do it by the next weekend, but I don't make any promises.

Here's the list I got so far. It's still a work in progress. My next steps will be:

  • Come up with a possible API (extension points) to accommodate these features for Pipenv, Poetry, and potentially other package managers and Python interpreter types
  • Start adding bits of this API into PyCharm 2020.2 EAP

The list of places I had to customise to enable Pipenv support (Poetry is somewhat similar here, but there will be things that are different like several possible environments per project):

Hard-coded:

  • Set up a new project
    • PythonSdkConfigurator
      • Detect and set up a per-project interpreter with Pipenv as the package
        manager
    • PyAddNewEnvironmentPanel
      • New Pipenv environment panel for a new project
  • Settings
    • PyIntegratedToolsConfigurable
      • Path to the Pipenv executable (there is no need to put all the tools
        into this configurable)
  • Inspections
    • PyInterpreterInspection (SDK)
      • Check if the Pipenv interpter is valid
      • A quick-fix action to use or fix the interpreter
    • PyPackageRequirementsInspection (Packaging)
      • A quick-fix action to install the requirements from Pipfile.lock
  • Packaging
    • PyPackageManagersImpl
      • Get a Pipenv package manager for the SDK (list / install / remove)
      • Get a Pipenv package management service (browse package repositories) for the SDK
  • SDK
    • PythonSdkType
      • Load SDK additional data from jdk.table.xml (to know that it is a Pipenv, not just a regular virtualenv, not sure if it's really that necessary)
    • PySdkRendering
      • Get the presentable name for the Pipenv interpreter
      • Get the icon for the Pipenv interpreter
    • PyStatisticTools
      • Collect the stats about the SDK type

Extension points:

  • PyAddSdkProvider
    • A panel for adding an SDK
  • PythonFlavorProvider
    • Get SDK "flavor": customize things like detecting paths, Python version,
      if the path is valid, etc.

@vlasovskikh
How is progress implementing extension points?
Where do I check the status? tracker? PR? I can't find it 😕
I’m sorry I didn't mean to rush you.

I use the plugin for some projects. It works fine.
The plugin was downloaded over 2.2k.
And, I got good feedback 🎉

I want to proper next stage.

If you don't have time to implement an extension point then I may be able to write it or follow you.
Please feel free to contact me.

@koxudaxi Sorry, I had to switch to other tasks, but now I'm back :) Our team will have a meeting about interpreters and API changes this week, I'll post updates here in this issue at the end of the week. I hope I don't block your progress on the plugin too much. I'm glad the plugin has been getting good reviews so far :)

@vlasovskikh
I’m sorry for the late reply.
No problem. I'm happy your good answer 😄

@koxudaxi We've been working on the new API for interpreters and packaging and we've discovered more things we want to change in this API (e.g. add the ability to create Python environments on remote hosts). It seems reasonable to split the work on the interpreter and packaging extension points into two stages:

  • For 2020.2.x releases: Introduce a simple (and non-stable) API that just moves all the mentions of "Pipenv" into this extension point. It will allow poetry-pycharm-plugin to continue with what's already there for Pipenv and use it for Poetry
  • For 2020.3 EAP builds: Switch to the new API that introduces more configurability and allows to implement all other interpreter and packaging types on top of it

We're too close to the 2020.2 release to introduce any changes to this version, so for this simple API I'll target 2020.2.2. Sorry @koxudaxi we keep you waiting for these extension points.

@vlasovskikh another month has passed. Can you please provide interested customers with concrete scheduling info on the plans you mentioned, associated trackers/PR's and so forth? The continued lack of tangible development progress towards Poetry support is quite disappointing.

@jwiede We will release the extension points I've mentioned above in PyCharm 2020.2.2 in about a month. The updates will appear in 2020.2.2 RC which we will release in about 3 weeks. I'll post the links to the corresponding commits we've made to update the packaging and interpreters API.

@koxudaxi We've implemented PY-44304 about extracting Pipenv support into reusable extension points for PyCharm 2020.2.x (step 1 from my list above). It will appear soon in 2020.2.2 RC.

Check out these interfaces:

and their implementations for Pipenv.

@vlasovskikh
Thank you for creating extension points.
I will check it and try to change the plugin for the extension points.

@vlasovskikh Is there any new info for the new API for 2020.3 you mentioned? I'm particularly interested in the remote hosts env creation with poetry.
This issue unfortunately doesn't have any new info https://youtrack.jetbrains.com/issue/PY-29642
Should we expect remote host env creation in 2020.3?

@Vozf The API will be based on the concept of execution targets, see TargetEnvironment and other interfaces in com.intellij.execution.target. The API is still in progress: it's not complete and not documented yet. We've marked it with @ApiStatus.Experimental. We might release creating environments on remote hosts in 2020.3, but I cannot make any promises at this moment.

@vlasovskikh @jwiede
I have released a new version as 0.5.0
the version supports the new APIs on PyCharm 2020.2.2 that are below.

  • PySdkProvider
  • PyPackageManagerProvider

@koxudaxi Cool! Thanks for switching to the new API! If you have any feedback about the API we've got so far (anything that is still missing, or not convenient), please don't hesitate to discuss it here. As I've mentioned in my comment above, the next step for the PyCharm team regarding this API will be make environment management available for remote hosts. I'll be sharing the status updates about this feature.

The API for remote hosts is not ready for 2020.3. Other than that, @koxudaxi do you have ideas about any other extension points at the moment? If most features are covered I would suggest creating issues about individual features and closing this one.

@vlasovskikh
I agree. I use this plugin for private projects.
I think this version covers basic features.
I close this issue.
Thank you very much.