Skip to content
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

Pipfile support and slow settings cache #720

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Pipfile support and slow settings cache #720

wants to merge 8 commits into from

Conversation

hyperknot
Copy link

First try at Pipfile support and caching of python_interpreter, extra_paths settings in a dict.

@hyperknot
Copy link
Author

hyperknot commented Oct 27, 2017

Updated with smarter caching, also implements the functionality of what ENVIRON_HOOK_INVALID did before.

@DamnWidget
Copy link
Owner

If the interpreter configuration gets cached, how is the plugin gonna stop the running JsonServer and start a\ new one for the configured interpreter if the user changes it? This will force users to reopen their ST3 in order to update interpreter or path related options.

Maybe we should use the add_on_change method from the Settings class https://www.sublimetext.com/docs/3/api_reference.html#sublime.Settings

Apart from that, I am pretty sure that we could be able to hook into pipenv as a library and don't use subprocess in order to check the path. Let me think about this for a while.

@hyperknot
Copy link
Author

But why would anyone change their interpreter settings while having an open session? Actually why would anyone change interpreter settings at all? There is just one interpreter per project, it actually never changes.

We can absolutely use pipenv without subprocess but that'd mean including quite a lot of dependencies (about 20 MB right now):

pipenv==8.2.7
  - flake8 [required: Any, installed: 3.5.0]
    - mccabe [required: >=0.6.0,<0.7.0, installed: 0.6.1]
    - pycodestyle [required: <2.4.0,>=2.0.0, installed: 2.3.1]
    - pyflakes [required: <1.7.0,>=1.5.0, installed: 1.6.0]
  - pew [required: >=0.1.26, installed: 1.1.0]
    - setuptools [required: >=17.1, installed: 36.6.0]
    - virtualenv [required: >=1.11, installed: 15.1.0]
    - virtualenv-clone [required: >=0.2.5, installed: 0.2.6]
  - pip [required: >=9.0.1, installed: 9.0.1]
  - requests [required: >2.18.0, installed: 2.18.4]
    - certifi [required: >=2017.4.17, installed: 2017.7.27.1]
    - chardet [required: >=3.0.2,<3.1.0, installed: 3.0.4]
    - idna [required: <2.7,>=2.5, installed: 2.6]
    - urllib3 [required: >=1.21.1,<1.23, installed: 1.22]
  - urllib3 [required: >=1.21.1, installed: 1.22]
  - virtualenv [required: Any, installed: 15.1.0]

@DamnWidget
Copy link
Owner

DamnWidget commented Oct 27, 2017

You can open another project during the same session, I do it all the time

@hyperknot
Copy link
Author

But my solutions is caching it per view, so each project would naturally have it's own value.

@hyperknot
Copy link
Author

hyperknot commented Oct 27, 2017

Also, there should really be only one subprocess per pipfile, this just needs to be fixed:
https://github.com/kennethreitz/pipenv/issues/985

@hyperknot
Copy link
Author

hyperknot commented Oct 27, 2017

I think the reference implementation for finding out virtualenv's location should be part of Pipfile specs.
pypa/pipfile#88

@asfaltboy
Copy link

asfaltboy commented Nov 11, 2017

I love the idea of this PR in general, but I would take a different approach to implementation, separating the pipenv functionality from the core functions of Anaconda.

Perhaps we can start with just adding a few useful commands:

  • pipenv: configure env path: find the pipenv virtualenv path and add it to project settings (prompting to overwrite if the key exists)?
  • pipenv: install a package: prompt to install new packages (single or list of comma/space separated packages) into the env.
  • pipenv: install: install all the packages in the Pipfile.

I'm going to experiment and if it looks good I'll submit a good PR. @

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants