├── .github └── workflows │ └── dummy.yml ├── .gitignore ├── LICENSE ├── README.md ├── about.html ├── build.py ├── contact.html ├── demo ├── bank-s.py ├── bank.py ├── complex-s.py ├── complex.py ├── nlargest.py ├── primes-s.py ├── primes.py ├── sieve2-s.py ├── sieve2.py ├── wordfreq-orig.py ├── wordfreq-s.py └── wordfreq.py ├── examples.html ├── faq.html ├── favicon.ico ├── index.html ├── index.md ├── learn.html ├── news.html ├── news.yaml ├── out └── .gitignore ├── overview.html ├── requirements.txt ├── roadmap.html ├── scripts └── copy-to-server.sh ├── site.scss ├── static ├── mypy_badge.svg └── mypy_light.svg ├── template.html └── tutorial.html /.github/workflows/dummy.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the workflow will run 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the master branch 8 | push: 9 | branches: [ master ] 10 | pull_request: 11 | branches: [ master ] 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | workflow_dispatch: 15 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 | jobs: 18 | # This workflow contains a single job called "build" 19 | build: 20 | # The type of runner that the job will run on 21 | runs-on: ubuntu-latest 22 | 23 | # Steps represent a sequence of tasks that will be executed as part of the job 24 | steps: 25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 26 | - uses: actions/checkout@v2 27 | 28 | # Runs a single command using the runners shell 29 | - name: Run a one-line script 30 | run: echo Hello, world! 31 | 32 | # Runs a set of commands using the runners shell 33 | - name: Run a multi-line script 34 | run: | 35 | echo Add other actions to build, 36 | echo test, and deploy your project. 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .sass-cache 2 | site.css 3 | site.css.map 4 | venv/ 5 | *~ 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | http://creativecommons.org/licenses/by-sa/3.0/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mypy-website 2 | 3 | ## Dependencies: 4 | 5 | ``` 6 | python3 -m pip install -r requirements.txt 7 | ``` 8 | 9 | ## To update news items 10 | 11 | Edit `news.yaml` and add an entry to the new news item at the top. 12 | 13 | ## To build locally: 14 | ``` 15 | python3 build.py 16 | ``` 17 | Output is in `out`. 18 | 19 | ## To build and update the website: 20 | ``` 21 | scripts/copy-to-server.sh 22 | ``` 23 | This runs build.py and then copies everything from `out` to `mypy-lang.org`. 24 | -------------------------------------------------------------------------------- /about.html: -------------------------------------------------------------------------------- 1 | $title mypy - About$ 2 | $keywords about mypy, mypy information$ 3 | $description Information about mypy: background, history and development team.$ 4 | 5 |
6 |
7 | $include(learn.html)$ 8 |
9 |
10 | 11 |
12 |

About mypy

13 | 14 | Jukka Lehtosalo began work on mypy in 2012. The project borrows heavily from 15 | Jukka's earlier work on 16 | Alore, a Python-inspired language 17 | with an optional static type system. 18 | 19 |

In addition to Python and Alore, the design of mypy has been 20 | influenced by Java, C#, Typed 21 | Racket, Boo, Dart and the work of Jeremy G. Siek and Walid Taha on gradual 22 | typing. 23 | 24 |

Mypy Team

25 | 26 |

Jukka Lehtosalo

27 | 28 |

Jukka is the lead developer of mypy. Born and raised in Finland, 29 | Jukka works as a software engineer at Dropbox. Jukka created mypy 30 | while he was at the 31 | University of Cambridge Computer 32 | Laboratory in the UK as a PhD student. Before Cambridge, Jukka worked as 33 | a software engineer and later as a development manager for 9 years. 34 | 35 |

Jukka lives with his wife, two children, a cat, and a dog in Cambridge, England. 36 | 37 |

Guido van Rossum

38 | 39 |

Guido is Python's BDFL. Born and raised 40 | in the Netherlands, Guido works as a software engineer at Dropbox in San Francisco. 41 | 42 |

Ivan Levkivskyi

43 | 44 |

Ivan is an engineer working on mypy since 2016. Born and raised in Ukraine, 45 | spent 10 years in Switzerland working as a physicist, Ivan now works as a software 46 | engineer at Dropbox Ireland. 47 | 48 |

Michael J. Sullivan

49 | 50 |

Michael is an engineer at Dropbox in San Francisco. Born and raised 51 | in Wisconsin, Michael joined the mypy team after completing a PhD at 52 | Carnegie Mellon University's 53 | Principles of Programming Group. 54 | 55 |

Past Dropbox core team members

56 | 57 |

The following people have contributed to mypy as Dropbox employees, 58 | interns or contractors.

59 | 60 | 68 | 69 |

Non-Dropbox core team members

70 | 71 |

The following non-Dropboxers are considered core mypy contributors.

72 | 73 | 77 | 78 | 79 |

Contributors

80 | 81 |

See the 82 | CREDITS file 83 | in the repository for a list of contributors.

84 | 85 |

Send us a pull request 86 | to join the team!

87 | 88 |
89 | 90 |

Acknowledgements

91 | 92 |

The development of mypy and the research behind mypy has been 93 | supported financially 94 | by the Finnish Cultural Foundation, 95 | the Academy of Finland, 96 | Emil Aaltonen Foundation, 97 | Engineering and Physical Sciences Research 98 | Council UK, University of Cambridge 99 | Computer Laboratory, ACM, 100 | and Dropbox. 101 | -------------------------------------------------------------------------------- /build.py: -------------------------------------------------------------------------------- 1 | """Build mypy website (html and css). 2 | 3 | Needs libsass (pip install libsass). 4 | 5 | NOTES: 6 | 7 | This is pretty crufty and was originally translated from an old script 8 | written in Alore. Much of this doesn't make sense any more. 9 | """ 10 | 11 | import shutil 12 | from re import sub, DOTALL, match, search 13 | import re 14 | import subprocess 15 | from textwrap import dedent 16 | 17 | from yaml import load, dump 18 | try: 19 | from yaml import CLoader as Loader, CDumper as Dumper 20 | except ImportError: 21 | from yaml import Loader, Dumper 22 | 23 | news_items = load(open('news.yaml'), Loader=Loader)['items'] 24 | 25 | pages = ['index', 'examples', 'tutorial', 'about', 'news', 'faq', 'contact', 26 | 'roadmap', 'news', 27 | 28 | 'overview' # legacy 29 | ] 30 | files = ['site.css', 'favicon.ico'] 31 | static_dirs = ['static'] 32 | 33 | out_dir = 'out' 34 | 35 | default_title = 'mypy' 36 | default_keywords = 'mypy, python static typing, python optional typing' 37 | default_description = 'Mypy is an experimental Python variant with seamless dynamic and static typing.' 38 | 39 | KW = ['class', 'for', 'in', 'return', 'if', 'else', 'void', 'pass', 40 | 'def', 'any', 'member', 'while', 'static', 'import', 'raise', 'not', 41 | 'yield', 'break', 'interface', 'from', 'with', 'as'] 42 | 43 | def build_page(p): 44 | t = open('template.html').read() 45 | content = open('%s.html' % p).read() 46 | content, meta = format_content(content) 47 | t = t.replace('$content$', content) 48 | t = t.replace('$title$', meta.get('title', default_title)) 49 | t = t.replace('$keywords$', meta.get('keywords', default_keywords)) 50 | t = t.replace('$description$', meta.get('description', 51 | default_description)) 52 | if '$contents' in t: 53 | t = t.replace('$contents$', build_contents(t)) 54 | if '$latestnews$' in t: 55 | t = t.replace('$latestnews$', build_latest_news()) 56 | if '$news$' in t: 57 | t = t.replace('$news$', build_news()) 58 | f = open('%s/%s.html' % (out_dir, p), 'w') 59 | f.write(t) 60 | f.close() 61 | 62 | 63 | def format_content(s): 64 | meta = {} 65 | 66 | s = sub(r'\$code!([^!]*)!', lambda m: render_code(m.group(1)), 67 | s, flags=DOTALL) 68 | s = sub(r'\$email\(([^)]*)\)\$', lambda m: obfuscate_email(m.group(1)), s) 69 | s = sub(r'\$include\(([^)]*)\)\$', lambda m: include(m.group(1)), s) 70 | s = sub(r'\$example\(([^)]*)\)\$', lambda m: example(m.group(1)), s) 71 | 72 | for tag in 'title', 'keywords', 'description': 73 | m = search(r'\$%s ([^$]*)\$' % tag, s) 74 | if m: 75 | meta[tag] = m.group(1) 76 | s = s.replace(m.group(), '') 77 | 78 | return s, meta 79 | 80 | def render_code(s): 81 | s = s.rstrip() 82 | s = dedent(s) 83 | s = s.replace('<', '<') 84 | s = s.replace('>', '>') 85 | 86 | for kw in KW: 87 | s = sub(r'\b%s\b' % kw, r'%s' % kw, s) 88 | 89 | for kw in ('list', 'str', 'print', 'int', 'float', 'tuple', 'bool', 90 | 'bytes', 'dict', 'object', 'Dict', 'List', 'Iterator', 'Any', 91 | 'Set', 'typevar', 'Generic', 'Iterable', 'Sequence'): 92 | s = sub(r'\b%s\b' % kw, r'%s' % kw, s) 93 | 94 | s = sub(r"('[^']*')", r'\1', s) 95 | s = sub(r'(""".*""")', r'\1', s, flags=DOTALL) 96 | 97 | s = sub(r'(#.*)', r'\1', s) 98 | s = sub(r'(""".*?""")', r'\1', s) 99 | 100 | s = sub(r'\|\|(.*?)\|\|', r'\1', s) 101 | 102 | return '

%s
' % s 103 | 104 | 105 | def include(fnam): 106 | return open(fnam, 'r').read() 107 | 108 | 109 | def example(fnam): 110 | f1 = render_code(open('demo/%s.py' % fnam, 'r').read()) 111 | f2 = render_code(open('demo/%s-s.py' % fnam, 'r').read()) 112 | return ''' 113 |
114 |
Mypy with dynamic typing
115 | %s 116 |
117 |
118 |
Mypy with static typing
119 | %s 120 |
121 |
122 | ''' % (f1, f2) 123 | 124 | 125 | def build_contents(t): 126 | """Collect all

titles using a regxp and build
  • items.""" 127 | res = [] 128 | for id, text in re.findall(r'(.*?)
  • ', t): 129 | if text != 'Contents': 130 | m = match(r' +id="(.*)"$', id) 131 | assert m, "Missing id in {}".format(text) 132 | res.append('
  • {}'.format(m.group(1), text)) 133 | return '' 134 | 135 | 136 | def main(): 137 | for p in pages: 138 | build_page(p) 139 | 140 | subprocess.check_call(['pysassc', 'site.scss', 'site.css']) 141 | 142 | for f in files: 143 | shutil.copy(f, out_dir + '/') 144 | for d in static_dirs: 145 | dn = out_dir + '/' + d 146 | shutil.rmtree(dn, ignore_errors=True) 147 | shutil.copytree(d, dn) 148 | 149 | 150 | # Inline JavaScript code should encoded as CDATA for proper XHTML. 151 | # Include the comments to work with old browsers. 152 | JS_BEGIN = '/* */' 154 | 155 | 156 | # Obfuscate an email address by creating a JavaScript fragment that constructs 157 | # the address + a fallback solution for browsers not supporting javascript. 158 | # 159 | # Expects the following CSS classes, with needed properties in parentheses: 160 | # * adr (no wrapping) 161 | # * hid (hide) 162 | # * char (vertical image alignemnt) 163 | def obfuscate_email(email): 164 | html = ObfuscateEmailHTML(email) 165 | js = ObfuscateEmailJS(email) 166 | return ("" + "") 168 | 169 | 170 | def ObfuscateEmailJS(email): 171 | for ch in "xz-_#": 172 | if not ch in email: 173 | repl = ch 174 | break 175 | if len(email) < 5: 176 | raise ValueError("Unsupported email address") 177 | 178 | obfuscated = (email[:2] + repl + email[2:5] + repl + email[5:8] + repl + 179 | email[8:]) 180 | 181 | res = ( 182 | "var addr = ('{}' + '{}').replace(/{}/g, '');".format( 183 | obfuscated[:4], obfuscated[4:], repl) + 184 | "document.write(''+addr+'<'+'/a>');") 185 | 186 | return res 187 | 188 | 189 | def ObfuscateEmailHTML(email): 190 | user, domain = email.split("@") 191 | return ('\n' + 192 | ('{}{}xxx' + 193 | '{}'). 194 | format(user[:2], user[2:], domain) + 195 | "\n") 196 | 197 | 198 | def build_news(): 199 | res = [] 200 | for item in news_items: 201 | res.append('

    %s

    \n' % item['title']) 202 | res.append('

    %s\n

    %s

    - %s' % (item['date'], item['text'], item['author'])) 203 | return '\n'.join(res) 204 | 205 | 206 | def build_latest_news(): 207 | res = [] 208 | for item in news_items[:4]: 209 | res.append('

    %s\n' % item['title']) 210 | res.append('

    %s: %s -%s' % (item['date'], item['text'], item['author'])) 211 | return '\n'.join(res) 212 | 213 | 214 | if __name__ == '__main__': 215 | main() 216 | -------------------------------------------------------------------------------- /contact.html: -------------------------------------------------------------------------------- 1 | $title mypy - Contact$ 2 | $keywords mypy contact, mypy feedback, mypy comments, mypy information$ 3 | $description Mypy contact information. Send feedback to developers to help improve mypy.$ 4 | 5 |

    6 |
    7 | $include(learn.html)$ 8 |
    9 |
    10 | 11 |

    Contact

    12 | 13 |

    We want to hear from you! 14 |

    Send your comments, questions, ideas, wishes, (constructive) criticism 15 | and encouragement to our GitHub tracker. 16 | We take all 17 | feedback seriously. Mypy is still in development and your feedback 18 | has a good chance of affecting how things will go. 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo/bank-s.py: -------------------------------------------------------------------------------- 1 | class BankAccount: 2 | def __init__||(self, initial_balance: int = 0) -> None||: 3 | self.balance = initial_balance 4 | def deposit||(self, amount: int) -> None||: 5 | self.balance += amount 6 | def withdraw||(self, amount: int) -> None||: 7 | self.balance -= amount 8 | def overdrawn||(self) -> bool||: 9 | return self.balance < 0 10 | 11 | my_account = BankAccount(15) 12 | my_account.withdraw(5) 13 | print(my_account.balance) 14 | -------------------------------------------------------------------------------- /demo/bank.py: -------------------------------------------------------------------------------- 1 | class BankAccount: 2 | def __init__||(self, initial_balance=0)||: 3 | self.balance = initial_balance 4 | def deposit||(self, amount)||: 5 | self.balance += amount 6 | def withdraw||(self, amount)||: 7 | self.balance -= amount 8 | def overdrawn||(self)||: 9 | return self.balance < 0 10 | 11 | my_account = BankAccount(15) 12 | my_account.withdraw(5) 13 | print(my_account.balance) 14 | -------------------------------------------------------------------------------- /demo/complex-s.py: -------------------------------------------------------------------------------- 1 | class complex: 2 | """A toy partial complex number implementation. Uses method and 3 | operator overloading and multiple dispatch.""" 4 | 5 | void __init__(self, float re, float im=0): 6 | self.re = re 7 | self.im = im 8 | 9 | void __init__(self, complex n): 10 | self.__init__(n.re, n.im) 11 | 12 | str __str__(self): 13 | if self.im >= 0: 14 | return "({} + {}j)".format(self.re, self.im) 15 | else: 16 | return "({} - {}j)".format(self.re, -self.im) 17 | 18 | # Use multiple dispath for __eq__. 19 | 20 | bool __eq__(self, object n): # Default __eq__ overload 21 | return False 22 | 23 | bool __eq__(self, complex n): 24 | return self.re == c.re and self.im == c.im 25 | 26 | bool __eq__(self, float n): 27 | return self.re == n and self.im == 0 28 | 29 | int __hash__(self): 30 | if self.im: 31 | return hash((self.re, self.im)) 32 | else: 33 | return hash(self.re) 34 | 35 | complex __add__(self, complex n): 36 | return complex(self.re + n.re, self.im + n.im) 37 | 38 | complex __add__(self, float n): 39 | return self + complex(n) 40 | 41 | complex __mul__(self, complex n): 42 | return complex(self.re * n.re - self.im * n.im, 43 | self.im * n.re + self.re * n.im) 44 | 45 | complex __mul__(self, float n): 46 | return self * complex(n) 47 | -------------------------------------------------------------------------------- /demo/complex.py: -------------------------------------------------------------------------------- 1 | class complex: 2 | """A toy partial complex number implementation. Uses method and 3 | operator overloading and multiple dispatch.""" 4 | 5 | def __init__(self, float re, im=0): 6 | self.re = re 7 | self.im = im 8 | 9 | def __init__(self, complex n): 10 | self.__init__(n.re, n.im) 11 | 12 | def __str__(self): 13 | if self.im >= 0: 14 | return "({} + {}j)".format(self.re, self.im) 15 | else: 16 | return "({} - {}j)".format(self.re, -self.im) 17 | 18 | # Use multiple dispath for __eq__. 19 | 20 | def __eq__(self, n): # Default __eq__ overload 21 | return False 22 | 23 | def __eq__(self, complex n): 24 | return self.re == c.re and self.im == c.im 25 | 26 | def __eq__(self, float n): 27 | return self.re == n and self.im == 0 28 | 29 | def __hash__(self): 30 | if self.im: 31 | return hash((self.re, self.im)) 32 | else: 33 | return hash(self.re) 34 | 35 | def __add__(self, complex n): 36 | return complex(self.re + n.re, self.im + n.im) 37 | 38 | def __add__(self, float n): 39 | return self + complex(n) 40 | 41 | def __mul__(self, complex n): 42 | return complex(self.re * n.re - self.im * n.im, 43 | self.im * n.re + self.re * n.im) 44 | 45 | def __mul__(self, float n): 46 | return self * complex(n) 47 | -------------------------------------------------------------------------------- /demo/nlargest.py: -------------------------------------------------------------------------------- 1 | -- Usage: nlargest.alo [DIR [N]] 2 | -- 3 | -- Find the N largest subdirectories of DIR (default to '.' and 10). 4 | 5 | import os 6 | 7 | 8 | def Main(args) 9 | var n = 10 10 | var dir = '.' 11 | if args != [] 12 | dir = args[0] 13 | if args.length() > 1 14 | n = Int(args[1]) 15 | end 16 | end 17 | LargestDirs(n, dir) 18 | end 19 | 20 | 21 | -- Display the n largest subdirectories of dir. 22 | def LargestDirs(n, dir) 23 | var a = [] 24 | DirSizes(dir, a) 25 | a = Reversed(Sort(a)) 26 | for size, d in a[:n] 27 | Print('{-8:} {}'.format(size div 1024, d)) 28 | end 29 | end 30 | 31 | 32 | -- Append to res a tuple (size, subdir) for each subdirectory of dir and return 33 | -- the total size of files in dir. 34 | def DirSizes(dir, res) 35 | var size = 0 36 | for n in ListDir(dir) 37 | var p = Join(dir, n) 38 | if IsFile(p) 39 | size += Stat(p).size 40 | elif IsDir(p) and not IsLink(p) 41 | var s = DirSizes(p, res) 42 | res.append((s, NormPath(p))) 43 | size += s 44 | end 45 | end 46 | return size 47 | end 48 | -------------------------------------------------------------------------------- /demo/primes-s.py: -------------------------------------------------------------------------------- 1 | # Generate all prime numbers up to 1000 using the 2 | # sieve of Eratosthenes. 3 | 4 | import math 5 | import sys 6 | 7 | max = 1000 8 | 9 | # Calculate a table a where a[i] == True 10 | # iff i is a prime. 11 | a = [True] * (max + 1) 12 | for i in range(2, int(math.sqrt(max)) + 1): 13 | if a[i]: 14 | j = i * i 15 | while j <= max: 16 | a[j] = False 17 | j += i 18 | 19 | for i in range(2, max + 1): 20 | if a[i]: 21 | print(i) 22 | -------------------------------------------------------------------------------- /demo/primes.py: -------------------------------------------------------------------------------- 1 | # Generate all prime numbers up to 1000 using the 2 | # sieve of Eratosthenes. 3 | 4 | import math 5 | import sys 6 | 7 | max = 1000 8 | 9 | # Calculate a table a where a[i] == True 10 | # iff i is a prime. 11 | a = [True] * (max + 1) 12 | for i in range(2, int(math.sqrt(max)) + 1): 13 | if a[i]: 14 | j = i * i 15 | while j <= max: 16 | a[j] = False 17 | j += i 18 | 19 | for i in range(2, max + 1): 20 | if a[i]: 21 | print(i) 22 | -------------------------------------------------------------------------------- /demo/sieve2-s.py: -------------------------------------------------------------------------------- 1 | import itertools 2 | ||from typing import Iterator|| 3 | 4 | def iter_primes||() -> Iterator[int]||: 5 | # An iterator of all numbers between 2 and 6 | # +infinity 7 | numbers = itertools.count(2) 8 | 9 | # Generate primes forever 10 | while True: 11 | # Get the first number from the iterator 12 | # (always a prime) 13 | prime = next(numbers) 14 | yield prime 15 | 16 | # This code iteratively builds up a chain 17 | # of filters... 18 | numbers = filter(prime.__rmod__, numbers) 19 | 20 | for p in iter_primes(): 21 | if p > 1000: 22 | break 23 | print(p) 24 | -------------------------------------------------------------------------------- /demo/sieve2.py: -------------------------------------------------------------------------------- 1 | import itertools 2 | 3 | 4 | def iter_primes||()||: 5 | # An iterator of all numbers between 2 and 6 | # +infinity 7 | numbers = itertools.count(2) 8 | 9 | # Generate primes forever 10 | while True: 11 | # Get the first number from the iterator 12 | # (always a prime) 13 | prime = next(numbers) 14 | yield prime 15 | 16 | # This code iteratively builds up a chain 17 | # of filters... 18 | numbers = filter(prime.__rmod__, numbers) 19 | 20 | for p in iter_primes(): 21 | if p > 1000: 22 | break 23 | print(p) 24 | -------------------------------------------------------------------------------- /demo/wordfreq-orig.py: -------------------------------------------------------------------------------- 1 | # Usage: wordfreq.alo N FILE ... 2 | # 3 | # Display the N most frequent words in file(s). Assume that the files are 4 | # text files encoded using the platform default encoding. 5 | 6 | import sys 7 | import re 8 | 9 | def main(): 10 | if not sys.argv[2:]: 11 | raise RuntimeError('Usage: wordfreq.alo N FILE ...') 12 | 13 | d = {} 14 | n = int(sys.argv[1]) 15 | 16 | for fnam in sys.argv[2:]: 17 | s = open(fnam, 'r').read() 18 | for word in re.sub('\W', ' ', s).split(): 19 | d[word] = d.get(word, 0) + 1 20 | 21 | l = [(freq, word) for word, freq in d.items()] # Use _list comprehension_ 22 | 23 | for freq, word in reversed(sorted(l)[-n:]): # Tuple unpacking 24 | print('%-6d %s' % (freq, word)) 25 | 26 | main() 27 | -------------------------------------------------------------------------------- /demo/wordfreq-s.py: -------------------------------------------------------------------------------- 1 | # Display the frequencies of words in a file. 2 | 3 | import sys 4 | import re 5 | ||from typing import Dict|| 6 | 7 | if not sys.argv[1:]: 8 | raise RuntimeError('Usage: wordfreq FILE') 9 | 10 | ||d = {} # type: Dict[str, int]|| 11 | 12 | with open(sys.argv[1]) as f: 13 | for s in f: 14 | for word in re.sub('\W', ' ', s).split(): 15 | d[word] = d.get(word, 0) + 1 16 | 17 | # Use list comprehension 18 | l = [(freq, word) for word, freq in d.items()] 19 | 20 | for freq, word in sorted(l): 21 | print('%-6d %s' % (freq, word)) 22 | -------------------------------------------------------------------------------- /demo/wordfreq.py: -------------------------------------------------------------------------------- 1 | # Display the frequencies of words in a file. 2 | 3 | import sys 4 | import re 5 | 6 | 7 | if not sys.argv[1:]: 8 | raise RuntimeError('Usage: wordfreq FILE') 9 | 10 | ||d = {}|| 11 | 12 | with open(sys.argv[1]) as f: 13 | for s in f: 14 | for word in re.sub('\W', ' ', s).split(): 15 | d[word] = d.get(word, 0) + 1 16 | 17 | # Use list comprehension 18 | l = [(freq, word) for word, freq in d.items()] 19 | 20 | for freq, word in sorted(l): 21 | print('%-6d %s' % (freq, word)) 22 | -------------------------------------------------------------------------------- /examples.html: -------------------------------------------------------------------------------- 1 | $title mypy - Examples$ 2 | $keywords mypy example, mypy code$ 3 | $description Mypy example programs, with separate dynamically and statically typed variants.$ 4 | 5 |

    6 |

    Mypy Examples

    7 | 8 |

    Here are some mypy example programs. Each example has dynamically typed 9 | Python/mypy code and equivalent statically typed mypy code side by 10 | side. Every program is still valid Python 3.x. 11 | All differences between the variants are 12 | highlighted. 13 | 14 |

    Word frequencies with a dictionary

    15 | 16 | $example(wordfreq)$ 17 | 18 |

    In this example we add an explicit type declaration for the variable d, as 19 | it is not obvious from the local context. 20 | 21 |

    Simple class

    22 | 23 | $example(bank)$ 24 | 25 |

    In this example we chose to use integers to represent balance. 26 | This would be fine in a game, for example, but in other applications a 27 | different type would make more sense. 28 | 29 |

    This example was adapted from the 30 | Python wiki (with 31 | the standard Python license). 32 | 33 |

    Prime number sieve with generators

    34 | 35 | $example(sieve2)$ 36 | 37 |

    Like the bank account example, this was adapted from the Python wiki. 38 | -------------------------------------------------------------------------------- /faq.html: -------------------------------------------------------------------------------- 1 | $title mypy - FAQ$ 2 | $keywords mypy frequently asked questions, mypy vs python, mypy vs pypy, dynamic vs static typing$ 3 | $description Frequently asked questions about mypy (and answers).$ 4 | 5 |

    6 |

    Mypy Frequently Asked Questions

    7 | 8 |

    This page has been moved to here. 9 | 10 |

    11 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JukkaL/mypy-website/e1fd6dcb0f51b18976a3e673b80ccde485e50a2a/favicon.ico -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | $title mypy - Optional Static Typing for Python$ 2 | $keywords mypy, mypy language, python static typing, python, python optional styping, optional typing, python type checker$ 3 | $description Mypy is an optional static type checker for Python.$ 4 | 5 |
    6 | 9 |
    10 | Mypy on Twitter is @mypyproject 11 |

    Follow @mypyproject on 12 | Twitter 13 |

    14 |
    15 |
    Why mypy?
    16 |
    17 |
    Compile-time type checking 18 |
    Static typing makes it easier to find bugs 19 | with less debugging. 20 |
    Easier maintenance 21 |
    Type declarations act as 22 | machine-checked documentation. 23 | Static typing makes your code easier to understand and easier to modify 24 | without introducing bugs. 25 |
    Grow your programs from dynamic to static 26 | typing 27 |
    You can develop programs with dynamic typing and add 28 | static typing after your code has matured, or migrate existing 29 | Python code to static typing. 30 |
    31 |
    32 |
    33 | 34 |

    mypy

    35 | 36 |
    37 | Mypy is an optional static type checker for Python that aims 38 | to combine the benefits of dynamic (or "duck") typing and static typing. 39 | Mypy combines the expressive power and 40 | convenience of Python with a powerful type system and compile-time type checking. 41 | Mypy type checks standard Python programs; run them using any Python VM 42 | with basically no runtime overhead. 43 |
    44 | 45 |

    What's new

    46 | 47 | $latestnews$ 48 | 49 |

    Older news 50 | 51 |

    Seamless dynamic and static typing

    52 | 53 |
    54 |
    From Python...
    55 | $code! 56 | ||def fib(n)||: 57 | a, b = 0, 1 58 | while a < n: 59 | yield a 60 | a, b = b, a+b 61 | ! 62 |
    63 |
    64 |
    ...to statically typed Python
    65 | $code! 66 | ||def fib(n: int) -> Iterator[int]||: 67 | a, b = 0, 1 68 | while a < n: 69 | yield a 70 | a, b = b, a+b 71 | ! 72 |
    73 |
    74 | 75 |

    Migrate existing code to static typing, a function at a time. 76 | You can freely mix static and dynamic typing within a program, within 77 | a module or within an expression. No need to 78 | give up dynamic typing — use static typing 79 | when it makes sense. 80 | Often just adding function signatures gives you statically typed code. 81 | Mypy can infer the types of other 82 | variables. 83 | 84 |

    Python syntax

    85 | 86 |

    Mypy type checks programs that have type annotations conforming to 87 | PEP 484. 88 | Getting started is easy if you know Python. 89 | The aim is to support almost all Python language constructs in mypy. 90 | 91 |

    Powerful type system

    92 | 93 |

    Mypy has a powerful, modern type system with features such as bidirectional type inference, 94 | generics, callable types, abstract base classes, multiple inheritance and tuple types. 95 | 96 |

    Access to Python libs

    97 | 98 |

    Many commonly used libraries have stubs (statically typed interface 99 | definitions) that allow mypy to check that your code uses the 100 | libraries correctly. 101 | 102 |

    103 | $include(learn.html)$ 104 |
    105 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JukkaL/mypy-website/e1fd6dcb0f51b18976a3e673b80ccde485e50a2a/index.md -------------------------------------------------------------------------------- /learn.html: -------------------------------------------------------------------------------- 1 |
    Learn more
    2 | 3 | 10 | -------------------------------------------------------------------------------- /news.html: -------------------------------------------------------------------------------- 1 | $title mypy - News$ 2 | $keywords mypy, news$ 3 | $description Latest news about mypy.$ 4 | 5 |
    6 |

    Mypy News

    7 | 8 | $news$ 9 | 10 |
    11 | -------------------------------------------------------------------------------- /news.yaml: -------------------------------------------------------------------------------- 1 | items: 2 | - title: Mypy 1.15 released 3 | date: 5 Feb 2025 4 | text: | 5 | Mypy 1.15 was released. Read the 6 | blog post 7 | for the details. 8 | author: Wesley Collin Wright 9 | - title: Mypy 1.14 released 10 | date: 20 Dec 2024 11 | text: | 12 | Mypy 1.14 was released. Read the 13 | blog post 14 | for the details. 15 | author: Valentin Stanciu 16 | - title: Mypy 1.13 released 17 | date: 22 Oct 2024 18 | text: | 19 | Mypy 1.13 was released. Read the 20 | blog post 21 | for the details. 22 | author: Shantanu and Jukka Lehtosalo 23 | - title: Mypy 1.12 released 24 | date: 14 Oct 2024 25 | text: | 26 | Mypy 1.12 was released. Read the 27 | blog post 28 | for the details. 29 | author: Jukka Lehtosalo 30 | - title: Mypy 1.11 released 31 | date: 19 Jul 2024 32 | text: | 33 | Mypy 1.11 was released. Read the 34 | blog post 35 | for the details. 36 | author: Max Murin 37 | - title: Mypy 1.10 released 38 | date: 24 Apr 2024 39 | text: | 40 | Mypy 1.10 was released. Read the 41 | blog post 42 | for the details. 43 | author: Valentin Stanciu 44 | - title: Mypy 1.9 released 45 | date: 08 Mar 2024 46 | text: | 47 | Mypy 1.9 was released. Read the 48 | blog post 49 | for the details. 50 | author: Jared Hance 51 | - title: Mypy 1.8 released 52 | date: 21 Dec 2023 53 | text: | 54 | Mypy 1.8 was released. Read the 55 | blog post 56 | for the details. 57 | author: Wesley Collin Wright 58 | - title: Mypy 1.7 released 59 | date: 10 Nov 2023 60 | text: | 61 | Mypy 1.7 was released. Read the 62 | blog post 63 | for the details. 64 | author: Jukka Lehtosalo 65 | - title: Mypy 1.6 released 66 | date: 10 Oct 2023 67 | text: | 68 | Mypy 1.6 was released. Read the 69 | blog post 70 | for the details. 71 | author: Jukka Lehtosalo 72 | - title: Mypy 1.5 released 73 | date: 10 Aug 2023 74 | text: | 75 | Mypy 1.5 was released. Read the 76 | blog post 77 | for the details. 78 | author: Valentin Stanciu 79 | - title: Mypy 1.4 released 80 | date: 20 Jun 2023 81 | text: | 82 | Mypy 1.4 was released. Read the 83 | blog post 84 | for the details. 85 | author: Jared Hance 86 | - title: Mypy 1.3 released 87 | date: 10 May 2023 88 | text: | 89 | Mypy 1.3 was released. Read the 90 | blog post 91 | for the details. 92 | author: Wesley Collin Wright 93 | - title: Mypy 1.2 released 94 | date: 6 Apr 2023 95 | text: | 96 | Mypy 1.2 was released. Read the 97 | blog post 98 | for the details. 99 | author: Jukka Lehtosalo 100 | - title: Mypy 1.1.1 released 101 | date: 6 Mar 2023 102 | text: | 103 | Mypy 1.1.1 was released. Read the 104 | blog post 105 | for the details. 106 | author: Max Murin 107 | - title: Mypy 1.0 released 108 | date: 6 Feb 2023 109 | text: | 110 | Mypy 1.0 was released. Read the 111 | blog post 112 | for the details. 113 | author: Stas Ilinskiy 114 | - title: Mypy 0.991 released 115 | date: 8 Nov 2022 116 | text: | 117 | Mypy 0.991 was released. Read the 118 | blog post 119 | for the details. 120 | author: Valentin Stanciu 121 | - title: Mypy 0.981 released 122 | date: 27 Sep 2022 123 | text: | 124 | Mypy 0.981 was released. Read the 125 | blog post 126 | for the details. 127 | author: Jukka Lehtosalo and Jared Hance 128 | - title: Mypy 0.971 released 129 | date: 19 Jul 2022 130 | text: | 131 | Mypy 0.971 was released. Read the 132 | blog post 133 | for the details. 134 | author: Jukka Lehtosalo and Ivan Levkivskyi 135 | - title: Mypy 0.960 released 136 | date: 25 May 2022 137 | text: | 138 | Mypy 0.960 was released. Read the 139 | blog post 140 | for the details. 141 | author: Jukka Lehtosalo 142 | - title: Mypy 0.950 released 143 | date: 27 Apr 2022 144 | text: | 145 | Mypy 0.950 was released. Read the 146 | blog post 147 | for the details. 148 | author: Jukka Lehtosalo 149 | - title: Mypy 0.940 released 150 | date: 11 Mar 2022 151 | text: | 152 | Mypy 0.940 was released. Read the 153 | blog post 154 | for the details. 155 | author: Jukka Lehtosalo 156 | - title: Mypy 0.930 released 157 | date: 22 Dec 2021 158 | text: | 159 | Mypy 0.930 was released. Read the 160 | blog post 161 | for the details. 162 | author: Jukka Lehtosalo 163 | - title: Mypy 0.920 released 164 | date: 15 Dec 2021 165 | text: | 166 | Mypy 0.920 was released. Read the 167 | blog post 168 | for the details. 169 | author: Ivan Levkivskyi 170 | - title: Mypy 0.910 released 171 | date: 22 Jun 2021 172 | text: | 173 | Mypy 0.910 was released. This release includes the --non-interactive command-line 174 | option to install stubs without user interaction, plus other fixes and improvements. 175 | Python 3.5 is now deprecated. Read the 176 | blog post 177 | for the details. 178 | author: Jukka Lehtosalo 179 | - title: Mypy 0.901 released 180 | date: 8 Jun 2021 181 | text: | 182 | Mypy 0.901 was released. This release moves third-party 183 | library stubs to stub packages, allowing newer stubs to be 184 | easily used without updating mypy. Mypy now supports 185 | pyproject.toml and type guards, and ships wheels for Apple 186 | Silicon. Plus, there are many other features and bug 187 | fixes. Read the 188 | blog post 189 | for the details. 190 | author: Jukka Lehtosalo 191 | - title: The upcoming switch to modular typeshed in mypy 0.900 192 | date: 26 May 2021 193 | text: | 194 | The next mypy release will no longer bundle stubs for third-party libraries. 195 | Read this blog post if you are interested in what this means to mypy users and why 196 | we are doing this. 197 | author: Jukka Lehtosalo 198 | - title: Mypy 0.812 released 199 | date: 19 February 2021 200 | text: | 201 | Mypy 0.812 was released. This release fixes a regression in module finding behavior 202 | and adds the --exclude flag for excluding certain paths when searching for 203 | modules. Read the 204 | blog post 205 | for the details. 206 | author: Jukka Lehtosalo 207 | - title: Mypy 0.800 released 208 | date: 22 January 2021 209 | text: | 210 | Mypy 0.800 was released. This release adds Python 3.9 support, typing usability improvements 211 | (PEP 585 and PEP 604), and other features and bug fixes. Read the 212 | blog post 213 | for the details. 214 | author: Ivan Levkivskyi 215 | - title: Mypy 0.790 released 216 | date: 9 October 2020 217 | text: | 218 | Mypy 0.790 was released. 219 | Read the 220 | blog post 221 | for the details. 222 | author: Jukka Lehtosalo 223 | - title: Mypy 0.780 released 224 | date: 3 June 2020 225 | text: | 226 | Mypy 0.780 was released. 227 | Read the 228 | blog post 229 | for the details. 230 | author: Ivan Levkivskyi 231 | - title: Mypy 0.770 released 232 | date: 10 March 2020 233 | text: | 234 | Mypy 0.770 was released. This release includes various fixes and improvements and improved type inference in some cases. 235 | Read the 236 | blog post 237 | for the details. 238 | author: Michael J. Sullivan 239 | - title: Mypy 0.760 released 240 | date: 17 December 2019 241 | text: | 242 | Mypy 0.760 was released. This release includes various fixes and improvements, and a 243 | type signature suggestion feature for tools. 244 | Read the 245 | blog post 246 | for the details. 247 | author: Jukka Lehtosalo 248 | - title: Mypy 0.750 released 249 | date: 29 November 2019 250 | text: | 251 | Mypy 0.750 was released. This release has better support for self-types, improved stub generator, 252 | experimental static inference of annotations, and other improvements and bug fixes. 253 | Read the blog post 254 | for more details. 255 | author: Ivan Levkivskyi 256 | - title: Mypy 0.740 released 257 | date: 16 October 2019 258 | text: | 259 | Mypy 0.740 was released. This release adds type checking for str.format and improved checking of untyped functions. Read the 260 | blog post 261 | for more details. 262 | author: Michael J. Sullivan 263 | - title: Mypy 0.730 released 264 | date: 26 September 2019 265 | text: | 266 | Mypy 0.730 was released. This release adds colored and pretty output modes, and 267 | it includes support for error codes. Read the 268 | blog post 269 | for more details. 270 | author: Jukka Lehtosalo 271 | - title: Mypy 0.720 released 272 | date: 12 July 2019 273 | text: | 274 | Mypy 0.720 was released. This release uses the new semantic analyzer by default, 275 | adds a flag to warn about unreachable code, and has other improvements and bug fixes. 276 | Read the 277 | blog post 278 | for more details. 279 | author: Ivan Levkivskyi 280 | - title: Mypy 0.710 released 281 | date: 19 June 2019 282 | text: | 283 | Mypy 0.710 was released. This release features a new, 284 | experimental semantic analyzer and inline configuration options. 285 | Read the 286 | blog post 287 | for more details. 288 | author: Guido van Rossum 289 | - title: Mypy 0.701 released 290 | date: 16 April 2019 291 | text: | 292 | Mypy 0.701 was released. This fixes a few bugs and regressions in 0.700. Read the 293 | blog post 294 | for more details. 295 | author: Michael J. Sullivan 296 | - title: Mypy 0.700 released 297 | date: 3 April 2019 298 | text: | 299 | Mypy 0.700 was released. It's up to 4x faster than previous releases! Read the 300 | blog post 301 | for more details. 302 | author: Jukka Lehtosalo 303 | - title: Blog post on extending mypy with plugins 304 | date: 1 March 2019 305 | text: | 306 | Read a blog post 307 | about extending mypy with plugins and distributing the plugins together with PEP 561 packages. 308 | author: Ivan Levkivskyi 309 | - title: Mypy 0.670 released 310 | date: 8 February 2019 311 | text: | 312 | Mypy 0.670 was released. Read the 313 | blog post 314 | for more details. 315 | author: Guido van Rossum 316 | - title: Mypy 0.660 released 317 | date: 16 January 2019 318 | text: | 319 | Mypy 0.660 was released. Read the 320 | blog post 321 | for more details. 322 | author: Michael J. Sullivan 323 | - title: Mypy 0.650 released 324 | date: 7 December 2018 325 | text: | 326 | Mypy 0.650 was released. Read the 327 | blog post 328 | for more details. 329 | author: Jukka Lehtosalo 330 | - title: Mypy 0.641 released 331 | date: 15 October 2018 332 | text: | 333 | Mypy 0.641 was released. It adds support for "final" qualifiers, and namespace packages. 334 | It also has many bug fixes and documentation updates. Read the 335 | blog post 336 | for more details. (Note that 0.640 was withdrawn due to a regression.) 337 | author: Guido van Rossum 338 | - title: Mypy 0.630 released 339 | date: 17 September 2018 340 | text: | 341 | Mypy 0.630 was released. It adds support for callback protocols and many smaller improvements, 342 | bug fixes, and documentation updates. Read the 343 | blog post 344 | for more details. 345 | author: Ivan Levkivskyi 346 | - title: Mypy 0.620 released 347 | date: 13 July 2018 348 | text: | 349 | Mypy 0.620 was released. It adds support for dataclasses, improvements to overloads, better support 350 | for PEP 561 and several smaller improvements. Read the 351 | blog post 352 | for more details. 353 | author: Ivan Levkivskyi 354 | - title: Mypy 0.610 released 355 | date: 8 June 2018 356 | text: | 357 | Mypy 0.610 was released. It adds support for dmypy run and a host of other small improvements. 358 | Read the 359 | blog post 360 | to see what's changed. 361 | (Note that we're once again starting to link blog posts here.) 362 | author: Michael J. Sullivan 363 | - title: Dropbox releases PyAnnotate 364 | date: 15 November 2017 365 | text: | 366 | Dropbox has released an open source tool for automatically generating 367 | type annotations based on runtime type collection. See the 368 | blog post 369 | for details. 370 | author: Guido van Rossum 371 | - title: For more mypy news see the mypy blog. 372 | date: 24 October 2017 373 | text: | 374 | We're increasing mypy's release frequency to about once per three weeks. 375 | We no longer will link here to each separate release blog post; just check the 376 | mypy blog for news. 377 | Two new versions, 0.530 and 0.540, were released since the last news item below. 378 | author: Guido van Rossum 379 | - title: Mypy 0.521 released 380 | date: 25 July 2017 381 | text: | 382 | Mypy 0.521 was released. It is a minor bugfix release for 0.520, and everyone using 383 | 0.520 should upgrade. 384 | Read the 385 | blog post 386 | to see what's changed. 387 | author: Jukka 388 | - title: Mypy 0.520 released 389 | date: 10 July 2017 390 | text: | 391 | Mypy 0.520 was released. It adds better control for Any types, __setattr__ support, 392 | more flexible NamedTuples, and many more improvements and bug fixes. 393 | Read the 394 | blog post 395 | to see what's changed. 396 | author: Jukka 397 | - title: Mypy 0.510 released 398 | date: 5 May 2017 399 | text: | 400 | Mypy 0.510 was released. It adds support for overloads in source files and more 401 | flexible callables, but these are just a few of the improvements and fixes. 402 | Read the 403 | blog post 404 | to see what's changed. 405 | author: Jukka 406 | - title: Mypy 0.501 released 407 | date: 1 Mar 2017 408 | text: | 409 | Mypy 0.501 was released. It switches to a new default parser and supports Python 410 | 3.6 features by default. These are also many other improvements and fixes. 411 | Read the 412 | blog post 413 | to see what's changed. 414 | author: Jukka 415 | - title: Mypy 0.470 released 416 | date: 13 Jan 2017 417 | text: | 418 | Mypy 0.470 was released. This release release switches to the PyPI package name "mypy" 419 | instead of "mypy-lang" and switches to a new version numbering scheme. It also 420 | includes many other improvements and fixes. 421 | Read the 422 | blog post 423 | to see what's changed. 424 | author: Jukka 425 | - title: Mypy 0.4.6 released 426 | date: 21 Nov 2016 427 | text: | 428 | Mypy 0.4.6 was released. This release adds support 429 | for generic type aliases, missing return statement detection and 430 | self types. It also improves type checking of import cycles and includes 431 | many other improvements and fixes. 432 | Read the 433 | blog post 434 | to see what's changed. 435 | author: Jukka 436 | - title: Mypy 0.4.5 released 437 | date: 7 Oct 2016 438 | text: | 439 | Mypy 0.4.5 was released. This release adds support 440 | for mypy configuration files and Python 3.6 variable annotations and includes 441 | many other improvements and fixes. There is now also a 442 | Gitter chat room. 443 | Read the 444 | blog post 445 | to see what's changed. 446 | author: Jukka 447 | - title: Mypy 0.4.4 released 448 | date: 25 Aug 2016 449 | text: | 450 | Mypy 0.4.4 was released. This release adds support 451 | for async/await and NewType and includes many other 452 | improvements and fixes. Read the 453 | blog post 454 | to see what's changed. 455 | author: Jukka 456 | - title: Mypy 0.4.3 released 457 | date: 14 Jul 2016 458 | text: | 459 | Mypy 0.4.3 was released. This release adds support 460 | for experimental strict checking of optional types (enabled using the 461 | --strict-optional command line option) and includes many other 462 | improvements and fixes. Read the 463 | blog post 464 | to see what's changed. 465 | author: Jukka 466 | - title: Mypy 0.4.2 released 467 | date: 9 Jun 2016 468 | text: | 469 | Mypy 0.4.2 was released. This release focuses on bug fixes. It also adds support 470 | for Type[C]. Read the 471 | blog post 472 | to see what's changed. 473 | author: Jukka 474 | - title: Mypy 0.4 released 475 | date: 5 May 2016 476 | text: | 477 | Mypy 0.4 was released. It's focused on faster type checking, usability improvements 478 | and bug fixes. Read the 479 | blog post 480 | to see what's changed. 481 | author: Jukka 482 | - title: Mypy 0.3 released 483 | date: 19 Feb 2016 484 | text: | 485 | Mypy 0.3 was released. It's focused on Python 2 support and better PEP 484 486 | compatibility, but it's much improved in general. Read the 487 | blog post 488 | to see what's changed. Note that the mypy GitHub repo was moved to 489 | a new URL 490 | (https://github.com/python/mypy). 491 | author: Jukka 492 | - title: Mypy 0.2 released 493 | date: 5 Apr 2015 494 | text: | 495 | Mypy 0.2 was released. It's focused on PEP 484 (Type Hinting) draft compatibility and 496 | more complete Python feature support. 497 | Blog post 498 | author: Jukka 499 | - title: Mypy and the PEP 484 (type hinting) draft 500 | date: 17 Jan 2015 501 | text: | 502 | Read my blog post 503 | about PEP 484 (Type Hinting) 504 | draft, which proposes adding a standard 505 | type annotation syntax strongly inspired by mypy to the upcoming Python 3.5 release. 506 | author: Jukka 507 | - title: Revamped documentation 508 | date: 23 Nov 2014 509 | text: | 510 | We've been converting mypy documentation to reStructuredText/Sphinx and 511 | improving it in the process 512 | (thanks to Ryan Gonzalez for the bulk of the work!). The new docs are 513 | now public and hosted on readthedocs.org. 514 | The source code is available on GitHub. 515 | author: Jukka 516 | - title: Mypy only type checks, it does not run programs 517 | date: 31 Aug 2014 518 | text: | 519 | Mypy no longer runs your programs, it just type checks 520 | them. Use a Python interpreter to run programs. 521 | author: Jukka 522 | - title: Moving forward again 523 | date: 24 Jul 2014 524 | text: | 525 | Mypy development is seeing progress, after a pause. 526 | Stay tuned for exciting news! And we're still looking for new contributors. 527 | Also updated the web site to reflect the current development focus: static type 528 | checking. 529 | author: Jukka 530 | - title: Mypy switches to Python-compatible syntax 531 | date: 2 Jul 2013 532 | text: | 533 | Mypy now has a Python-compatible syntax! The 534 | implementation is already self-hosting. Have a look at the 535 | rewritten Mypy Tutorial (formerly Mypy 536 | Overview), README 537 | and the code. Also 538 | updated the roadmap. See the related blog post. 539 | author: Jukka 540 | - title: "PyCon Update: Python-compatible syntax for mypy?" 541 | date: 15 Apr 2013 542 | text: | 543 | I wrote a blog post about 544 | my PyCon visit and a new, Python-compatible syntax idea. 545 | The short summary is that mypy may get a 100% Python-compatible syntax 546 | in the future! Also Python 2.x support, structural subtyping and real 547 | multiple inheritance are being planned. 548 | author: Jukka 549 | - title: Mypy at PyCon US 2013 (Santa Clara, CA) 550 | date: 13 Mar 2012 551 | text: | 552 | I will present a poster about mypy at 553 | PyCon US this weekend. If you 554 | are coming to PyCon, you are welcome to come for a chat. 555 | author: Jukka 556 | - title: Mypy Development Update #2 557 | date: 13 Mar 2012 558 | text: | 559 | A lot has happened in the mypy project in the last 560 | few months. 561 | I've written a 562 | blog post 563 | about the most interesting recent developments. 564 | author: Jukka 565 | - title: Wiki opened 566 | date: 14 Dec 2012 567 | text: | 568 | The mypy wiki is now open. It 569 | contains useful information for both users and mypy developers, and it is 570 | editable by all. 571 | Related 572 | blog post 573 | author: Jukka 574 | - title: Source code released 575 | date: 7 Dec 2012 576 | text: | 577 | Mypy source code is 578 | now available on GitHub. 579 | Fork it and give it a try! 580 | The current prototype supports a useful but somewhat limited subset of 581 | Python 582 | features (library support is still limited) and 583 | lets you type check programs and run them by translating to Python. 584 | As such there is no performance boost yet. 585 | author: Jukka 586 | - title: Mypy has a blog and a newsletter, and is on Twitter 587 | date: 4 Dec 2012 588 | text: | 589 | I set up a 590 | mypy status blog. From now on, 591 | all important mypy updates will be posted there. There's also 592 | an Atom feed 593 | (it has been requested by several people). You can follow mypy development 594 | on Twitter (@mypyproject). 595 | Finally, you can also subscribe to an 596 | email 597 | newsletter hosted at Google Groups. 598 | author: Jukka 599 | - title: Mypy is self-hosting + language changes 600 | date: 2 Dec 2012 601 | text: | 602 | The mypy implementation has been self-hosting for about two weeks now (on 603 | top of CPython)! We are happily eating our own dog food. 604 | The source release is Real Soon Now. The release is a bit late as we 605 | decided to make some changes and add new features just before the release. 606 | author: Jukka 607 | - title: Mypy at PyCon Finland 608 | date: 25 Oct 2012 609 | text: | 610 | I gave a talk on mypy at 611 | PyCon Finland. 612 | Slides 613 | are available. 614 | author: Jukka 615 | -------------------------------------------------------------------------------- /out/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | favicon.ico 3 | static/ 4 | -------------------------------------------------------------------------------- /overview.html: -------------------------------------------------------------------------------- 1 | $title mypy - Tutorial$ 2 | $keywords mypy overview, mypy introduction, mypy tutorial, mypy documentation$ 3 | $description Mypy tutorial.$ 4 | 5 |
    6 |

    Mypy Overview

    7 | 8 |

    This page has been moved to Mypy Documentation. 9 | 10 |

    11 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyyaml 2 | libsass 3 | -------------------------------------------------------------------------------- /roadmap.html: -------------------------------------------------------------------------------- 1 | $title mypy - Development Roadmap$ 2 | $keywords mypy, roadmap, mypy development$ 3 | $description Development roadmap for mypy.$ 4 | 5 |
    6 |

    Mypy Development Roadmap

    7 | 8 |

    The roadmap has a new 9 | location. 10 | 11 |

    12 | -------------------------------------------------------------------------------- /scripts/copy-to-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eu 3 | 4 | echo "=== Building web site..." 5 | python3 build.py 6 | 7 | if [ ! -f out/index.html ]; then 8 | echo "Error: The out/ directory does not seem to contain generated files!" 9 | exit 1 10 | fi 11 | 12 | echo "=== Copying web site to mypy-lang.org..." 13 | cd out 14 | ssh mypy-lang.org "mkdir -p web/static" 15 | scp -r *.html *.css static favicon.ico mypy-lang.org:web/ 16 | ssh mypy-lang.org "sudo cp -r web/* /srv/www-mypy/" 17 | 18 | echo "=== Done" 19 | -------------------------------------------------------------------------------- /site.scss: -------------------------------------------------------------------------------- 1 | /* Geometry */ 2 | 3 | $width: 1000px; 4 | $left-width: 600px; 5 | $left-padding: 50px; 6 | $right-padding: 40px; 7 | $sample-padding: 20px; 8 | $why-width: 290px; 9 | 10 | /* Colors */ 11 | 12 | $page-background: #fff; 13 | $shadow: #888; 14 | $top-background: #ffffff; 15 | 16 | $base: #1F5082; 17 | 18 | $navi-background: $base; 19 | $navi-bottom-border: darken($navi-background, 25); 20 | $navi-text: #eee; 21 | 22 | $base-alt: #E4D97C; 23 | 24 | $pane-background: lighten($base-alt, 15); 25 | $pane-border: $base-alt; 26 | 27 | $example-color: #3c3c3c; 28 | $example-background: #eeeeee; 29 | 30 | /* Layout */ 31 | 32 | html, body { 33 | font-family: arial, helvetica, sans-serif; 34 | font-size: 95%; 35 | } 36 | 37 | body { 38 | background-color: $page-background; 39 | padding: 0; 40 | margin: 0; 41 | } 42 | 43 | #navi { 44 | width: 100%; 45 | min-width: $width + 50px; 46 | float: left; 47 | clear: left; 48 | background-color: $navi-background; 49 | border-bottom: 1px $navi-bottom-border solid; 50 | } 51 | 52 | @mixin margins { 53 | width: $width; 54 | margin-left: auto; 55 | margin-right: auto; 56 | padding-left: 10px; 57 | padding-right: 10px; 58 | } 59 | 60 | #bar { 61 | @include margins; 62 | } 63 | 64 | #navi .link { 65 | float: left; 66 | padding: 0; 67 | padding-right: 0.8em; 68 | margin: 0; 69 | } 70 | 71 | @mixin baritem { 72 | text-decoration: none; 73 | padding-top: 15px; 74 | padding-bottom: 15px; 75 | color: $navi-text; 76 | } 77 | 78 | #navi .link a { 79 | @include baritem; 80 | display: block; 81 | font-weight: bold; 82 | padding-left: 0.45em; 83 | padding-right: 0.45em; 84 | } 85 | 86 | #navi .follow { 87 | float: right; 88 | padding: 0; 89 | padding-right: 0.8em; 90 | margin: 0; 91 | } 92 | 93 | #navi .follow .head { 94 | @include baritem; 95 | display: block; 96 | color: darken($navi-text, 20); 97 | } 98 | 99 | #navi .follow a { 100 | @include baritem; 101 | display: block; 102 | color: darken($navi-text, 5); 103 | } 104 | 105 | #navi .link a:hover { 106 | text-decoration: underline; 107 | } 108 | 109 | #navi .follow a:hover { 110 | text-decoration: underline; 111 | } 112 | 113 | #top { 114 | @include margins; 115 | clear: both; 116 | } 117 | 118 | #rightbar { 119 | float: right; 120 | width: $why-width; 121 | margin-top: 10em; 122 | margin-left: 3em; 123 | margin-bottom: 2em; 124 | } 125 | 126 | .rightbox { 127 | border: 1px $pane-border solid; 128 | background-color: $pane-background; 129 | padding: 1em; 130 | margin-bottom: 1.5em; 131 | } 132 | 133 | #fork { 134 | text-align: center; 135 | } 136 | 137 | #fork a { 138 | color: darken($base-alt, 50); 139 | font-size: 170%; 140 | } 141 | 142 | #twitter { 143 | text-align: center; 144 | } 145 | 146 | #twitter a { 147 | color: darken($base-alt, 50); 148 | font-size: 120%; 149 | } 150 | 151 | #why .title { 152 | margin-top: 0; 153 | } 154 | 155 | #why .title, #learn-more .title { 156 | color: darken($base-alt, 50); 157 | font-size: 170%; 158 | } 159 | 160 | #why dt { 161 | padding-left: 0em; 162 | margin-left: 0; 163 | } 164 | 165 | #why dd { 166 | padding-left: 0; 167 | margin-left: 0; 168 | } 169 | 170 | h1#mypy-heading { 171 | font-size: 400%; 172 | color: $base; 173 | padding-top: 0.6em; 174 | padding-bottom: 0.7em; 175 | margin-top: 0; 176 | margin-bottom: 0; 177 | } 178 | 179 | .front-sample { 180 | float: left; 181 | margin-right: 2em; 182 | } 183 | 184 | .sample-header { 185 | font-weight: bold; 186 | } 187 | 188 | #features { 189 | @include margins; 190 | } 191 | 192 | #learn-more { 193 | margin-top: 2em; 194 | margin-left: -1em; 195 | margin-right: -1em; 196 | padding-left: 1em; 197 | padding-right: 1em; 198 | padding-top: 0.5em; 199 | padding-bottom: 0.8em; 200 | border: 1px $pane-border solid; 201 | background-color: $pane-background; 202 | } 203 | 204 | #learn-more .title { 205 | margin-top: .5em; 206 | } 207 | 208 | #footer { 209 | float: right; 210 | width: 100%; 211 | color: #606060; 212 | padding-top: 3em; 213 | padding-bottom: 3em; 214 | text-align: center; 215 | font-size: 90%; 216 | } 217 | 218 | .clear { 219 | clear: both; 220 | } 221 | 222 | .clear-left { 223 | clear: left; 224 | } 225 | 226 | /* Formatting */ 227 | 228 | h1, h2, h3 { 229 | font-weight: normal; 230 | font-family: "Bitstream Vera Sans", sans-serif; 231 | /*font-family: Georgia, "Bitstream Vera Serif", Palatino, serif;*/ 232 | /*border-bottom: 1px #888 dotted;*/ 233 | } 234 | 235 | h1 { 236 | margin-top: 1em; 237 | margin-bottom: 1em; 238 | font-size: 170%; 239 | font-weight: normal; 240 | color: lighten($base, 2); 241 | } 242 | 243 | h1.first { 244 | font-size: 300%; 245 | padding-top: 0.9em; 246 | margin-bottom: 0.8em; 247 | } 248 | 249 | h2 { 250 | font-size: 145%; 251 | margin-top: 1.2em; 252 | margin-bottom: 1.2em; 253 | color: #0E2768; 254 | } 255 | 256 | h3 { 257 | font-size: 120%; 258 | } 259 | 260 | a:link { 261 | color: #0000c0; 262 | } 263 | 264 | a:visited { 265 | color: #602070; 266 | } 267 | 268 | a:hover { 269 | color: #5050c0; 270 | } 271 | 272 | .features li { 273 | padding-top: 0.3em; 274 | padding-bottom: 0.3em; 275 | } 276 | 277 | p.features { 278 | margin-left: 2em; 279 | } 280 | 281 | dt { 282 | font-weight: bold; 283 | margin-top: 0.5em; 284 | margin-bottom: 0.5em; 285 | margin-left: 1em; 286 | } 287 | 288 | dd { 289 | margin-left: 1em; 290 | } 291 | 292 | .small { 293 | font-size: 80%; 294 | } 295 | 296 | ul li { 297 | margin-top: 0.5em; 298 | margin-bottom: 0.5em; 299 | } 300 | 301 | li .list-title { 302 | font-weight: bold; 303 | } 304 | 305 | .char { 306 | vertical-align: baseline; 307 | } 308 | 309 | .adr { 310 | white-space: nowrap; 311 | } 312 | 313 | .hid { 314 | display: none; 315 | } 316 | 317 | .note { 318 | border: 1px solid #777; 319 | font-style: italic; 320 | padding: 1em; 321 | margin-top: 1.5em; 322 | margin-bottom: 1.5em; 323 | } 324 | 325 | /* Page-specific styles */ 326 | 327 | #news dt { 328 | font-weight: bold; 329 | font-size: 105%; 330 | padding-top: 0.5em; 331 | } 332 | 333 | #news dd { 334 | margin-left: 1em; 335 | margin-top: 0.5em; 336 | } 337 | 338 | #news dd .news-info { 339 | color: #777777; 340 | margin-top: 8px; 341 | font-size: 90%; 342 | } 343 | 344 | #right ul { 345 | padding-left: 2em; 346 | } 347 | 348 | .question { 349 | font-size: 120%; 350 | font-weight: bold; 351 | margin-top: 1.5em; 352 | margin-bottom: 1.5em; 353 | } 354 | 355 | #footer a, #footer a:visited { 356 | text-decoration: none; 357 | color: #358; 358 | } 359 | 360 | #footer a:hover { 361 | text-decoration: underline; 362 | } 363 | 364 | .float-sample { 365 | float: left; 366 | width: $width / 2 - $left-padding - $sample-padding; 367 | } 368 | 369 | .float-sample-r { 370 | float: right; 371 | width: $width / 2 - $left-padding - $sample-padding; 372 | } 373 | 374 | .float-sample pre.ex { 375 | margin-top: 0; 376 | } 377 | 378 | .float-sample-r pre.ex { 379 | margin-top: 0; 380 | } 381 | 382 | .sample-head { 383 | font-weight: bold; 384 | margin-top: 1em; 385 | margin-bottom: 1em; 386 | } 387 | 388 | .sample-legend { 389 | position: relative; 390 | top: 2.5em; 391 | } 392 | 393 | .ex-left { 394 | float: left; 395 | width: 48%; 396 | font-size: 95%; 397 | } 398 | 399 | .ex-right { 400 | float: right; 401 | width: 48%; 402 | font-size: 95%; 403 | } 404 | 405 | p.dev-status { 406 | font-style: italic; 407 | } 408 | 409 | /* Syntax highlighting */ 410 | 411 | pre { 412 | font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', 413 | Courier, monospace !important; 414 | font-style: normal; 415 | } 416 | 417 | pre.ex { 418 | margin-top: 1.3em; 419 | margin-bottom: 1.3em; 420 | color: $example-color; 421 | padding: 0.9em; 422 | background-color: $example-background; 423 | border: 1px solid #dddddd; 424 | font-size: 95%; 425 | } 426 | 427 | .note pre.ex:last-child { 428 | margin-bottom: 0.5em; 429 | } 430 | 431 | .kw { 432 | color: #5c5ca0; 433 | } 434 | 435 | .pr { 436 | color: #5c5ca0; 437 | } 438 | 439 | .co span.pr { 440 | color: #32923c; 441 | } 442 | 443 | .co span.kw { 444 | color: #32923c; 445 | } 446 | 447 | .st { 448 | color: #771818; 449 | } 450 | 451 | .co { 452 | color: #32923c; 453 | font-style: italic; 454 | } 455 | 456 | .error { 457 | color: red; 458 | font-style: italic; 459 | } 460 | 461 | .hili { 462 | background-color: darken($example-background, 6); 463 | } 464 | 465 | @media screen and (max-device-width: 480px) { 466 | .ex-left { 467 | width: 90%; 468 | } 469 | 470 | .ex-right { 471 | width: 90%; 472 | float: left; 473 | } 474 | } -------------------------------------------------------------------------------- /static/mypy_badge.svg: -------------------------------------------------------------------------------- 1 | mypymypycheckedchecked 2 | -------------------------------------------------------------------------------- /static/mypy_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 40 | 42 | 44 | 45 | 47 | image/svg+xml 48 | 50 | 51 | 52 | 53 | 54 | 59 | 64 | 69 | 74 | 79 | 84 | 89 | 94 | 99 | 100 | -------------------------------------------------------------------------------- /template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $title$ 5 | 6 | 7 | 8 | 9 | 22 | 23 | 24 | 25 | 42 |
    43 | $content$ 44 |
    45 | 46 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /tutorial.html: -------------------------------------------------------------------------------- 1 | $title mypy - Tutorial$ 2 | $keywords mypy overview, mypy introduction, mypy tutorial, mypy documentation$ 3 | $description The mypy tutorial.$ 4 | 5 |
    6 |

    Mypy Tutorial

    7 | 8 |

    This page has been moved to Mypy Documentation. 9 | 10 |

    11 | --------------------------------------------------------------------------------