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

pypy3.9 - SyntaxError due to positional only arguments in stubfile #13499

Closed
florianfischer91 opened this issue Aug 24, 2022 · 1 comment · Fixed by #13500
Closed

pypy3.9 - SyntaxError due to positional only arguments in stubfile #13499

florianfischer91 opened this issue Aug 24, 2022 · 1 comment · Fixed by #13500
Labels
bug mypy got something wrong

Comments

@florianfischer91
Copy link

Bug Report

Typecheck a *.pyi file containing a function with positional only arguments raises a SyntaxError.
I use pypy3.9 (with pypy3.8 i don't get any errors)

To Reproduce

Run the code below with mypy and pypy3.9

def f(a:int, b:int, /) -> None:
	...

Expected Behavior

No error

Actual Behavior

SyntaxError: Positional only arguments are only supported in Python (3, 8) and above.

I guess the reason is that when parsing a stubfile the feature_version 7 is used.
Running the code with feature_version 8 solves the problem

Your Environment

  • Mypy version used: mypy 0.971 (compiled: no)
  • Python version used:
Python 3.9.12 | packaged by conda-forge | (05fbe3aa, Aug 15 2022, 10:20:11)
[PyPy 7.3.9 with GCC 10.4.0]
  • Operating system and version: Ubuntu
@florianfischer91 florianfischer91 added the bug mypy got something wrong label Aug 24, 2022
hauntsaninja added a commit to hauntsaninja/mypy that referenced this issue Aug 24, 2022
Fixes python#13499

Today this code reads like "stubs should all target 3.7" and this
is indeed how typeshed operates. But authors of pyi other than typeshed
should probably be allowed to choose what Python version they're
targetting.

This code goes back to python#3000 back in the typed_ast days, when this
allowed stubs to use much newer syntax features than the base Python
version, so in some ways this is in the spirit of the original code.
hauntsaninja added a commit that referenced this issue Aug 24, 2022
Fixes #13499

Today this code reads like "stubs should all target 3.7" and this
is indeed how typeshed operates. But authors of pyi other than typeshed
should probably be allowed to choose what Python version they're
targetting. Since typeshed runs checks against 3.7, this should not
cause testing regressions for typeshed.

This code goes back to #3000 back in the typed_ast days, when this
allowed stubs to use much newer syntax features than the base Python
version, so in some ways this is in the spirit of the original code.
@florianfischer91
Copy link
Author

Thanks for the quick response and fix :-)

jhance pushed a commit that referenced this issue Sep 9, 2022
Fixes #13499

Today this code reads like "stubs should all target 3.7" and this
is indeed how typeshed operates. But authors of pyi other than typeshed
should probably be allowed to choose what Python version they're
targetting. Since typeshed runs checks against 3.7, this should not
cause testing regressions for typeshed.

This code goes back to #3000 back in the typed_ast days, when this
allowed stubs to use much newer syntax features than the base Python
version, so in some ways this is in the spirit of the original code.
wence- added a commit to wence-/distributed that referenced this issue Nov 2, 2022
Addresses issues when using Python 3.10.7 and numpy typestubs (see
python/mypy#13499).
wence- added a commit to wence-/distributed that referenced this issue Nov 2, 2022
Addresses issues when using Python 3.10.7 and numpy typestubs (see
python/mypy#13499).
greschd added a commit to ansys/pydpf-composites that referenced this issue Apr 19, 2023
Drop support for Python 3.7, and remove it from the tox and
CI/CD configurations.

Upgrade mypy to avoid python/mypy#13499,
and add checks for 'None' to account for newly reported errors.
greschd added a commit to ansys/pydpf-composites that referenced this issue Apr 19, 2023
Drop support for Python 3.7, and remove it from the tox and
CI/CD configurations.

Upgrade mypy to avoid python/mypy#13499,
and add checks for 'None' to account for newly reported errors.
janvonrickenbach added a commit to ansys/pydpf-composites that referenced this issue May 24, 2023
* Bump ansys-sphinx-theme from 0.9.5 to 0.9.6 (#240)

Bumps [ansys-sphinx-theme](https://github.com/ansys/ansys-sphinx-theme) from 0.9.5 to 0.9.6.
- [Release notes](https://github.com/ansys/ansys-sphinx-theme/releases)
- [Commits](ansys/ansys-sphinx-theme@v0.9.5...v0.9.6)

---
updated-dependencies:
- dependency-name: ansys-sphinx-theme
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Remove the poetry workaround for sphinx theme installation (#241)

* Update dpf core version (#243)

* Bump peter-evans/create-or-update-comment from 2 to 3 (#249)

Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 2 to 3.
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](peter-evans/create-or-update-comment@v2...v3)

---
updated-dependencies:
- dependency-name: peter-evans/create-or-update-comment
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump pytest from 7.2.2 to 7.3.0 (#250)

Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.2.2 to 7.3.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@7.2.2...7.3.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Short fiber example: fiber orientation tensor (#233)

* Bump ansys-dpf-core from 0.8.0 to 0.8.1 (#253)

Bumps [ansys-dpf-core](https://github.com/pyansys/pydpf-core) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/pyansys/pydpf-core/releases)
- [Commits](ansys/pydpf-core@v0.8.0...v0.8.1)

---
updated-dependencies:
- dependency-name: ansys-dpf-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump pytest from 7.3.0 to 7.3.1 (#254)

Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.0 to 7.3.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@7.3.0...7.3.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add info to explain switching of doc versions (#256)

Update main index.rst file with minor edits

Note: The display links to other topics should use the same title as the topic. This is a Google developer doc style guideline. Users can be confident that the have been taked to the correct place.

* Drop support for Python 3.7 (#257)

Drop support for Python 3.7, and remove it from the tox and
CI/CD configurations.

Upgrade mypy to avoid python/mypy#13499,
and add checks for 'None' to account for newly reported errors.

* Bump pre-commit from 2.21.0 to 3.2.2 (#259)

Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 2.21.0 to 3.2.2.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](pre-commit/pre-commit@v2.21.0...v3.2.2)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update AWP_ROOT_DOCKER variable (#265)

* Update pre-commit dependencies, remove code obsolete with Python 3.7 drop (#258)

* Update pre-commit dependencies.
* Add and run the `pyupgrade` pre-commit hook.
* Remove `TYPE_CHECKING` guards for `numpy.typing`.
* Set the minimum requirement for `numpy` to `1.22`.

* Add 'build-wheelhouse' job to CI/CD (#264)

* Add 'build-wheelhouse' job to CI/CD

* Rename build-package to build-library, improve dependencies

* Add allow-last-days option to package cleanup

* Bump ansys-sphinx-theme from 0.9.7 to 0.9.8 (#266)

Bumps [ansys-sphinx-theme](https://github.com/ansys/ansys-sphinx-theme) from 0.9.7 to 0.9.8.
- [Release notes](https://github.com/ansys/ansys-sphinx-theme/releases)
- [Commits](ansys/ansys-sphinx-theme@v0.9.7...v0.9.8)

---
updated-dependencies:
- dependency-name: ansys-sphinx-theme
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: janvonrickenbach <jan.vonrickenbach@ansys.com>

* Bump numpy from 1.22.0 to 1.24.3 (#267)

Bumps [numpy](https://github.com/numpy/numpy) from 1.22.0 to 1.24.3.
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](numpy/numpy@v1.22.0...v1.24.3)

---
updated-dependencies:
- dependency-name: numpy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: janvonrickenbach <jan.vonrickenbach@ansys.com>

* Bump pre-commit from 3.2.2 to 3.3.1 (#271)

Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.2.2 to 3.3.1.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](pre-commit/pre-commit@v3.2.2...v3.3.1)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ansys-sphinx-theme from 0.9.8 to 0.9.9 (#273)

Bumps [ansys-sphinx-theme](https://github.com/ansys/ansys-sphinx-theme) from 0.9.8 to 0.9.9.
- [Release notes](https://github.com/ansys/ansys-sphinx-theme/releases)
- [Commits](ansys/ansys-sphinx-theme@v0.9.8...v0.9.9)

---
updated-dependencies:
- dependency-name: ansys-sphinx-theme
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Adapt to organization rename from 'pyansys' to 'ansys' (#276)

Change the following references:
- `github.com/pyansys` -> `github.com/ansys`
- `ghcr.io/pyansys` -> `ghcr.io/ansys`
- `pyansys/actions` -> `ansys/actions`
- `https://codecov.io/gh/pyansys/pydpf-composites` -> `https://codecov.io/gh/ansys/pydpf-composites`

* Adapt to change in Axes with maptlotlib==3.7.1 (#263)

Bump matplotlib to ``3.7.1`` in ``poetry.lock``.

The matplotlib 'Axes' class no longer inherits from 'SubplotBase'
since matplotlib/matplotlib#23573.

This breaks the '_get_subplot' method in 'sampling_point.py' which
checks if the passed 'axes_obj' is a 'SubplotBase' instance to
distinguish between indexable and non-indexable objects.

To fix this, we now use a try-except block to index into the
'axes_obj', and catch the 'TypeError' that is raised if it is
and 'Axes' (as opposed to an array).

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dominik Gresch <dominik.gresch@ansys.com>

* Relax pyvista requirement upper bound (#278)

Allow all pyvista versions `<1` to be used. This is required for
compatibility
with `ansys-fluent-visualization`, which depends on `>=0.39.0`.

* Document docker container from customer portal (#277)

* Support customer portal docker images and update docs

* Remove --server-bin pytest option because it is not working anymore.

* Ignore generated result definitions.

* Update README.rst

* Automatically upload file to server in CompositeModel

* Add 2024_1_pre0 to supported directories.

* Add show function to show sampling point plots

---------

Co-authored-by: Dominik Gresch <greschd@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dominik Gresch <greschd@users.noreply.github.com>
Co-authored-by: Federico Negri <FedericoNegri@users.noreply.github.com>
Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>
Co-authored-by: Dominik Gresch <dominik.gresch@ansys.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant