Skip to content

Commit 1d57397

Browse files
committed
Remove references to git submodules in documentation and code
These are no longer relevant after we removed the typeshed submodule in #9973.
1 parent 90feccd commit 1d57397

File tree

6 files changed

+14
-144
lines changed

6 files changed

+14
-144
lines changed

README.md

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,7 @@ Quick start for contributing to mypy
184184

185185
If you want to contribute, first clone the mypy git repository:
186186

187-
$ git clone --recurse-submodules https://github.com/python/mypy.git
188-
189-
If you've already cloned the repo without `--recurse-submodules`,
190-
you need to pull in the typeshed repo as follows:
191-
192-
$ git submodule init
193-
$ git submodule update
194-
195-
Either way you should now have a subdirectory `typeshed` inside your mypy repo,
196-
your folders tree should be like `mypy/mypy/typeshed`, containing a
197-
clone of the typeshed repo (`https://github.com/python/typeshed`).
187+
$ git clone https://github.com/python/mypy.git
198188

199189
From the mypy directory, use pip to install mypy:
200190

@@ -209,22 +199,8 @@ the above as root. For example, in Ubuntu:
209199
Now you can use the `mypy` program just as above. In case of trouble
210200
see "Troubleshooting" above.
211201

212-
> NOTE: Installing with sudo can be a security risk, please try with flag `--user` first.
213-
$ python3 -m pip install --user -U .
214-
215-
Working with the git version of mypy
216-
------------------------------------
217-
218-
mypy contains a submodule, "typeshed". See https://github.com/python/typeshed.
219-
This submodule contains types for the Python standard library.
220-
221-
Due to the way git submodules work, you'll have to do
222-
```
223-
git submodule update mypy/typeshed
224-
```
225-
whenever you change branches, merge, rebase, or pull.
226-
227-
(It's possible to automate this: Search Google for "git hook update submodule")
202+
> NOTE: Installing with sudo can be a security risk. Please try with the `--user` flag first.
203+
$ python3 -m pip install --user -U .
228204

229205

230206
Tests
@@ -244,7 +220,8 @@ Development status
244220
------------------
245221

246222
Mypy is beta software, but it has already been used in production
247-
for several years at Dropbox, and it has an extensive test suite.
223+
for several years at Dropbox and in many other organizations, and
224+
it has an extensive test suite.
248225

249226
See [the roadmap](ROADMAP.md) if you are interested in plans for the
250227
future.

docs/source/common_issues.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ You can install the latest development version of mypy from source. Clone the
616616

617617
.. code-block:: text
618618
619-
git clone --recurse-submodules https://github.com/python/mypy.git
619+
git clone https://github.com/python/mypy.git
620620
cd mypy
621621
sudo python3 -m pip install --upgrade .
622622

mypy/git.py

Lines changed: 1 addition & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
"""Utilities for verifying git integrity."""
1+
"""Git utilities."""
22

33
# Used also from setup.py, so don't pull in anything additional here (like mypy or typing):
44
import os
5-
import pipes
65
import subprocess
7-
import sys
8-
9-
MYPY = False
10-
if MYPY:
11-
from typing import Iterator
126

137

148
def is_git_repo(dir: str) -> bool:
@@ -27,36 +21,11 @@ def have_git() -> bool:
2721
return False
2822

2923

30-
def get_submodules(dir: str) -> "Iterator[str]":
31-
"""Return a list of all git top-level submodules in a given directory."""
32-
# It would be nicer to do
33-
# "git submodule foreach 'echo MODULE $name $path $sha1 $toplevel'"
34-
# but that wouldn't work on Windows.
35-
output = subprocess.check_output(["git", "submodule", "status"], cwd=dir)
36-
# "<status><sha1> name desc"
37-
# status='-': not initialized
38-
# status='+': changed
39-
# status='u': merge conflicts
40-
# status=' ': up-to-date
41-
for line in output.splitlines():
42-
# Skip the status indicator, as it could be a space can confuse the split.
43-
line = line[1:]
44-
name = line.split(b" ")[1]
45-
yield name.decode(sys.getfilesystemencoding())
46-
47-
4824
def git_revision(dir: str) -> bytes:
4925
"""Get the SHA-1 of the HEAD of a git repository."""
5026
return subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=dir).strip()
5127

5228

53-
def submodule_revision(dir: str, submodule: str) -> bytes:
54-
"""Get the SHA-1 a submodule is supposed to have."""
55-
output = subprocess.check_output(["git", "ls-files", "-s", submodule], cwd=dir).strip()
56-
# E.g.: "160000 e4a7edb949e0b920b16f61aeeb19fc3d328f3012 0 typeshed"
57-
return output.split()[1]
58-
59-
6029
def is_dirty(dir: str) -> bool:
6130
"""Check whether a git repository has uncommitted changes."""
6231
output = subprocess.check_output(["git", "status", "-uno", "--porcelain"], cwd=dir)
@@ -67,74 +36,3 @@ def has_extra_files(dir: str) -> bool:
6736
"""Check whether a git repository has untracked files."""
6837
output = subprocess.check_output(["git", "clean", "--dry-run", "-d"], cwd=dir)
6938
return output.strip() != b""
70-
71-
72-
def warn_no_git_executable() -> None:
73-
print("Warning: Couldn't check git integrity. "
74-
"git executable not in path.", file=sys.stderr)
75-
76-
77-
def warn_dirty(dir: str) -> None:
78-
print("Warning: git module '{}' has uncommitted changes.".format(dir),
79-
file=sys.stderr)
80-
print("Go to the directory", file=sys.stderr)
81-
print(" {}".format(dir), file=sys.stderr)
82-
print("and commit or reset your changes", file=sys.stderr)
83-
84-
85-
def warn_extra_files(dir: str) -> None:
86-
print("Warning: git module '{}' has untracked files.".format(dir),
87-
file=sys.stderr)
88-
print("Go to the directory", file=sys.stderr)
89-
print(" {}".format(dir), file=sys.stderr)
90-
print("and add & commit your new files.", file=sys.stderr)
91-
92-
93-
def chdir_prefix(dir: str) -> str:
94-
"""Return the command to change to the target directory, plus '&&'."""
95-
if os.path.relpath(dir) != ".":
96-
return "cd " + pipes.quote(dir) + " && "
97-
else:
98-
return ""
99-
100-
101-
def error_submodule_not_initialized(name: str, dir: str) -> None:
102-
print("Submodule '{}' not initialized.".format(name), file=sys.stderr)
103-
print("Please run:", file=sys.stderr)
104-
print(" {}git submodule update --init {}".format(
105-
chdir_prefix(dir), name), file=sys.stderr)
106-
107-
108-
def error_submodule_not_updated(name: str, dir: str) -> None:
109-
print("Submodule '{}' not updated.".format(name), file=sys.stderr)
110-
print("Please run:", file=sys.stderr)
111-
print(" {}git submodule update {}".format(
112-
chdir_prefix(dir), name), file=sys.stderr)
113-
print("(If you got this message because you updated {} yourself".format(name), file=sys.stderr)
114-
print(" then run \"git add {}\" to silence this check)".format(name), file=sys.stderr)
115-
116-
117-
def verify_git_integrity_or_abort(datadir: str) -> None:
118-
"""Verify the (submodule) integrity of a git repository.
119-
120-
Potentially output warnings/errors (to stderr), and exit with status 1
121-
if we detected a severe problem.
122-
"""
123-
datadir = datadir or '.'
124-
if not is_git_repo(datadir):
125-
return
126-
if not have_git():
127-
warn_no_git_executable()
128-
return
129-
for submodule in get_submodules(datadir):
130-
submodule_path = os.path.join(datadir, submodule)
131-
if not is_git_repo(submodule_path):
132-
error_submodule_not_initialized(submodule, datadir)
133-
sys.exit(1)
134-
elif submodule_revision(datadir, submodule) != git_revision(submodule_path):
135-
error_submodule_not_updated(submodule, datadir)
136-
sys.exit(1)
137-
elif is_dirty(submodule_path):
138-
warn_dirty(submodule)
139-
elif has_extra_files(submodule_path):
140-
warn_extra_files(submodule)

mypy/modulefinder.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,10 +524,9 @@ def default_lib_path(data_dir: str,
524524
if sys.platform != 'win32':
525525
path.append('/usr/local/lib/mypy')
526526
if not path:
527-
print("Could not resolve typeshed subdirectories. If you are using mypy\n"
528-
"from source, you need to run \"git submodule update --init\".\n"
529-
"Otherwise your mypy install is broken.\nPython executable is located at "
530-
"{0}.\nMypy located at {1}".format(sys.executable, data_dir), file=sys.stderr)
527+
print("Could not resolve typeshed subdirectories. Your mypy install is broken.\n"
528+
"Python executable is located at {0}.\nMypy located at {1}".format(
529+
sys.executable, data_dir), file=sys.stderr)
531530
sys.exit(1)
532531
return path
533532

mypyc/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ Windows Requirements
5757
Quick Start for Contributors
5858
----------------------------
5959

60-
First clone the mypy git repository *and git submodules*:
60+
First clone the mypy git repository:
6161

62-
$ git clone --recurse-submodules https://github.com/python/mypy.git
62+
$ git clone https://github.com/python/mypy.git
6363
$ cd mypy
6464

6565
Optionally create a virtualenv (recommended):
@@ -78,10 +78,9 @@ Now you can run the tests:
7878
Look at the [issue tracker](https://github.com/mypyc/mypyc/issues)
7979
for things to work on. Please express your interest in working on an
8080
issue by adding a comment before doing any significant work, since
81-
development is currently very active and there is real risk of duplicate
82-
work.
81+
there is a risk of duplicate work.
8382

84-
Note that the issue tracker is still hosted on the mypyc project, not
83+
Note that the issue tracker is hosted on the mypyc GitHub project, not
8584
with mypy itself.
8685

8786
Documentation

setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
from setuptools import setup, find_packages
1919
from setuptools.command.build_py import build_py
2020
from mypy.version import __version__ as version
21-
from mypy import git
22-
23-
git.verify_git_integrity_or_abort(".")
2421

2522
description = 'Optional static typing for Python'
2623
long_description = '''

0 commit comments

Comments
 (0)