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

Record difference in translation progress #60

Merged
merged 19 commits into from
Feb 17, 2025
Merged

Record difference in translation progress #60

merged 19 commits into from
Feb 17, 2025

Conversation

StanFromIreland
Copy link
Collaborator

@StanFromIreland StanFromIreland commented Feb 15, 2025

Check out repository from 30 days ago and compare translation progress between the two. This PR adds the data to the json but it's home in the table is up for discussion and to be done in another PR by someone more creative and better at design then me!


📚 Documentation preview 📚: https://pydocs-translation-dashboard--60.org.readthedocs.build/


📊 Dashboard preview 📊: https://python-docs-translations.github.io/dashboard/60/merge/

@m-aciek
Copy link
Collaborator

m-aciek commented Feb 15, 2025

I think that checking out commits from a month ago in CPython and language repos and calculating the progress for back then in the main script loop would be more reliable. This way we don't rely on JSON, and always show exactly one month time window, without “jumps”.

Also I'm thinking we could present it in the main table as a light-green ending of the progress bar.

@m-aciek
Copy link
Collaborator

m-aciek commented Feb 15, 2025

It could be implemented by checking out the month-ago commits after line 72:

completion, translators_data, branch = get_completion(clones_dir, repo)

And then calling get_completion() once again.

@StanFromIreland
Copy link
Collaborator Author

Has the json failed yet? We can store the current progress at the start of the month and then just calculate the difference, it would be a lot faster.

As for html integration I’m looking for suggestions. (Current changes are temporary)

Also we should consider slimming down some columns, it looks not great on mobile.

ideas:
Combine “contribute” and “language “
Replace “in switcher” by a third icon:
X = not built

  • = built but not in switcher
    Tick = in switcher

@m-aciek
Copy link
Collaborator

m-aciek commented Feb 15, 2025

Has the json failed yet? We can store the current progress at the start of the month and then just calculate the difference, it would be a lot faster.

We would introduce a dependency on already generated data, which makes the script less portable. By the way, I plan to remove also such dependency in #58 in favor of using already cloned repositories.

Moving window would not make the difference "reset" at every month beginning, it would express "the same" no matter the day of month. Also in case of changing methodology of calculating the progress in script, the difference wouldn't be confusing.

speed

The repositories are already cloned (with a full depth), the checkouts will be much faster than cloning. Though merging will still happen, so there indeed will be some performance penalty.

@StanFromIreland
Copy link
Collaborator Author

Ok I will convert it then!

@StanFromIreland
Copy link
Collaborator Author

Weird...

...Note: switching to 'HEAD@{30 days ago}'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch comm done.
and. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 60953e2 Wrap branch: 3.12 (#211)

it switches but yet still the completion is calculated the same. Any ideas @m-aciek

@m-aciek
Copy link
Collaborator

m-aciek commented Feb 16, 2025

HEAD is now at 60953e2 Wrap branch: 3.12 (#211)

From logs it looks like it gets the HEAD commit for each clone instead of from month ago for some reason. For example for PL it gets f55af47, which is the latest commit.

@StanFromIreland
Copy link
Collaborator Author

I'll try a different method then.

@StanFromIreland StanFromIreland marked this pull request as ready for review February 16, 2025 17:30
@StanFromIreland
Copy link
Collaborator Author

Everything works now.

I'll merge this an then we can work out where to put this in the ui (we will have more room to work with after #61)

Copy link
Collaborator

@m-aciek m-aciek left a comment

Choose a reason for hiding this comment

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

Thank you for working on it! I've left some comments.

StanFromIreland and others added 2 commits February 16, 2025 23:15
Co-authored-by: Maciej Olko <maciej.olko@gmail.com>
@StanFromIreland
Copy link
Collaborator Author

All done :-)

@StanFromIreland

This comment was marked as outdated.

@m-aciek
Copy link
Collaborator

m-aciek commented Feb 16, 2025

Lint seems to know something we don't

repo is used in the same scope as the argument name, with the str type. We should have a different name for the variable. For example repo_clone.

Index: completion.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/completion.py b/completion.py
--- a/completion.py	(revision 37c6b38c2fafd4d8ffebeed66516cb561fb38001)
+++ b/completion.py	(date 1739748865687)
@@ -26,7 +26,7 @@
     clone_path = Path(clones_dir, repo)
     for branch in branches_from_devguide(Path(clones_dir, 'devguide')) + ['master']:
         try:
-            git.Repo.clone_from(
+            clone_repo = git.Repo.clone_from(
                 f'https://github.com/{repo}.git', clone_path, branch=branch
             )
         except git.GitCommandError:
@@ -49,9 +49,8 @@
 
     if completion:
         # Fetch commit from before 30 days ago and checkout
-        repo = git.Repo(clone_path)
-        commit = next(repo.iter_commits('HEAD', max_count=1, before='30 days ago'))
-        repo.git.checkout(commit.hexsha)
+        commit = next(clone_repo.iter_commits('HEAD', max_count=1, before='30 days ago'))
+        clone_repo.git.checkout(commit.hexsha)
         with TemporaryDirectory() as tmpdir:
             month_ago_completion = potodo.merge_and_scan_path(
                 clone_path,

I also realized we have the repo object earlier in the scope, so we can assign the variable earlier.

@m-aciek m-aciek merged commit d4303e9 into main Feb 17, 2025
3 checks passed
@m-aciek m-aciek deleted the progress-diff branch February 17, 2025 04:36
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