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

feat: Enable typehints in pre-commit and add typehints to readxml #1934

Merged
merged 27 commits into from
Aug 12, 2022

Conversation

kratsg
Copy link
Contributor

@kratsg kratsg commented Aug 11, 2022

Description

This will need to be rebased again on top of master once #1909 is merged in.

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* Add mypy to pre-commit.
* Add typehints to readxml.
* Enable typing for the pyhf package.
* Add nearly all other files to mypy.overrides.

@kratsg kratsg added CI CI systems, GitHub Actions feat/enhancement New feature or request pre-commit Related to pre-commit hooks labels Aug 11, 2022
@kratsg kratsg self-assigned this Aug 11, 2022
@kratsg kratsg changed the base branch from master to feat/xml2jsonAbsPath August 11, 2022 02:36
@kratsg kratsg changed the base branch from feat/xml2jsonAbsPath to master August 11, 2022 02:37
@codecov
Copy link

codecov bot commented Aug 11, 2022

Codecov Report

Merging #1934 (54b6426) into master (3295d86) will increase coverage by 0.03%.
The diff coverage is 98.42%.

@@            Coverage Diff             @@
##           master    #1934      +/-   ##
==========================================
+ Coverage   98.19%   98.22%   +0.03%     
==========================================
  Files          68       69       +1     
  Lines        4365     4441      +76     
  Branches      734      749      +15     
==========================================
+ Hits         4286     4362      +76     
  Misses         46       46              
  Partials       33       33              
Flag Coverage Δ
contrib 25.80% <1.57%> (-0.45%) ⬇️
doctest 60.99% <65.35%> (+0.49%) ⬆️
unittests-3.10 96.10% <96.85%> (+0.02%) ⬆️
unittests-3.7 96.09% <96.85%> (+0.02%) ⬆️
unittests-3.8 96.12% <96.85%> (+0.02%) ⬆️
unittests-3.9 96.14% <96.85%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pyhf/typing.py 97.18% <97.18%> (ø)
src/pyhf/readxml.py 96.37% <100.00%> (+1.16%) ⬆️
src/pyhf/schema/validator.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@matthewfeickert matthewfeickert left a comment

Choose a reason for hiding this comment

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

Thanks for this nice work moving us towards typehints @kratsg! This looks good overall, I just have a few questions on pre-commit and then some suggestions (that can be ignored it you don't like them) that are simply reordering of imports to mitigate the amount of noise if we eventually turn on isort in pre-commit.

.pre-commit-config.yaml Outdated Show resolved Hide resolved
.pre-commit-config.yaml Show resolved Hide resolved
.pre-commit-config.yaml Show resolved Hide resolved
setup.cfg Show resolved Hide resolved
src/pyhf/readxml.py Outdated Show resolved Hide resolved
src/pyhf/readxml.py Outdated Show resolved Hide resolved
src/pyhf/typing.py Outdated Show resolved Hide resolved
@kratsg kratsg merged commit 85aa4b6 into master Aug 12, 2022
@kratsg kratsg deleted the feat/readxmlTyping branch August 12, 2022 06:04
@kratsg kratsg mentioned this pull request Aug 12, 2022
kratsg pushed a commit that referenced this pull request Aug 12, 2022
* Set the lower bound of the supported typing_extensions versions to v3.7.4
  as TypedDict was added in v3.7.4.

  > The typing_extensions module contains both backports of these changes as
  > well as experimental types that will eventually be added to the typing module,
  > such as Protocol or TypedDict.
   - c.f. https://pypi.org/project/typing-extensions/3.7.4/

   - Amends PR #1934
* Add typing-extensions==3.7.4 to tests/constraints.txt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI CI systems, GitHub Actions feat/enhancement New feature or request pre-commit Related to pre-commit hooks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add mypy to pre-commit checks
2 participants