Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps #111

Merged
merged 6 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
20 changes: 0 additions & 20 deletions .github/workflows/misspell.yml

This file was deleted.

28 changes: 16 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
name: test

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: |
curl -sSL \
"https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py" | python
curl -sSL "https://install.python-poetry.org" | python

# Adding `poetry` to `$PATH`:
echo "$HOME/.poetry/bin" >> $GITHUB_PATH

- name: Set up cache
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
Expand All @@ -40,6 +44,6 @@ jobs:
run: make test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ unit:
package:
poetry check
poetry run pip check
poetry run safety check --full-report

.PHONY: typetests
typetests:
Expand Down
10 changes: 4 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import os
import sys

import tomlkit
import tomli

sys.path.insert(0, os.path.abspath('..'))

Expand All @@ -24,9 +24,7 @@

def _get_project_meta():
with open('../pyproject.toml') as pyproject:
file_contents = pyproject.read()

return tomlkit.parse(file_contents)['tool']['poetry']
return tomli.load(pyproject)['tool']['poetry']


pkg_meta = _get_project_meta()
Expand All @@ -43,7 +41,7 @@ def _get_project_meta():
# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = '2.3'
needs_sphinx = '5.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand Down Expand Up @@ -96,7 +94,7 @@ def _get_project_meta():
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
2,520 changes: 1,351 additions & 1,169 deletions poetry.lock

Large diffs are not rendered by default.

54 changes: 31 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"


[tool.nitpick]
style = "https://raw.githubusercontent.com/wemake-services/wemake-python-styleguide/master/styles/nitpick-style-wemake.toml"


[tool.poetry]
name = "mypy-extras"
description = "A collection of extra types and features for mypy"
version = "0.1.0"
license = "MIT"

authors = []
authors = [
"Nikita Sobolev <[email protected]>",
]

readme = "README.md"

Expand All @@ -29,24 +22,39 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.6,<3.9"
python = ">=3.8.1,<4"

[tool.poetry.dev-dependencies]
mypy = "^0.910"
[tool.poetry.group.dev.dependencies]
mypy = "^1.5"

wemake-python-styleguide = "^0.15"
wemake-python-styleguide = "^0.18"
flake8-pytest-style = "^1.5"
nitpick = "^0.27"
nitpick = "^0.34"
doc8 = "^1.1"

pytest = "^7.3"
pytest-cov = "^4.0"
pytest-randomly = "^3.12"
pytest-mypy-plugins = "^3.0"

safety = "^1.10"

pytest = "^6.2"
pytest-cov = "^2.12"
pytest-randomly = "^3.8"
pytest-mypy-plugins = "^1.7"
[tool.poetry.group.docs]
optional = true

sphinx = "^4.1"
[tool.poetry.group.docs.dependencies]
sphinx = ">=6.2,<8.0"
sphinx-autodoc-typehints = "^1.12"
doc8 = "^0.9"
sphinxcontrib-mermaid = "^0.9"
added-value = "^0.24"
m2r2 = "^0.3"
tomlkit = "^0.7"
tomli = "^2.0"



[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"


[tool.nitpick]
style = "https://raw.githubusercontent.com/wemake-services/wemake-python-styleguide/master/styles/nitpick-style-wemake.toml"
6 changes: 1 addition & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ per-file-ignores =
[isort]
# isort configuration:
# https://github.com/timothycrosley/isort/wiki/isort-Settings
include_trailing_comma = true
use_parentheses = true
# See https://github.com/timothycrosley/isort#multi-line-output-modes
multi_line_output = 3
line_length = 80
profile = wemake


[tool:pytest]
Expand Down
11 changes: 7 additions & 4 deletions typesafety/test_attr_of/test_attr_of_errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
class Test(object):
x: int

test: AttrOf[Test, Literal[1]] # E: The second argument must be a string literal
reveal_type(test) # N: Revealed type is "Any"
test: AttrOf[Test, Literal[1]]
reveal_type(test)
out: |
main:7: error: The second argument must be a string literal [misc]
main:8: note: Revealed type is "Any"


- case: attr_of_attr_wrong_key_type
Expand All @@ -35,8 +38,8 @@

test: AttrOf[Test, 'y']
out: |
main:7: error: Name "y" is not defined
main:7: error: The second argument must be a string literal
main:7: error: The second argument must be a string literal [misc]
main:7: error: Name "y" is not defined [name-defined]


- case: attr_of_attr_wrong_instance
Expand Down
19 changes: 9 additions & 10 deletions typesafety/test_attr_of/test_attr_of_instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from mypy_extras import AttrOf
from typing_extensions import Literal

test: AttrOf[str, Literal['split']]
reveal_type(test) # N: Revealed type is "def (sep: Union[builtins.str, None] =, maxsplit: builtins.int =) -> builtins.list[builtins.str]"
test: AttrOf[str, Literal['isdigit']]
reveal_type(test) # N: Revealed type is "def () -> builtins.bool"


- case: attr_of_attr
Expand Down Expand Up @@ -45,7 +45,7 @@

class Test(object):
def x(self, a: int) -> str:
...
return 'a'

test: AttrOf[Test, Literal['x']]
reveal_type(test) # N: Revealed type is "def (a: builtins.int) -> builtins.str"
Expand All @@ -60,7 +60,7 @@
class Test(object):
@classmethod
def x(cls, a: int) -> str:
...
return 'a'

test: AttrOf[Test, Literal['x']]
reveal_type(test) # N: Revealed type is "def (a: builtins.int) -> builtins.str"
Expand All @@ -75,7 +75,7 @@
class Test(object):
@staticmethod
def x(a: int) -> str:
...
return 'a'

test: AttrOf[Test, Literal['x']]
reveal_type(test) # N: Revealed type is "def (a: builtins.int) -> builtins.str"
Expand All @@ -87,7 +87,6 @@
from typing_extensions import Literal
from mypy_extras import AttrOf


class User(object):
def auth(self, username: str, password: str) -> bool:
return False # Just an example
Expand Down Expand Up @@ -116,8 +115,8 @@

x: User[int]
y: User[str]
reveal_type(get_callback(x)) # N: Revealed type is "builtins.int*"
reveal_type(get_callback(y)) # N: Revealed type is "builtins.str*"
reveal_type(get_callback(x)) # N: Revealed type is "builtins.int"
reveal_type(get_callback(y)) # N: Revealed type is "builtins.str"


- case: attr_of_generic_attr
Expand All @@ -134,5 +133,5 @@

x: AttrOf[User[int], Literal['auth']]
y: AttrOf[User[str], Literal['auth']]
reveal_type(x) # N: Revealed type is "builtins.int*"
reveal_type(y) # N: Revealed type is "builtins.str*"
reveal_type(x) # N: Revealed type is "builtins.int"
reveal_type(y) # N: Revealed type is "builtins.str"
4 changes: 2 additions & 2 deletions typesafety/test_ensure_attr/test_ensure_attr_errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

reveal_type(ensure_attr(Test, 'y'))
out: |
main:7: error: Property "y" does not exist on type "main.Test"
main:7: error: Property "y" does not exist on type "main.Test" [misc]
main:7: note: Revealed type is "Literal['y']"


Expand All @@ -24,5 +24,5 @@

reveal_type(ensure_attr(Test, 1))
out: |
main:7: error: Argument 2 to "ensure_attr" has incompatible type "int"; expected "str"
main:7: note: Revealed type is "builtins.str"
main:7: error: Argument 2 to "ensure_attr" has incompatible type "int"; expected "str" [arg-type]
6 changes: 3 additions & 3 deletions typesafety/test_ensure_attr/test_ensure_attr_instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

class Test(object):
def x(self, a: int) -> str:
...
return 'a'

reveal_type(ensure_attr(Test, 'x')) # N: Revealed type is "Literal['x']"

Expand All @@ -49,7 +49,7 @@
class Test(object):
@classmethod
def x(cls, a: int) -> str:
...
return 'a'

reveal_type(ensure_attr(Test, 'x')) # N: Revealed type is "Literal['x']"

Expand All @@ -63,7 +63,7 @@
class Test(object):
@staticmethod
def x(a: int) -> str:
...
return 'a'

reveal_type(ensure_attr(Test, 'x')) # N: Revealed type is "Literal['x']"

Expand Down