Skip to content

Update getting_started.rst to add uv #18983

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,46 @@ If you're unfamiliar with the concepts of static and dynamic type checking,
be sure to read this chapter carefully, as the rest of the documentation
may not make much sense otherwise.

Installing and running mypy
***************************
Installing mypy
***************

Mypy requires Python 3.9 or later to run. You can install mypy using pip:
Mypy requires Python 3.9 or later to run, and can be installed through either pip or uv.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid this is a bit unfair. There is poetry, there is pdm, there is pipx - are we going to enumerate all package managers here? pip is the "default" one, so mentioning pip is reasonable. Everything else is user's homework IMO: "how to run a tool using your package manager?" I'm not a maintainer here, so please don't treat the comment above as a binding disapproval, let's wait for someone from the core team to comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence also implicitly says "we do support pip and uv, but may not support other package managers", which is a false impression - mypy does not care which installation method was used, apt-get install mypy works on Ubuntu as well (even though it installs an ancient version). Perhaps

Suggested change
Mypy requires Python 3.9 or later to run, and can be installed through either pip or uv.
Mypy requires Python 3.9 or later to run, and can be installed via pip, uv or another package manager.

Here's how ruff explains its installation (note that they have to mention uv as that's another tool from Astral.sh, good for marketing, "recommended" is there for the same reason): https://docs.astral.sh/ruff/installation/


With pip
~~~~~~~~

You can install mypy with pip:

.. code-block:: shell

$ python3 -m pip install mypy

Once mypy is installed, run it by using the ``mypy`` tool:
With uv
~~~~~~~

You can also install mypy with uv:

.. code-block:: shell

$ uv add mypy

Running mypy
************

Once mypy is installed, run it by using the ``mypy`` tool. The command that you use to run mypy depends on whether you installed it with pip or uv.

For pip, use:

.. code-block:: shell

$ mypy program.py

For uv, use:

.. code-block:: shell

$ uv run mypy program.py

This command makes mypy *type check* your ``program.py`` file and print
out any errors it finds. Mypy will type check your code *statically*: this
means that it will check for errors without ever running your code, just
Expand Down