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: upgrade psr configuration #812

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

codejedi365
Copy link
Contributor

@codejedi365 codejedi365 commented Oct 13, 2024

Description of change

This change updates PSR to the latest release and provides an improved initial configuration for angular/conventional commit style commits and improved changelog.

Configuration improvements

  • change to changelog update mode (introduced in 9.10), enabling the ability to only insert the latest release changes without re-writing and overwriting any user modification to the changelog for previous releases https://python-semantic-release.readthedocs.io/en/latest/changelog_templates.html#update-mode

  • Added more commit message exclude patterns for the changelog to make the changelog more consumer focused and also hiding Merge commit messages as they are generally not relevant (and not expected to be in conventional commit standards) docs, example

Of note, as PSR does not parse squash commits at this time, the current template & this update's template will not adequately create a changelog that actually identifies all changes within a squash (even when relevant).

Pull-Request Checklist

  • Code is up-to-date with the main branch
  • This pull request follows the contributing guidelines.
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions outlined in the conventional commit spec, such as "fix(api): prevent racing of requests".
  • If pre-commit.ci is failing, try pre-commit run -a for further information.
  • If CI / test is failing, try poetry run pytest for further information.

@codejedi365 codejedi365 force-pushed the feat/upgrade-psr-configuration branch 2 times, most recently from a1278a5 to 5b3e557 Compare October 15, 2024 02:18
@browniebroke
Copy link
Owner

That'sa pretty big change! I'll need some more time to review it. Can you link to the PSR docs with each change you mentioned in your description please? Might help me understand why we're introducing so many new templates. Thanks

@codejedi365
Copy link
Contributor Author

codejedi365 commented Oct 16, 2024

That'sa pretty big change! I'll need some more time to review it. Can you link to the PSR docs with each change you mentioned in your description please?

Don't let the size fool you. It's only new additions of a changelog and config improvement for angular specifically.

It's a copy of the new default changelog which is now modularized into components to make it cleaner to manage with DRY. This modification takes in the adjustment you had originally to only display the first line of a commit message which is why a custom template is needed to override the default.

The template adds some additional logic to handle the "update" mode of PSR that I released in 9.10. It's only 1 true file CHANGELOG.md that is rendered the same as before.

It does also include a release notes template which you didn't have before that now shares the configuration of your version changes that mirror the format of the changelog entries.

I have added a few new goodies which have been asked for but not in the default template yet (it's a much longer testing update, documentation update and multi parser adoption, 2K+ lines). But rest assured yours is tested and it's what I plan to use for PSR itself as it is the goal format for the default.

  • Breaking changes summaries at the bottom of the version

  • PR & MR url linking

  • auto-fitting text to a max-line-length of 100 characters

The reason this is still draft is because the autofit_text_width that I just came up with has not been released yet and will be in v9.12.0. I found a need as I was drafting up the new goal template and you are getting it first.

@codejedi365
Copy link
Contributor Author

Other relevant sections:

@codejedi365 codejedi365 marked this pull request as ready for review October 18, 2024 07:09
@browniebroke
Copy link
Owner

Don't let the size fool you. It's only new additions of a changelog and config improvement for angular specifically.

I'm just conscious that this repo is "just" a project template, which means that these changelog customisations are going to be replicated in generated projects, and will become the responsibility of my users.

My current template, even though it's much simpler, caused some trouble in the PSR repo, so I just need to make sure that the cost of these extra lines are worth it. What happens when PSR changes again in 6 months? Will I need to keep the templates in line? Will my users need to do that too?

I'll try to take a look in the next few days, just wanted to set expectations on where I am now before diving into it.

@codejedi365
Copy link
Contributor Author

I'm just conscious that this repo is "just" a project template, which means that these changelog customisations are going to be replicated in generated projects, and will become the responsibility of my users.

I completely understand, and that is insightful of you to take responsibility for that.

My current template, even though it's much simpler, caused some trouble in the PSR repo, so I just need to make sure that the cost of these extra lines are worth it. What happens when PSR changes again in 6 months? Will I need to keep the templates in line? Will my users need to do that too?

I'm aware as I was the one to solve it for your user. It is only in my best interest as the maintainer of PSR that your template is good because any of your users likely come back to me with questions and bugs of why it's not working.

Ultimately, I would hope in the future you have no custom changelog templates as the default template should be impressively professional. The fact you had to make a custom template because the default was poor is an unfortunate decision of my predecessors. As I said I am giving you the future angular/conventional commits template of PSR so the changes you would need to make in the future should not be many.

When PSR changes in a month or more, I would plan to provide another PR if it was significant.

But the questions you are asking are also the problem of any and all project templates. Updating the resulting projects after being severed from the template is always a challenge (I've done this myself).

Anyway it's your project template, I just figure I would help make the template great but I understand if it's not desired.

@browniebroke
Copy link
Owner

I'm aware as I was the one to solve it for your user.

Oh, I just noticed that! 😄 Thanks for taking the time to help this then. That makes more sense why the customisation is so advanced, you probably know them very well!

@codejedi365
Copy link
Contributor Author

codejedi365 commented Oct 18, 2024

You're welcome, and yes I've become very versed in Jinja in the last few months (specifically for changelog generation)

@codejedi365 codejedi365 force-pushed the feat/upgrade-psr-configuration branch 2 times, most recently from b51e233 to e735a88 Compare October 20, 2024 07:35
@codejedi365
Copy link
Contributor Author

@browniebroke, did you try it out and what did you think of the update mode?

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