Skip to content

Conversation

simpkins
Copy link
Contributor

@simpkins simpkins commented Feb 5, 2021

Stack from ghstack:

Summary:
The _import_c_extension.py finds the right C extension library to use,
and then simply re-exports all of the symbols that it defines.

This adds a _import_c_extension.pyi file with type hints to let type
checkers like Pyre and Mypy know the names of the symbols that will be
re-exported from the C extension.

This does not define all of the symbols provided by the C extension,
but does define all of the symbols necessary to make type checkers happy
about other code in the caffe2/python directory.

Test Plan:
Was able to have Pyre successfully type check the caffe2/python
directory with this stub file plus a few other changes.

Differential Revision: D26271726

Summary:
The `_import_c_extension.py` finds the right C extension library to use,
and then simply re-exports all of the symbols that it defines.

This adds a `_import_c_extension.pyi` file with type hints to let type
checkers like Pyre and Mypy know the names of the symbols that will be
re-exported from the C extension.

This does not define all of the symbols provided by the C extension,
but does define all of the symbols necessary to make type checkers happy
about other code in the `caffe2/python` directory.

Test Plan:
Was able to have Pyre successfully type check the `caffe2/python`
directory with this stub file plus a few other changes.

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Feb 5, 2021

💊 CI failures summary and remediations

As of commit 9a122f3 (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Summary:
The `_import_c_extension.py` finds the right C extension library to use,
and then simply re-exports all of the symbols that it defines.

This adds a `_import_c_extension.pyi` file with type hints to let type
checkers like Pyre and Mypy know the names of the symbols that will be
re-exported from the C extension.

This does not define all of the symbols provided by the C extension,
but does define all of the symbols necessary to make type checkers happy
about other code in the `caffe2/python` directory.

Test Plan:
Was able to have Pyre successfully type check the `caffe2/python`
directory with this stub file plus a few other changes.

Differential Revision: [D26271726](https://our.internmc.facebook.com/intern/diff/D26271726)

[ghstack-poisoned]
Summary:
The `_import_c_extension.py` finds the right C extension library to use,
and then simply re-exports all of the symbols that it defines.

This adds a `_import_c_extension.pyi` file with type hints to let type
checkers like Pyre and Mypy know the names of the symbols that will be
re-exported from the C extension.

This does not define all of the symbols provided by the C extension,
but does define all of the symbols necessary to make type checkers happy
about other code in the `caffe2/python` directory.

Test Plan:
Was able to have Pyre successfully type check the `caffe2/python`
directory with this stub file plus a few other changes.

Differential Revision: [D26271726](https://our.internmc.facebook.com/intern/diff/D26271726)

[ghstack-poisoned]
simpkins added a commit that referenced this pull request Feb 12, 2021
Pull Request resolved: #51767



The `_import_c_extension.py` finds the right C extension library to use,
and then simply re-exports all of the symbols that it defines.

This adds a `_import_c_extension.pyi` file with type hints to let type
checkers like Pyre and Mypy know the names of the symbols that will be
re-exported from the C extension.

This does not define all of the symbols provided by the C extension,
but does define all of the symbols necessary to make type checkers happy
about other code in the `caffe2/python` directory.
ghstack-source-id: 121614356

Differential Revision: [D26271726](https://our.internmc.facebook.com/intern/diff/D26271726/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D26271726/)!
Summary:
The `_import_c_extension.py` finds the right C extension library to use,
and then simply re-exports all of the symbols that it defines.

This adds a `_import_c_extension.pyi` file with type hints to let type
checkers like Pyre and Mypy know the names of the symbols that will be
re-exported from the C extension.

This does not define all of the symbols provided by the C extension,
but does define all of the symbols necessary to make type checkers happy
about other code in the `caffe2/python` directory.

Test Plan:
Was able to have Pyre successfully type check the `caffe2/python`
directory with this stub file plus a few other changes.

Differential Revision: [D26271726](https://our.internmc.facebook.com/intern/diff/D26271726)

[ghstack-poisoned]
simpkins added a commit that referenced this pull request Feb 17, 2021
Pull Request resolved: #51767



The `_import_c_extension.py` finds the right C extension library to use,
and then simply re-exports all of the symbols that it defines.

This adds a `_import_c_extension.pyi` file with type hints to let type
checkers like Pyre and Mypy know the names of the symbols that will be
re-exported from the C extension.

This does not define all of the symbols provided by the C extension,
but does define all of the symbols necessary to make type checkers happy
about other code in the `caffe2/python` directory.
ghstack-source-id: 121916324

Differential Revision: [D26271726](https://our.internmc.facebook.com/intern/diff/D26271726/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D26271726/)!
@facebook-github-bot
Copy link
Contributor

@simpkins merged this pull request in b9f051d.

@facebook-github-bot facebook-github-bot deleted the gh/simpkins/3/head branch February 21, 2021 15:16
xsacha pushed a commit to xsacha/pytorch that referenced this pull request Mar 31, 2021
Summary:
Pull Request resolved: pytorch#51767

The `_import_c_extension.py` finds the right C extension library to use,
and then simply re-exports all of the symbols that it defines.

This adds a `_import_c_extension.pyi` file with type hints to let type
checkers like Pyre and Mypy know the names of the symbols that will be
re-exported from the C extension.

This does not define all of the symbols provided by the C extension,
but does define all of the symbols necessary to make type checkers happy
about other code in the `caffe2/python` directory.
ghstack-source-id: 121916324

Test Plan:
Was able to have Pyre successfully type check the `caffe2/python`
directory with this stub file plus a few other changes.

Confirmed that all of the dependent projects affected by this report no new
pyre issues in sandcastle.

Ran `python test/test_type_hints.py` in the PyTorch github repository and
confirmed it also passes.

Differential Revision: D26271726

Pulled By: simpkins

fbshipit-source-id: 6dbadcf02e0b2cc44a9e3cdabe9291c1250959b4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants