From a4aba9fed1209d5872b3d6de5487342649f2f604 Mon Sep 17 00:00:00 2001 From: David Shea Date: Feb 22 2016 23:14:40 +0000 Subject: Update to the first post-3.5 actual upstream release --- diff --git a/.gitignore b/.gitignore index ed4db8b..e03b83e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /mypy-0.2.0-cd96f02.tar.gz /mypy-0.2.0-4127a66.tar.gz /mypy-0.2.0-9befcc7.tar.gz +/mypy-lang-0.3.1.tar.gz diff --git a/0001-Do-not-install-typing.py.patch b/0001-Do-not-install-typing.py.patch deleted file mode 100644 index b473eee..0000000 --- a/0001-Do-not-install-typing.py.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 42498a957f88bdd9a956508453b651d0d9b99f98 Mon Sep 17 00:00:00 2001 -From: David Shea -Date: Tue, 15 Dec 2015 10:06:52 -0500 -Subject: [PATCH 1/3] Do not install typing.py - -This module is not needed with Python 3.5 ---- - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/setup.py b/setup.py -index 7ac47a7..8687c58 100644 ---- a/setup.py -+++ b/setup.py -@@ -78,7 +78,7 @@ setup(name='mypy-lang', - url='http://www.mypy-lang.org/', - license='MIT License', - platforms=['POSIX'], -- package_dir={'': 'lib-typing/3.2', 'mypy': 'mypy'}, -+ package_dir={'mypy': 'mypy'}, - py_modules=['typing'], - packages=['mypy'], - scripts=['scripts/mypy', 'scripts/stubgen'], --- -2.7.0 - diff --git a/0001-Look-for-typeshed-in-usr-share.patch b/0001-Look-for-typeshed-in-usr-share.patch new file mode 100644 index 0000000..439050d --- /dev/null +++ b/0001-Look-for-typeshed-in-usr-share.patch @@ -0,0 +1,40 @@ +From 7cdf652eaee801639aac39527305e256dcf65515 Mon Sep 17 00:00:00 2001 +From: David Shea +Date: Tue, 15 Dec 2015 14:01:55 -0500 +Subject: [PATCH 1/2] Look for typeshed in /usr/share + +Skip installing the bundled typeshed +--- + mypy/build.py | 2 +- + setup.py | 2 -- + 2 files changed, 1 insertion(+), 3 deletions(-) + +diff --git a/mypy/build.py b/mypy/build.py +index 4d01c5d..9f01b23 100644 +--- a/mypy/build.py ++++ b/mypy/build.py +@@ -233,7 +233,7 @@ def default_data_dir(bin_dir: str) -> str: + return os.path.dirname(bin_dir) + elif base == 'bin': + # Installed to somewhere (can be under /usr/local or anywhere). +- return os.path.join(dir, 'lib', 'mypy') ++ return os.path.join(dir, 'share') + elif base == 'python3': + # Assume we installed python3 with brew on os x + return os.path.join(os.path.dirname(dir), 'lib', 'mypy') +diff --git a/setup.py b/setup.py +index 89554a6..da62c0d 100644 +--- a/setup.py ++++ b/setup.py +@@ -53,8 +53,6 @@ def find_data_files(base, globs): + + data_files = [] + +-data_files += find_data_files('typeshed', ['*.py', '*.pyi']) +- + data_files += find_data_files('xml', ['*.xsd', '*.xslt', '*.css']) + + classifiers = [ +-- +2.7.1 + diff --git a/0002-Canonicalize-bin_dir-when-looking-for-data_dir.patch b/0002-Canonicalize-bin_dir-when-looking-for-data_dir.patch new file mode 100644 index 0000000..937b94d --- /dev/null +++ b/0002-Canonicalize-bin_dir-when-looking-for-data_dir.patch @@ -0,0 +1,29 @@ +From 6701ebf1208d5b129d83999dab4ea792c4f60c35 Mon Sep 17 00:00:00 2001 +From: David Shea +Date: Thu, 7 Jan 2016 10:02:27 -0500 +Subject: [PATCH 2/2] Canonicalize bin_dir when looking for data_dir. + +This way calling mypy as /bin/mypy will look for the data dir starting +in /usr instead of /. +--- + mypy/build.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/mypy/build.py b/mypy/build.py +index 9f01b23..d79d0f5 100644 +--- a/mypy/build.py ++++ b/mypy/build.py +@@ -222,6 +222,10 @@ def default_data_dir(bin_dir: str) -> str: + return os.path.join(lib, 'mypy') + # Default to directory containing this file's parent. + return parent ++ ++ # Canonicalize the path in case bin_dir is a symlink ++ bin_dir = os.path.realpath(bin_dir) ++ + base = os.path.basename(bin_dir) + dir = os.path.dirname(bin_dir) + if (sys.platform == 'win32' and base.lower() == 'scripts' +-- +2.7.1 + diff --git a/0002-Look-for-typeshed-in-usr-share.patch b/0002-Look-for-typeshed-in-usr-share.patch deleted file mode 100644 index 54df3ab..0000000 --- a/0002-Look-for-typeshed-in-usr-share.patch +++ /dev/null @@ -1,25 +0,0 @@ -From bc66f0e202f5f2b432cd8a5b8829da61962ad88b Mon Sep 17 00:00:00 2001 -From: David Shea -Date: Tue, 15 Dec 2015 14:01:55 -0500 -Subject: [PATCH 2/3] Look for typeshed in /usr/share - ---- - mypy/build.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/mypy/build.py b/mypy/build.py -index edb3896..0f5efdc 100644 ---- a/mypy/build.py -+++ b/mypy/build.py -@@ -221,7 +221,7 @@ def default_data_dir(bin_dir: str) -> str: - return os.path.dirname(bin_dir) - elif base == 'bin': - # Installed to somewhere (can be under /usr/local or anywhere). -- return os.path.join(dir, 'lib', 'mypy') -+ return os.path.join(dir, 'share') - elif base == 'python3': - # Assume we installed python3 with brew on os x - return os.path.join(os.path.dirname(dir), 'lib', 'mypy') --- -2.7.0 - diff --git a/0003-Canonicalize-bin_dir-when-looking-for-data_dir.patch b/0003-Canonicalize-bin_dir-when-looking-for-data_dir.patch deleted file mode 100644 index 6eabf07..0000000 --- a/0003-Canonicalize-bin_dir-when-looking-for-data_dir.patch +++ /dev/null @@ -1,29 +0,0 @@ -From e404b6d1545fba08859cd4f3de49367ca99792ec Mon Sep 17 00:00:00 2001 -From: David Shea -Date: Thu, 7 Jan 2016 10:02:27 -0500 -Subject: [PATCH 3/3] Canonicalize bin_dir when looking for data_dir. - -This way calling mypy as /bin/mypy will look for the data dir starting -in /usr instead of /. ---- - mypy/build.py | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/mypy/build.py b/mypy/build.py -index 0f5efdc..156a92f 100644 ---- a/mypy/build.py -+++ b/mypy/build.py -@@ -210,6 +210,10 @@ def default_data_dir(bin_dir: str) -> str: - if not bin_dir: - # Default to directory containing this file's parent. - return os.path.dirname(os.path.dirname(__file__)) -+ -+ # Canonicalize the path in case bin_dir is a symlink -+ bin_dir = os.path.realpath(bin_dir) -+ - base = os.path.basename(bin_dir) - dir = os.path.dirname(bin_dir) - if (sys.platform == 'win32' and base.lower() == 'scripts' --- -2.7.0 - diff --git a/CREDITS b/CREDITS new file mode 100644 index 0000000..d4fe9ee --- /dev/null +++ b/CREDITS @@ -0,0 +1,101 @@ +Credits +------- + +Lead developer: + + Jukka Lehtosalo + +Core team: + + Guido + David Fisher + Greg Price + +Contributors (in alphabetical order, including typeshed): + + Tim Abbott + Steven Allen (@Stebalien) + Della Anjeh + Reid Barton (@rwbarton) + Matthias Bussonnier + Anup Chenthamarakshan + Kyle Consalus + Ian Cordasco + ctcutler + Ben Darnell + Miguel Garcia (@rockneurotiko) + Mihnea Giurgea + Ryan Gonzalez (@kirbyfan64) + James Guthrie + Jared Hance + Ashley Hewson (@ashleyh) + icoxfog417 + Bob Ippolito (@etrepum) + ismail-s + Sander Kersten (@spkersten) + Matthias Kramm + Ian Kronquist (@iankronquist) + Yuval Langer + Howard Lee + Tad Leonard + Li Haoyi + Darjus Loktevic + Ben Longbons + Florian Ludwig (@FlorianLudwig) + Robert T. McGibbon + Ron Murawski + Motoki Naruse + Jared Pochtar (@jaredp) + Michal Pokorný + Eric Price (@ecprice) + Brodie Rao + Sebastian Reuße + Sebastian Riikonen + Seo Sanghyeon + Marek Sapota + Gigi Sayfan + Vlad Shcherbina + Anders Schuller + Daniel Shaulov + David Shea + Vita Smid + Schuyler Smith + Marcell Vazquez-Chanlatte (@mvcisback) + Prayag Verma + Igor Vuk (@ivuk) + Jeff Walden (@jswalden) + Michael Walter + Jing Wang + Wen Zhang + Roy Williams + wizzardx + Matthew Wright + Yuanchao Zhu (@yczhu) + Gennadiy Zlobin (@gennad) + +Additional thanks to: + + Alex Allain + Max Bolingbroke + Peter Calvert + Kannan Goundan + Kathy Gray + David J Greaves + Riitta Ikonen + Terho Ikonen + Stephen Kell + Łukasz Langa + Laura Lehtosalo + Peter Ludemann + Seppo Mattila + Robin Message + Alan Mycroft + Dominic Orchard + Pekka Rapinoja + Matt Robben + Satnam Singh + Juha Sorva + Clay Sweetser + Jorma Tarhio + Jussi Tuovila + Andrey Vlasovskikh diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bb6620a --- /dev/null +++ b/LICENSE @@ -0,0 +1,228 @@ +Mypy is licensed under the terms of the MIT license, reproduced below. + += = = = = + +The MIT License + +Copyright (c) 2015-2016 Jukka Lehtosalo and contributors + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + += = = = = + +Portions of mypy are licensed under different licenses. The files +under lib-python and lib-typing/3.2 are licensed under the PSF 2 +License, reproduced below. + += = = = = + +PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 +-------------------------------------------- + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using this software ("Python") in source or binary form and +its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF hereby +grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, +analyze, test, perform and/or display publicly, prepare derivative works, +distribute, and otherwise use Python alone or in any derivative version, +provided, however, that PSF's License Agreement and PSF's notice of copyright, +i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +2011, 2012 Python Software Foundation; All Rights Reserved" are retained in Python +alone or in any derivative version prepared by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python. + +4. PSF is making Python available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 +------------------------------------------- + +BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 + +1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an +office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the +Individual or Organization ("Licensee") accessing and otherwise using +this software in source or binary form and its associated +documentation ("the Software"). + +2. Subject to the terms and conditions of this BeOpen Python License +Agreement, BeOpen hereby grants Licensee a non-exclusive, +royalty-free, world-wide license to reproduce, analyze, test, perform +and/or display publicly, prepare derivative works, distribute, and +otherwise use the Software alone or in any derivative version, +provided, however, that the BeOpen Python License is retained in the +Software, alone or in any derivative version prepared by Licensee. + +3. BeOpen is making the Software available to Licensee on an "AS IS" +basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE +SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS +AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY +DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +5. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +6. This License Agreement shall be governed by and interpreted in all +respects by the law of the State of California, excluding conflict of +law provisions. Nothing in this License Agreement shall be deemed to +create any relationship of agency, partnership, or joint venture +between BeOpen and Licensee. This License Agreement does not grant +permission to use BeOpen trademarks or trade names in a trademark +sense to endorse or promote products or services of Licensee, or any +third party. As an exception, the "BeOpen Python" logos available at +http://www.pythonlabs.com/logos.html may be used according to the +permissions granted on that web page. + +7. By copying, installing or otherwise using the software, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 +--------------------------------------- + +1. This LICENSE AGREEMENT is between the Corporation for National +Research Initiatives, having an office at 1895 Preston White Drive, +Reston, VA 20191 ("CNRI"), and the Individual or Organization +("Licensee") accessing and otherwise using Python 1.6.1 software in +source or binary form and its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, CNRI +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 1.6.1 +alone or in any derivative version, provided, however, that CNRI's +License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) +1995-2001 Corporation for National Research Initiatives; All Rights +Reserved" are retained in Python 1.6.1 alone or in any derivative +version prepared by Licensee. Alternately, in lieu of CNRI's License +Agreement, Licensee may substitute the following text (omitting the +quotes): "Python 1.6.1 is made available subject to the terms and +conditions in CNRI's License Agreement. This Agreement together with +Python 1.6.1 may be located on the Internet using the following +unique, persistent identifier (known as a handle): 1895.22/1013. This +Agreement may also be obtained from a proxy server on the Internet +using the following URL: http://hdl.handle.net/1895.22/1013". + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 1.6.1 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 1.6.1. + +4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" +basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. This License Agreement shall be governed by the federal +intellectual property law of the United States, including without +limitation the federal copyright law, and, to the extent such +U.S. federal law does not apply, by the law of the Commonwealth of +Virginia, excluding Virginia's conflict of law provisions. +Notwithstanding the foregoing, with regard to derivative works based +on Python 1.6.1 that incorporate non-separable material that was +previously distributed under the GNU General Public License (GPL), the +law of the Commonwealth of Virginia shall govern this License +Agreement only as to issues arising under or with respect to +Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this +License Agreement shall be deemed to create any relationship of +agency, partnership, or joint venture between CNRI and Licensee. This +License Agreement does not grant permission to use CNRI trademarks or +trade name in a trademark sense to endorse or promote products or +services of Licensee, or any third party. + +8. By clicking on the "ACCEPT" button where indicated, or by copying, +installing or otherwise using Python 1.6.1, Licensee agrees to be +bound by the terms and conditions of this License Agreement. + + ACCEPT + + +CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 +-------------------------------------------------- + +Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, +The Netherlands. All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + += = = = = \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ce317f7 --- /dev/null +++ b/README.md @@ -0,0 +1,249 @@ +Mypy: Optional Static Typing for Python +======================================= + +[![Build Status](https://travis-ci.org/python/mypy.svg)](https://travis-ci.org/python/mypy) + + +What is mypy? +------------- + +Mypy is an optional static type checker for Python. You can add type +hints to your Python programs using the upcoming standard for type +annotations introduced in Python 3.5 beta 1 (PEP 484), and use mypy to +type check them statically. Find bugs in your programs without even +running them! + +The type annotation notation has also been backported to earlier +Python 3.x versions. Mypy programs are valid Python 3.x and you use a +normal Python interpreter to run them. There is essentially no +performance overhead when using mypy, since mypy does not introduce +runtime type checking. + +You can mix dynamic and static typing in your programs. You can always +fall back to dynamic typing when static typing is not convenient, such +as for legacy code. + +Here is a small example to whet your appetite: + +``` +from typing import Iterator + +def fib(n: int) -> Iterator[int]: + a, b = 0, 1 + while a < n: + yield a + a, b = b, a + b +``` + +Mypy is in development; some features are missing and there are bugs. +See 'Development status' below. + + +Requirements +------------ + +You need Python 3.2 or later to run mypy. You can have multiple Python +versions (2.x and 3.x) installed on the same system without problems. + +In Ubuntu, Mint and Debian you can install Python 3 like this: + + $ sudo apt-get install python3 python3-pip + +For other Linux flavors, OS X and Windows, packages are available at + + http://www.python.org/getit/ + + +Quick start +----------- + +Mypy can be installed using pip: + + $ pip3 install mypy-lang + +*Note that the package name is `mypy-lang`, not `mypy`.* + +Currently, the version of mypy on PYPI is not compatible with Python 3.5. +If you run Python 3.5 install directly form git: + + $ pip3 install git+git://github.com/python/mypy.git + + +Now, if Python on your system is configured properly (else see +"Troubleshooting" below), you can type-check a program like this: + + $ mypy PROGRAM + +You can always use a Python interpreter to run your statically typed +programs, even if they have type errors: + + $ python3 PROGRAM + + +Web site and documentation +-------------------------- + +Documentation and additional information is available at the web site: + + http://www.mypy-lang.org/ + + +Troubleshooting +--------------- + +Depending on your configuration, you may have to run `pip` like +this: + + $ python3 -m pip install mypy-lang + +If the `mypy` command isn't found after installation: After either +`pip3 install` or `setup.py install`, the `mypy` script and +dependencies, including the `typing` module, will be installed to +system-dependent locations. Sometimes the script directory will not +be in `PATH`, and you have to add the target directory to `PATH` +manually or create a symbolic link to the script. In particular, on +Mac OS X, the script may be installed under `/Library/Frameworks`: + + /Library/Frameworks/Python.framework/Versions//bin + +In Windows, the script is generally installed in +`\PythonNN\Scripts`. So, type check a program like this (replace +`\Python34` with your Python installation path): + + C:\>\Python34\python \Python34\Scripts\mypy PROGRAM + + +Quick start for contributing to mypy +------------------------------------ + +If you want to contribute, first clone the mypy git repository: + + $ git clone --recurse-submodules https://github.com/python/mypy.git + +Run the supplied `setup.py` script to install mypy: + + $ python3 setup.py install + +Replace `python3` with your Python 3 interpreter. You may have to do +the above as root. For example, in Ubuntu and Mac OS X: + + $ sudo python3 setup.py install + +Now you can use the `mypy` program just as above. In case of trouble +see "Troubleshooting" above. + +The mypy wiki contains some useful information for contributors: + + http://www.mypy-lang.org/wiki/DeveloperGuides + +Working with the git version of mypy +------------------------------------ + +mypy contains a submodule, "typeshed". See http://github.com/python/typeshed. +This submodule contains types for the Python standard library. + +Due to the way git submodules work, you'll have to do +``` + git submodule update typeshed +``` +whenever you change branches, merge, rebase, or pull. + +(It's possible to automate this: Search Google for "git hook update submodule") + +Running tests and linting +------------------------- + +First install any additional dependencies needed for testing: + + $ pip3 install -r test-requirements.txt + +To run all tests, run the script `runtests.py` in the mypy repository: + + $ ./runtests.py + +Note that some tests will be disabled for older python versions. + +This will run all tests, including integration and regression tests, +and will type check mypy and verify that all stubs are valid. You can also +run unit tests only, which run pretty quickly: + + $ ./runtests.py unit-test + +You can run a subset of test suites by passing positive or negative +filters: + + $ ./runtests.py lex parse -x lint -x stub + +If you want to run individual unit tests, you can run `myunit` directly, or +pass inferior arguments via `-a`: + + $ scripts/myunit -m mypy.test.testlex -v '*backslash*' + $ ./runtests.py mypy.test.testlex -a -v -a '*backslash*' + +You can also run the type checker for manual testing without +installing anything by setting up the Python module search path suitably: + + $ export PYTHONPATH=$PWD:$PWD/lib-typing/3.2 + $ python -m mypy PROGRAM.py + +You can add the entry scripts to PATH for a single python3 version: + + $ export PATH=$PWD/scripts + $ mypy PROGRAM.py + +You can check a module or string instead of a file: + + $ mypy PROGRAM.py + $ mypy -m MODULE + $ mypy -c 'import MODULE' + +To run the linter: + + $ ./runtests.py lint + + +Development status +------------------ + +Mypy is work in progress and is not yet production quality, though +mypy development has been done using mypy for a while! + +Here are some of the more significant Python features not supported +right now (but all of these will improve): + + - Python 2.x support needs polish and documentation + - properties with setters not supported + - limited metaclass support + - only a subset of Python standard library modules are supported, and some + only partially + - 3rd party module support is limited + +The current development focus is to have a good coverage of Python +features and the standard library (both 3.x and 2.7). + + +Issue tracker +------------- + +Please report any bugs and enhancement ideas using the mypy issue +tracker: + + https://github.com/python/mypy/issues + +Feel free to also ask questions on the tracker. + + +Help wanted +----------- + +Any help in testing, development, documentation and other tasks is +highly appreciated and useful to the project. Contact the developers +to join the project, or just start coding and send pull requests! +There are tasks for contributors of all experience levels. + + +License +------- + +Mypy is licensed under the terms of the MIT License (see the file +LICENSE). diff --git a/python3-mypy.spec b/python3-mypy.spec index 21668e2..f35beb2 100644 --- a/python3-mypy.spec +++ b/python3-mypy.spec @@ -1,28 +1,27 @@ -%global checkout 9befcc7 - Name: python3-mypy # Last actual version was 0.2.0, which is 7805b2c, continues as 0.2.0_dev -Version: 0.2.0 -Release: 2.dev20160128git%{?dist} +Version: 0.3.1 +Release: 1 Summary: A static type checker for Python %{?python_provide:%python_provide python3-mypy} # The files under lib-python and lib-typing/3.2 are Python-licensed, but this # package does not include those files License: MIT -URL: https://github.com/JukkaL/mypy -# git archive --prefix=mypy-0.2.0-9befcc7/ 9befcc7 | gzip -c9 > mypy-0.2.0-9befcc7.tar.gz -Source0: mypy-%{version}-%{checkout}.tar.gz +URL: https://github.com/python/mypy +Source0: mypy-lang-%{version}.tar.gz -# The bundled typing.py is not needed with python 3.5 -Patch0: 0001-Do-not-install-typing.py.patch +# doc files are missing from sdist, these are the copies from upstream github +Source1: LICENSE +Source2: README.md +Source3: CREDITS # Change the search for data_dir to use Fedora's typeshed package instead of a # bundled version -Patch1: 0002-Look-for-typeshed-in-usr-share.patch +Patch1: 0001-Look-for-typeshed-in-usr-share.patch # patch 1 breaks the data dir lookup when called as /bin/mypy instead of /usr/bin/mypy -Patch3: 0003-Canonicalize-bin_dir-when-looking-for-data_dir.patch +Patch2: 0002-Canonicalize-bin_dir-when-looking-for-data_dir.patch BuildRequires: python3-devel @@ -41,7 +40,10 @@ type check them statically. Find bugs in your programs without even running them! %prep -%autosetup -n mypy-%{version}-%{checkout} -p1 +%autosetup -n mypy-lang-%{version} -p1 +cp %{SOURCE1} . +cp %{SOURCE2} . +cp %{SOURCE3} . %build %py3_build @@ -74,6 +76,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} \ %{_prefix}/lib/mypy %changelog +* Mon Feb 22 2016 David Shea - 0.3.1-1 +- Update to the first post-3.5 actual upstream release + * Thu Feb 04 2016 Fedora Release Engineering - 0.2.0-2.dev20160128git - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index 27d9ed1..d90011c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -dd79f078ab074058e340eeec031cf3af mypy-0.2.0-9befcc7.tar.gz +ef35f7fb86f4a8fca9b7292d0b03a443 mypy-lang-0.3.1.tar.gz