Skip to content

Conversation

DimitriPapadopoulos
Copy link
Contributor

Required to fix this CI warning:

pyproject.toml: [mypy]: Unrecognized option: strict_bytes = True

Indeed option --strict-bytes was added in mypy 1.15:

Required to fix this CI warning:
pyproject.toml: [mypy]: Unrecognized option: strict_bytes = True

Indeed option `--strict-bytes` was added in mypy 1.15:
https://mypy.readthedocs.io/en/stable/changelog.html#strict-bytes
https://github.com/python/mypy/blob/master/CHANGELOG.md#--strict-bytes
@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented May 26, 2025

Unfortunately mypy 1.14.1 is not available for Python 3.8, so I guess we have to live with the CI warning for now. Besides the warning is certainly the result of warn_unused_configs so it is expected:

warn_unused_configs = true

By the way, the documentation states:

This requires turning off incremental mode using incremental = False.

@reaperhulk
Copy link
Member

If you look closer at our requirements pinning you'll see we pin to 1.15 on the versions of Python that support it already.

@reaperhulk reaperhulk closed this May 26, 2025
@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented May 26, 2025

Yes, I've seen that, but the CI warning with Python 3.8 should be avoided if possible:

  • You shouldn't need to actually run mypy under each supported version of Python, instead you could use option --python-version=3.8 with a recent version of Python.
  • But then what's the point of running mypy for different versions of Python? I may be mistaken, but the source code seems identical for all versions of Python, with few exceptions:

    cryptography/release.py

    Lines 13 to 16 in 5cf5edf

    if sys.version_info >= (3, 11):
    import tomllib
    else:
    import tomli as tomllib

    cryptography/noxfile.py

    Lines 18 to 21 in 5cf5edf

    if sys.version_info >= (3, 11):
    import tomllib
    else:
    import tomli as tomllib

    # If you're wondering why we don't use `Buffer`, it's because `Buffer` would
    # be more accurately named: Bufferable. It means something which has an
    # `__buffer__`. Which means you can't actually treat the result as a buffer
    # (and do things like take a `len()`).
    if sys.version_info >= (3, 9):
    Buffer = typing.Union[bytes, bytearray, memoryview]
    else:
    Buffer = typing.ByteString

@DimitriPapadopoulos
Copy link
Contributor Author

Superseded by #13001.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants