Skip to content

Conversation

@manics
Copy link
Contributor

@manics manics commented Nov 20, 2023

In most JupyterHub repos we use different defaults, e.g. we using heading-level 3: https://jupyterhub-team-compass.readthedocs.io/en/latest/practices/releases.html

It's normal for people to forget to pass --heading-level=3 when running github-activity.

This PR allows some config to be read from a .githubactivity.json file in the top-level of the Git clone, minimising the number of arguments that are needed. In future this could also make it easier to customise the labels or categories used instead of github-activity having to cater for everyone. Since --since already defaults to the most recent tag this potentially means no arguments would be needed when running github-activity in most cases.

To distinguish between default argparse arguments and CLI flags being explicitly set to the default value all argparse defaults are now set to None, with the actual defaults being set in load_config_and_defaults

To distinguish between default args and CLI args being set to the default value all argparse defaults are set to None, with the actual defaults being set separately
@manics manics changed the title Load argument defaults from .githubactivity.json file Load argument defaults from pyproject.toml [tool.github-activity] Jun 13, 2024
@manics manics marked this pull request as ready for review June 13, 2024 23:44
The args object is modified in place.
"""
try:
with open("pyproject.toml", "rb") as f:
Copy link
Collaborator

@consideRatio consideRatio Jun 14, 2024

Choose a reason for hiding this comment

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

This requires being in the root folder, ideally the UX would be to find the relevant pyproject.toml within the local git repo, possibly inside some parent folder or similar.

Im not sure how other tools reading pyproject.toml config does this, black etc - this is a acceptable initial state of things but i can imagine hickups by assuming this works but running it from docs/ or similar if we start relying on it. Ideally there is a common way to get the git repo local pyproject.toml of relevance to read we can re-use from other tools, but we can proceed with this as well - not a blocker!

Copy link
Collaborator

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

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

Nice!!! A comment about a possible improvement we don't have to go for - ok to merge!

manics added 2 commits June 14, 2024 13:43
This project is written in Python, but it can be used with any GitHub repo, so shouldn't rely on pyproject.toml
@manics manics changed the title Load argument defaults from pyproject.toml [tool.github-activity] Load argument defaults from .githubactivity.json Jun 14, 2024
@manics
Copy link
Contributor Author

manics commented Jun 14, 2024

I've switched to using .githubactivity.json instead of pyproject.toml since this tool is applicable to all GitHub repos, not just Python. I've added logic to only load this from the top of the git checkout (uses git rev-parse --show-toplevel).

Copy link
Collaborator

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

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

Nice!! Time to merge?

@manics
Copy link
Contributor Author

manics commented Jul 1, 2024

@consideRatio I think so!

@consideRatio consideRatio merged commit 67ad197 into executablebooks:main Jul 1, 2024
@manics manics deleted the dot-config branch July 1, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants