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

Substitute plugin #4668

Merged
merged 12 commits into from
Sep 8, 2023
Merged

Substitute plugin #4668

merged 12 commits into from
Sep 8, 2023

Conversation

fdaniele85
Copy link
Contributor

@fdaniele85 fdaniele85 commented Feb 7, 2023

Description

Fixes #2786.

Add the substitute plugin that is a replacement to rewrite plugin. Indeed, rewrite plugin modifies the metadata tags of the file, this plugin does not modify the metadata.

To Do

  • Documentation.
  • Changelog.
  • Tests.

@@ -8,6 +8,7 @@ Changelog goes here!

New features:

* :doc:`/plugins/substitute`: Add the substitute plugin to solve `2786`
Copy link
Contributor

Choose a reason for hiding this comment

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

Please provide a little description of the change introduced and then indicate :bug:2786` as additional information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the description in changelog

Copy link
Member

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

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

Thanks for getting this started!! I have a couple of suggestions in here. The main one is that I think the documentation could use some examples of how to use the plugin (not just how to configure it), and I think it would benefit from merely linking to the rewrite plugin's doc page instead of duplicating text, where there is overlap.

beetsplug/substitute.py Outdated Show resolved Hide resolved
docs/changelog.rst Outdated Show resolved Hide resolved
docs/plugins/substitute.rst Show resolved Hide resolved
docs/plugins/substitute.rst Outdated Show resolved Hide resolved
docs/changelog.rst Outdated Show resolved Hide resolved
docs/plugins/substitute.rst Outdated Show resolved Hide resolved
@JOJ0
Copy link
Member

JOJ0 commented Mar 17, 2023

Hi, I left some wording suggestions whithin. Other than that I read the documentation an I think now it is clear what it does and how it should be used. All the corrections where worth it I guess. Great plugin idea btw! Cool!

I approved the checks to run (required for first-time-contributors) and now you should see how to make the linter happy :-) HTH

@sampsyo
Copy link
Member

sampsyo commented Mar 25, 2023

It looks like the style checker and the docs compilation may need some attention.

@JOJ0
Copy link
Member

JOJ0 commented May 14, 2023

@fdaniele85 this was very close to ready for merge, can I assist with the remaining linting issues? Do you see the errors? Sometimes it's hard to find in the github actions verbose outputs.

@fdaniele85
Copy link
Contributor Author

fdaniele85 commented May 14, 2023 via email

@JOJ0
Copy link
Member

JOJ0 commented May 15, 2023

As a first step, let's addres the flake8 linter issues:

In the list on the very bottom of this PR that says "Some checks were not succesful", click on the "Details" button of the very last entry:

ci / lint (pull_reqest)

You will see the linting errors. Here's a screenshot:

Screenshot 2023-05-15 at 09 23 46

You will find almost all information on how to fix those in PEP8's style guide: https://peps.python.org/pep-0008/

For example, this describes the E302 error: https://peps.python.org/pep-0008/#blank-lines

The D100 and 101 errors are easy to fix as well: Just put a short docstring on top of substitute.py and another one on top of your plugin's class. If you are interested describes it in very longish ways: https://peps.python.org/pep-0257/#specification

What you can also do while fixing them: Run flake8 locally on your plugins' Python file:

pip install flake8
flake8 beetsplug/substitute.py

That should help to check if you were successful fixing before you commit and push and let the beets ci pipeline run again (it takes a couple of minutes to finish, we have a lot of tests and checks ;-)

@fdaniele85
Copy link
Contributor Author

Now I do not get errors executing flake8 beetsplug/substitute.py

@fdaniele85
Copy link
Contributor Author

I see other problems, but this is a screenshot of my flake8
Screenshot from 2023-05-16 15-06-20.

Is there a method to perform the same testing in local?

@sampsyo
Copy link
Member

sampsyo commented May 16, 2023

The current issues are actually with the tests and docs (in addition to the linter, which may just be due to a different version). You can click through on a specific run to see the details!

Screenshot 2023-05-16 at 10 15 35 AM

Currently, the docs builder says:

Error: /home/runner/work/beets/beets/docs/changelog.rst:15:Bullet list ends without a blank line; unexpected unindent.

@JOJ0
Copy link
Member

JOJ0 commented Jul 25, 2023

There's some linter issues left @fdaniele85
image

Hope that helps :-)

@JOJ0
Copy link
Member

JOJ0 commented Aug 4, 2023

Hi @fdaniele85 would it help if I hijack your branch and fix those issues with the docs build? Or is it just a matter of finding time on your end? We are so close to merge-ready here :-)))

@fdaniele85
Copy link
Contributor Author

Hi @fdaniele85 would it help if I hijack your branch and fix those issues with the docs build?

It would be grate @JOJ0!

fdaniele85 and others added 4 commits August 31, 2023 08:04
While rebasing master into this feature branch I removed fdaniele85's
original version(s) of the changelog to make conflict resolvement
easier. This is a slightly extended version of the latest version I
found in the original commits.
in the plugin docs as was discovered in beetbox#2786 (Metadata being modified).
@JOJ0
Copy link
Member

JOJ0 commented Aug 31, 2023

Hi @fdaniele85 would it help if I hijack your branch and fix those issues with the docs build?

It would be grate @JOJ0!

Hi @fdaniele85, I finally found time to take over your branch and fix those linting and docs issues we see in the failed checks. I rebased master into your branch, leaving out the changelog because of many conflicts, I then re-added the changelog with a slightly extended wording. Hope it's according to what you had in mind?

Furthermore since as you discovered in your intial report in #2786 and as @sampsyo and @wisp3rwind elaborate here

#2786 (comment)

#2786 (comment)

I also tried to include a fix of the misleading documentation of the rewrite plugin. I am having a hard time though finding the correct wording and even not sure whether I understood correctly.

Please, the 3 of you, read back this paragraph I drafted and suggest how we could put it to not sound "clumsy" and technically correct: 54efb27

@fdaniele85
Copy link
Contributor Author

@JOJ0 thanks a lot for your updates! They are good to me, I did not well understand why rewrite modifies the tags, but it is important that the documentation reports this behavior as you clarified. For me it is all ok!

@JOJ0 JOJ0 self-assigned this Sep 8, 2023
on whether it modifies metadata or not. Let's also leave a link to the issue
here to make it superclear and researchable for anyone stumbling across it.

Also suggest the substitute plugin as an alternative.
@JOJ0
Copy link
Member

JOJ0 commented Sep 8, 2023

I did a final rewording - probably not perfect english but I guess "good enough" - I also left a link to your initial issue @fdaniele85, as well as a link to this new plugin.

Many thanks for the submission to you and sorry that it took so long; but as so often: In the end it was all worth it :-)

@JOJ0 JOJ0 merged commit 626fce5 into beetbox:master Sep 8, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants