Skip to content

Instantly share code, notes, and snippets.

@altendky

altendky/in.sh Secret

Last active Jan 22, 2021
Embed
What would you like to do?
python3.9 -m venv venv
mkdir package
mkdir package-stubs
cat > package/__init__.py << EOF
def f(p=None): return None
EOF
cat > package-stubs/__init__.py << EOF
def f(p: int = ...) -> None: ...
EOF
cat > mypy.ini << EOF
[mypy]
no_implicit_optional = True
EOF
cat > setup.py << EOF
import setuptools
setuptools.setup(
name="package",
packages=["package", "package-stubs"],
)
EOF
venv/bin/pip install --upgrade pip setuptools wheel
venv/bin/pip install mypy==0.800 .
venv/bin/pip freeze --all
venv/bin/stubtest package
$ python3.9 -m venv venv
$ mkdir package
$ mkdir package-stubs
$ cat > package/__init__.py << EOF
> def f(p=None): return None
> EOF
$ cat > package-stubs/__init__.py << EOF
> def f(p: int = ...) -> None: ...
> EOF
$ cat > mypy.ini << EOF
> [mypy]
> no_implicit_optional = True
> EOF
$ cat > setup.py << EOF
> import setuptools
> 
> setuptools.setup(
>     name="package",
>     packages=["package", "package-stubs"],
> )
> EOF
$ venv/bin/pip install --upgrade pip setuptools wheel
Collecting pip
  Using cached pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
Collecting setuptools
  Using cached setuptools-51.3.3-py3-none-any.whl (786 kB)
Collecting wheel
  Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, setuptools, wheel
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
  Attempting uninstall: setuptools
    Found existing installation: setuptools 49.2.1
    Uninstalling setuptools-49.2.1:
      Successfully uninstalled setuptools-49.2.1
Successfully installed pip-20.3.3 setuptools-51.3.3 wheel-0.36.2
$ venv/bin/pip install mypy==0.800 .
Processing /home/altendky/repos/trio-typing/tmp
Collecting mypy==0.800
  Using cached mypy-0.800-cp39-cp39-manylinux2010_x86_64.whl (22.6 MB)
Collecting mypy-extensions<0.5.0,>=0.4.3
  Using cached mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB)
Collecting typed-ast<1.5.0,>=1.4.0
  Using cached typed_ast-1.4.2-cp39-cp39-manylinux1_x86_64.whl (769 kB)
Collecting typing-extensions>=3.7.4
  Using cached typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Building wheels for collected packages: package
  Building wheel for package (setup.py) ... done
  Created wheel for package: filename=package-0.0.0-py3-none-any.whl size=1393 sha256=ef2d11c7bcbe6669d2da29968f81c5a1c152f3ef5b48c17a00a6f588b092ce9f
  Stored in directory: /tmp/pip-ephem-wheel-cache-_thbf1kk/wheels/69/7d/69/33da67cbcbc6118ffb22dde41ebddf2a67b93f12b0b04dd25d
Successfully built package
Installing collected packages: typing-extensions, typed-ast, mypy-extensions, package, mypy
Successfully installed mypy-0.800 mypy-extensions-0.4.3 package-0.0.0 typed-ast-1.4.2 typing-extensions-3.7.4.3
$ venv/bin/pip freeze --all
mypy==0.800
mypy-extensions==0.4.3
package @ file:///home/altendky/repos/trio-typing/tmp
pip==20.3.3
setuptools==51.3.3
typed-ast==1.4.2
typing-extensions==3.7.4.3
wheel==0.36.2
$ venv/bin/stubtest package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment