Skip to content

Add option --exclude to audit-translations - #701

Open
CristianCantoro wants to merge 1 commit into
daisy:mainfrom
CristianCantoro:audit-translations-exclude
Open

Add option --exclude to audit-translations#701
CristianCantoro wants to merge 1 commit into
daisy:mainfrom
CristianCantoro:audit-translations-exclude

Conversation

@CristianCantoro

Copy link
Copy Markdown

Hello, I am going over the instructions for validating new translations and I have found useful to add an --exclude option to audit-translations.

This option allow excluding specific files from the audit. In a sense, it does the opposite of what --file does, but --file can be used to specify only a single file.

I have added the following examples in the README.md:

# Exclude a list of files from the audit, note that if you use this option before specifying the
# target language you'll need to use the option terminator (--)
uv audit-translations es --exclude unicode-full.yaml
uv audit-translations es --exclude unicode-full.yaml unicode.yaml
uv audit-translations --exclude unicode-full.yaml -- es

@CristianCantoro CristianCantoro changed the title Add option --exclude to audition-translations Add option --exclude to audit-translations Aug 18, 2026
@CristianCantoro
CristianCantoro force-pushed the audit-translations-exclude branch 5 times, most recently from 60c9ea0 to 0215015 Compare August 18, 2026 15:03
@moritz-gross

moritz-gross commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

sounds good to me. @TimArborealis @AndersEkl what do you think?

@michaldziwisz what is ipdb used for? I've not heard of that package before.
https://pypi.org/project/ipdb/ says it gives access to the IPython debugger, so do you use that in a Jupyter Notebook, or can you run the IPython shell by itself (also haven't done that ever now that I think about it)?
I've used the UI-based debugger built into PyCharm so far, which is automatically set up by PyCharm itself

One idea would be to use uv pip install ipdb to install it so you can use it in your personal workflow, without tracking it in the shared dependencies in pyproject.toml and uv.lock.

@moritz-gross

Copy link
Copy Markdown
Collaborator

and an edge case we might want to to avoid:

it doesn't make sense to use both --file and --exclude in one command from my understanding. argparse seems to support mutually exclusive arguments. does this match how you intend this to work?

@CristianCantoro

CristianCantoro commented Aug 18, 2026

Copy link
Copy Markdown
Author

@moritz-gross wrote:

@michaldziwisz what is ipdb used for? I've not heard of that package before.
[...]
One idea would be to use uv pip install ipdb to install it so you can use it in your personal workflow, without tracking it in the shared dependencies in pyproject.toml and uv.lock.

Sorry, I have added that while I was implementing this feature, I can remove it. I am ok with installing it ad-hoc.

@moritz-gross wrote:

it doesn't make sense to use both --file and --exclude in one command from my understanding. argparse seems to support mutually exclusive arguments. does this match how you intend this to work?

Yes, these two options should be mutually exclusive. I will implement the change now.

@CristianCantoro

Copy link
Copy Markdown
Author

@moritz-gross wrote:

@michaldziwisz what is ipdb used for? I've not heard of that package before. https://pypi.org/project/ipdb/ says it gives access to the IPython debugger, so do you use that in a Jupyter Notebook, or can you run the IPython shell by itself (also haven't done that ever now that I think about it)? I've used the UI-based debugger built into PyCharm so far, which is automatically set up by PyCharm itself

... and to answer your question, ipdb is an interactive debugger, it gives you a similar prompt interface as IPython.

@CristianCantoro
CristianCantoro force-pushed the audit-translations-exclude branch from 0215015 to 25e1b0d Compare August 19, 2026 00:03
@CristianCantoro

Copy link
Copy Markdown
Author

I have made some changes and squashed them:

  1. I have eliminated the dependency on ipdb.
  2. I have made the --file and --exclude options mutually exclusive.
  3. There were another couple of edge case that I have handled.

Non-existing file names passed to --exclude

If the name that gets passed is incorrect or doesn't exist then it has no effect. For example:

uv run translations --exclude do_not_exist.yaml -- es

will have the same effect as:

uv run translations es

The command still runs, but I have added a warning:

⚠ Warning: File to exclude do_not_exist.yaml does not exist.                                                                                                                 

Differentiate between files with the same name in different subdirectories

This was a bug, before I was excluding files based only on their name, so --exclude default.yaml would exclude both default.yaml and SharedRules/default.yaml.

Now, --exclude default.yaml correctly excludes only default.yaml and to exclude SharedRules/default.yaml you have to pass --exclude SharedRules/default.yaml.

@moritz-gross

moritz-gross commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

looks great, I think we're nearly done. we should add a regression test for this:

Now, --exclude default.yaml correctly excludes only default.yaml and to exclude SharedRules/default.yaml you have to pass --exclude SharedRules/default.yaml.

Do you want to, or should? thx for catching this.
I got this tool off the ground pretty quickly when I made it, so now I want to polish and test it as it's getting adopted more.
likely there are a few more of this caliber.

and we need a small fix on uv run audit-translations instead of uv audit-translations in the docs

after this, we're ready I think

@CristianCantoro
CristianCantoro force-pushed the audit-translations-exclude branch from 25e1b0d to 67cc546 Compare August 19, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

2 participants