Skip to content

Type _sympy/functions.py [1/n]#136205

Closed
bobrenjc93 wants to merge 6 commits intogh/bobrenjc93/16/basefrom
gh/bobrenjc93/16/head
Closed

Type _sympy/functions.py [1/n]#136205
bobrenjc93 wants to merge 6 commits intogh/bobrenjc93/16/basefrom
gh/bobrenjc93/16/head

Conversation

@bobrenjc93
Copy link
Contributor

@bobrenjc93 bobrenjc93 commented Sep 17, 2024

Stack from ghstack (oldest at bottom):

Signed-off-by: Bob Ren bobren@fb.com

I was chatting with @jamesjwu about strategies to learn the code and he suggested adding types to some files. This stack of PRs adds types to _sympy/functions.py

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10

Signed-off-by: Bob Ren <bobren@fb.com>

[ghstack-poisoned]
@pytorch-bot pytorch-bot bot added the module: cpu CPU specific problem (e.g., perf, algorithm) label Sep 17, 2024
@pytorch-bot
Copy link

pytorch-bot bot commented Sep 17, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/136205

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (4 Unrelated Failures)

As of commit 8b4a056 with merge base 7755176 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@bobrenjc93 bobrenjc93 added the topic: not user facing topic category label Sep 17, 2024
Signed-off-by: Bob Ren <bobrenfb.com>

I was chatting with jamesjwu about strategies to learn the code and he suggested adding types to some files. This stack of PRs adds types to _sympy/functions.py

cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
@ezyang
Copy link
Contributor

ezyang commented Sep 17, 2024

Meta-comment: typing code that interacts with Sympy is often quite difficult, as Sympy is not very static type friendly. Something to be aware of; sometimes the juice is not worth the squeeze.

Copy link
Contributor

@aorenste aorenste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is meant to completely annotate the types in this file, but if it is you should remove the "mypy: allow-untyped-defs" from the top.

@ezyang
Copy link
Contributor

ezyang commented Sep 17, 2024

Signed-off-by: Bob Ren <bobrenfb.com>

I was chatting with jamesjwu about strategies to learn the code and he suggested adding types to some files. This stack of PRs adds types to _sympy/functions.py

cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
@bobrenjc93
Copy link
Contributor Author

Sorry @ezyang @aorenste I'm still getting used to the GH workflow and didn't mean to publish this PR. My typical workflow is to send draft PRs and only after CI passes, do I publish it. But GH publishes the PR when you add reviewers (which isn't the case in phabricator).

Signed-off-by: Bob Ren <bobrenfb.com>

I was chatting with jamesjwu about strategies to learn the code and he suggested adding types to some files. This stack of PRs adds types to _sympy/functions.py

cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 17, 2024
Signed-off-by: Bob Ren <bobrenfb.com>

ghstack-source-id: 354b3a7
Pull Request resolved: #136205
@aorenste
Copy link
Contributor

Sorry @ezyang @aorenste I'm still getting used to the GH workflow and didn't mean to publish this PR. My typical workflow is to send draft PRs and only after CI passes, do I publish it. But GH publishes the PR when you add reviewers (which isn't the case in phabricator).

You can use the ghstack option --draft to publish as a draft.

@bobrenjc93
Copy link
Contributor Author

Sorry @ezyang @aorenste I'm still getting used to the GH workflow and didn't mean to publish this PR. My typical workflow is to send draft PRs and only after CI passes, do I publish it. But GH publishes the PR when you add reviewers (which isn't the case in phabricator).

You can use the ghstack option --draft to publish as a draft.

That's what I did! But it seems like adding reviewers automatically promotes the PR from draft status to in review.

from .numbers import int_oo


T = TypeVar("T", bound=SupportsFloat)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlikely this TypeVar should be public, should probably begin with _T ('in both variable and name)` so it's not exported.

Copy link
Collaborator

@Skylion007 Skylion007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the nit: glad to see the type ignores disappear.

Copy link
Contributor

@jamesjwu jamesjwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go, but do change T to be private so it's not exported

Signed-off-by: Bob Ren <bobrenfb.com>

I was chatting with jamesjwu about strategies to learn the code and he suggested adding types to some files. This stack of PRs adds types to _sympy/functions.py

cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
@bobrenjc93
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 19, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / win-vs2019-cuda12.1-py3 / build

Details for Dev Infra team Raised by workflow job

Signed-off-by: Bob Ren <bobrenfb.com>

I was chatting with jamesjwu about strategies to learn the code and he suggested adding types to some files. This stack of PRs adds types to _sympy/functions.py

cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10

[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 19, 2024
Signed-off-by: Bob Ren <bobrenfb.com>

ghstack-source-id: 42a3118
Pull Request resolved: #136205
@bobrenjc93
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Sep 20, 2024
Signed-off-by: Bob Ren <bobren@fb.com>

I was chatting with @jamesjwu about strategies to learn the code and he suggested adding types to some files. This stack of PRs adds types to _sympy/functions.py

Pull Request resolved: pytorch#136205
Approved by: https://github.com/Skylion007, https://github.com/jamesjwu
pytorchmergebot pushed a commit that referenced this pull request Sep 20, 2024
Signed-off-by: Bob Ren <bobren@fb.com>

Turns out older versions of python, in particular 3.8 shows errors that 3.12 doesn't. For posterity these are the steps I took to reproduce:

```
conda create -n py38 python=3.8
conda activate py38
pip install -r requirements.txt
lintrunner init
dmypy restart && lintrunner --all-files --take MYPY
```

Pull Request resolved: #136339
Approved by: https://github.com/Skylion007
ghstack dependencies: #136205
@github-actions github-actions bot deleted the gh/bobrenjc93/16/head branch October 20, 2024 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: cpu CPU specific problem (e.g., perf, algorithm) topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants