Fix time calculation in the PRs script#359
Conversation
zmoon
left a comment
There was a problem hiding this comment.
Oops, sorry about that, and thanks for fixing! We could do it with div-rem math and avoid dateutil, but that would be less clear.
| @@ -3,6 +3,7 @@ | |||
| Requires PyGithub. | |||
There was a problem hiding this comment.
could add python-dateutil to this note? or remove the line, as maybe it won't be necessary after the documentation you mentioned is added
There was a problem hiding this comment.
Yes. I've added requirements.txt which tracks dependencies, but we haven't yet documented this. So for now, I think it's good to mention it here, until it's documented elsewhere.
| Requires PyGithub. | ||
| """ | ||
| import datetime | ||
| from dateutil.relativedelta import relativedelta |
There was a problem hiding this comment.
convention would be to put this after import github, to stress that it is not part of the std lib
There was a problem hiding this comment.
I recommend to just run a formatter (black or similar) over the script.
There was a problem hiding this comment.
Either sounds good. I haven't used formatters before.
There was a problem hiding this comment.
We could add a pre-commit config to do it automatically.
e.g.
# .pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.1.0'
hooks:
- id: check-yaml
- id: trailing-whitespace
args: ['--markdown-linebreak-ext=md,markdown']
- id: end-of-file-fixer
- repo: https://github.com/asottile/reorder_python_imports
rev: 'v2.6.0'
hooks:
- id: reorder-python-imports
- repo: https://github.com/psf/black
rev: '21.12b0'
hooks:
- id: black☝️ Probably as separate PR since the eof check and trailing-whitespace would probably catch other files (if checking the whole repo).
There was a problem hiding this comment.
I ran it through black. Let me know if there's anything else.
|
Maybe the |
|
OK, done, let me know if it's good to go. |
While preparing #357 I found a small issue in the PRs script which manifests only in December. This PR fixes it and adds a requirements.txt file to keep track of the script dependencies.
We should also have a short guide on making a newsletter, which is for another PR.