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

Make psutil an optional dependency #4634

Merged
merged 8 commits into from Feb 26, 2018

Conversation

Projects
None yet
4 participants
@miedzinski
Contributor

miedzinski commented Feb 25, 2018

  • in case of psutil not installed, daemon reports it and suggests installing it
  • on Windows it isn't declared as dependency nor reported as missing

Fixes #4593.

@miedzinski

This comment has been minimized.

Contributor

miedzinski commented Feb 25, 2018

Perhaps a better extra name could be used? I've picked dmypy, because psutil is used there.

@ethanhs

Looks like a good start, but this should be documented (maybe in the installation section?). Also, I think there should be an error message here

if it tries to import psutil and fails. Maybe psutil not found, run pip install mypy[dmypy] to install the needed components for dmypy?

setup.py Outdated
],
extras_require = {
':python_version < "3.5"': 'typing >= 3.5.3',
'dmypy': 'psutil >= 5.4.0, < 5.5.0',

This comment has been minimized.

@ethanhs

ethanhs Feb 25, 2018

Collaborator

You should add :sys_platform!="win32" after dmypy, since it is not used on Windows.

@miedzinski

This comment has been minimized.

Contributor

miedzinski commented Feb 25, 2018

I agree that docs should be updated, but I don't know what dmypy actually is. All I could do is to mention an extra dependency, but without any explanation about its purpose. And dmypy isn't documented at all anyway.

@miedzinski

This comment has been minimized.

Contributor

miedzinski commented Feb 25, 2018

Oh and I'm pretty sure that using print there is wrong, because I don't see any output when running dmypy. Is there any logger I can't find?

@gvanrossum

This comment has been minimized.

Member

gvanrossum commented Feb 25, 2018

Can you point me to the docs that explain this notation works? Both the 'dmypy': prefix in the extras_require list and the pip install mypy[dmypy] form are new to me.

I think the best way to surface the error is to stick it in the res dictionary, e.g. with the key 'memory_psutil_missing'.

@gvanrossum

This comment has been minimized.

Member

gvanrossum commented Feb 25, 2018

Assuming the tests pass I'm fine with it.

@ethanhs

This comment has been minimized.

Collaborator

ethanhs commented Feb 25, 2018

I restarted the 3.6 build on Travis as the stubgen tests seem to be flaking.

@miedzinski

This comment has been minimized.

Contributor

miedzinski commented Feb 26, 2018

I've updated PR description in such way that it describes all changes to the codebase.

@@ -13,6 +13,12 @@ you can install mypy with:
$ python3 -m pip install mypy
Optionally you can install extra dependencies for daemon server with:

This comment has been minimized.

@JukkaL

JukkaL Feb 26, 2018

Collaborator

Please remove this since dmypy is otherwise undocumented (and unsupported). This will only confuse users.

@JukkaL

JukkaL approved these changes Feb 26, 2018

@gvanrossum gvanrossum merged commit 55dadfc into python:master Feb 26, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@gvanrossum

This comment has been minimized.

Member

gvanrossum commented Feb 26, 2018

Thanks!

carljm added a commit to carljm/mypy that referenced this pull request Feb 28, 2018

Merge branch 'master' into import-cycle
* master: (27 commits)
  Don't call --strict-optional and --incremental experimental (python#4642)
  Sync typeshed (python#4641)
  Fix callable types with inconsistent argument counts (python#4611)
  Fix example (add 'class A:')
  Make psutil an optional dependency (python#4634)
  mypy and mypy_extensions aren't posix only (python#3765)
  Documentation for attr support (python#4632)
  Use read_with_python_encoding in stubgen to handle file encoding (python#3790)
  Sync typeshed (python#4631)
  Add remaining core team emails to CREDITS (python#4629)
  Fix issues with attr code. (python#4628)
  Better support for converter in attrs plugin. (python#4607)
  Clean up credits (python#4626)
  Support type aliases in fine-grained incremental mode (python#4525)
  Fine-grained: Fix crash caused by unreachable class (python#4613)
  Treat divmod like a binary operator (python#4585)
  Sync typeshed (python#4605)
  Fine-grained: Don't infer partial types from multiple targets (python#4553)
  Fine-grained: Compare symbol table snapshots when following dependencies (python#4598)
  Fix type of forward reference to a decorated class method (python#4486)
  ...

yedpodtrzitko added a commit to kiwicom/mypy that referenced this pull request Mar 15, 2018

Make psutil an optional dependency (python#4634)
If it's not installed, when running `dmypy status -v` a message will be displayed instead of the memory stats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment