Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Fix time calculation in the PRs script#359

Merged
milancurcic merged 5 commits into
fortran-lang:masterfrom
milancurcic:fix-time-in-prs-script-2
Apr 1, 2022
Merged

Fix time calculation in the PRs script#359
milancurcic merged 5 commits into
fortran-lang:masterfrom
milancurcic:fix-time-in-prs-script-2

Conversation

@milancurcic

Copy link
Copy Markdown
Member

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.

@milancurcic milancurcic added the bug Something isn't working label Jan 1, 2022
@milancurcic milancurcic requested a review from zmoon January 1, 2022 17:55

@zmoon zmoon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread _scripts/prs.py
@@ -3,6 +3,7 @@
Requires PyGithub.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Comment thread _scripts/prs.py
Requires PyGithub.
"""
import datetime
from dateutil.relativedelta import relativedelta

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

convention would be to put this after import github, to stress that it is not part of the std lib

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I recommend to just run a formatter (black or similar) over the script.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Either sounds good. I haven't used formatters before.

@zmoon zmoon Jan 3, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I ran it through black. Let me know if there's anything else.

@zmoon

zmoon commented Mar 21, 2022

Copy link
Copy Markdown
Member

Maybe the requirements.txt should go inside the _scripts directory?

@milancurcic

Copy link
Copy Markdown
Member Author

OK, done, let me know if it's good to go.

@milancurcic milancurcic merged commit 886fcf9 into fortran-lang:master Apr 1, 2022
@milancurcic milancurcic deleted the fix-time-in-prs-script-2 branch April 1, 2022 21:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants