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

Fix multiple configurations and adhere to scientific python guidelines #3654

Merged
merged 2 commits into from
Dec 23, 2023

Conversation

Saransh-cpp
Copy link
Member

Description

Looks much better now:

saransh@saranshs-air PyBaMM % python3 -m pipx run "sp-repo-review[cli]" .
General:

 • Detected build backend: setuptools.build_meta                                                                                                    
 • Detected license(s): BSD License                                                                                                                 

├── PY001 Has a pyproject.toml ✅
├── PY002 Has a README.(md|rst) file ✅
├── PY003 Has a LICENSE* file ✅
├── PY004 Has docs folder ✅
├── PY005 Has tests folder ✅
├── PY006 Has pre-commit config ✅
└── PY007 Supports an easy task runner (nox or tox) ✅

PyProject:
├── PP002 Has a proper build-system table ✅
├── PP003 Does not list wheel as a build-dep ✅
├── PP301 Has pytest in pyproject ✅
├── PP302 Sets a minimum pytest to at least 6 ✅
├── PP303 Sets the test paths ✅
├── PP304 Sets the log level in pytest ✅
├── PP305 Specifies xfail_strict ✅
├── PP306 Specifies strict config ✅
├── PP307 Specifies strict markers ✅
├── PP308 Specifies useful pytest summary ✅
└── PP309 Filter warnings specified ✅

GitHub Actions:
├── GH100 Has GitHub Actions config ✅
├── GH101 Has nice names ✅
├── GH102 Auto-cancel on repeated PRs ✅
├── GH103 At least one workflow with manual dispatch trigger ✅
├── GH104 Use unique names for upload-artifact ✅
├── GH200 Maintained by Dependabot ✅
├── GH210 Maintains the GitHub action versions with Dependabot ✅
├── GH211 Do not pin core actions as major versions ✅
└── GH212 Require GHA update grouping ✅

Pre-commit:
├── PC100 Has pre-commit-hooks ✅
├── PC110 Uses black or ruff-format ❌
│   Must have https://github.com/psf/black-pre-commit-mirror or https://github.com/astral-sh/ruff-pre-commit + id: ruff-format in                   
│   .pre-commit-config.yaml                                                                                                                         
├── PC111 Uses blacken-docs [skipped]
├── PC140 Uses mypy ❌
│   Must have https://github.com/pre-commit/mirrors-mypy repo in .pre-commit-config.yaml                                                            
├── PC160 Uses codespell ❌
│   Must have https://github.com/codespell-project/codespell repo in .pre-commit-config.yaml                                                        
├── PC170 Uses PyGrep hooks (only needed if RST present) ✅
├── PC180 Uses prettier ❌
│   Must have https://github.com/pre-commit/mirrors-prettier repo in .pre-commit-config.yaml                                                        
├── PC190 Uses Ruff ✅
├── PC191 Ruff show fixes if fixes enabled ✅
└── PC901 Custom pre-commit CI message ✅

MyPy:
├── MY100 Uses MyPy (pyproject config) ❌
│   Must have tool.mypy section in pyproject.toml. Other forms of configuration are not supported by this check.                                    
├── MY101 MyPy strict mode [skipped]
├── MY102 MyPy show_error_codes deprecated [skipped]
├── MY103 MyPy warn unreachable [skipped]
├── MY104 MyPy enables ignore-without-code [skipped]
├── MY105 MyPy enables redundant-expr [skipped]
└── MY106 MyPy enables truthy-bool [skipped]

Ruff:
├── RF001 Has Ruff config ✅
├── RF002 Target version must be set ✅
├── RF003 src directory specified if used [skipped]
├── RF101 Bugbear must be selected ❌
│   Must select the flake8-bugbear B checks. Recommended:                                                                                           
│   
│                                                                                                                                                   
│    [tool.ruff.lint]                                                                                                                               
│    extend-select = [                                                                                                                              
│      "B",  # flake8-bugbear                                                                                                                       
│    ]                                                                                                                                              
│                                                                                                                                                   
├── RF102 isort must be selected ❌
│   Must select the isort I checks. Recommended:                                                                                                    
│   
│                                                                                                                                                   
│    [tool.ruff.lint]                                                                                                                               
│    extend-select = [                                                                                                                              
│      "I",  # isort                                                                                                                                
│    ]                                                                                                                                              
│                                                                                                                                                   
├── RF103 pyupgrade must be selected ✅
├── RF201 Avoid using deprecated config settings ✅
└── RF202 Use (new) lint config section ✅

Documentation:
├── RTD100 Uses ReadTheDocs (pyproject config) ✅
├── RTD101 You have to set the RTD version number to 2 ✅
├── RTD102 You have to set the RTD build image ✅
└── RTD103 You have to set the RTD python version ✅

XRef #3489

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ pre-commit run (or $ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • The documentation builds: $ python run-tests.py --doctest (or $ nox -s doctests)

You can run integration tests, unit tests, and doctests together at once, using $ python run-tests.py --quick (or $ nox -s quick).

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

Copy link

codecov bot commented Dec 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7e72c38) 99.59% compared to head (a704571) 99.59%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3654   +/-   ##
========================================
  Coverage    99.59%   99.59%           
========================================
  Files          258      258           
  Lines        20797    20797           
========================================
  Hits         20712    20712           
  Misses          85       85           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@agriyakhetarpal agriyakhetarpal left a comment

Choose a reason for hiding this comment

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

Thanks, @Saransh-cpp!

pyproject.toml Show resolved Hide resolved
@agriyakhetarpal
Copy link
Member

Some of the notebooks are failing due to an internal nbmake error even on a re-run I triggered, I don't think that's related to any of the changes here though

@Saransh-cpp Saransh-cpp merged commit 691057f into pybamm-team:develop Dec 23, 2023
39 of 41 checks passed
@Saransh-cpp Saransh-cpp deleted the repo-review-1 branch December 23, 2023 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants