Skip to content

Keep the module level REFRESH_TRIES readable, deprecated - #230

Merged
jwrosewell merged 2 commits into
rcfrom
fix/restore-refresh-tries
Nov 16, 2026
Merged

jwrosewell merged 2 commits into
rcfrom
fix/restore-refresh-tries

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

The problem

The engines package gave REFRESH_TRIES at module level in fiftyone_pipeline_engines.datafile_update_service, with the value 1, and read it there to build the message for a failed refresh. #220 moved the tries to DataFileUpdateService.REFRESH_TRIES, raised the number to 10 and left no name at module level, so from fiftyone_pipeline_engines.datafile_update_service import REFRESH_TRIES works on the last release and raises ImportError on rc.

Nothing in this repository reads the module level name, so nothing here noticed. An application that read it does.

The rule

A patch release never removes or renames a public name. The old name stays for at least one release, deprecated and pointing at the new one, which is why the environment variable names of this release each keep their old form as a fallback. The name is public whatever reads it, so the rule holds even though no code here does.

What changed

datafile_update_service.py gains a module __getattr__ that gives REFRESH_TRIES with a DeprecationWarning naming DataFileUpdateService.REFRESH_TRIES, which holds the tries the service makes. The value it gives is 1, the value the module gave it, and the warning says plainly that it is not the tries the service makes, so a reader of the old name is not told something false either way.

This is the pattern already in the repository for the 51Did layout names (#174, fod_id.py), and it means:

  • module.REFRESH_TRIES and from ... import REFRESH_TRIES both read, each with one warning reported against the line that read the name.
  • the module keeps no attribute of that name, so dir(), vars() and the tools that list a module's names do not offer it, and the package itself never reads it that way.
  • any other name the module does not hold is still missing in the usual way, with no warning.

A bare REFRESH_TRIES = 1 would have restored the import, but it can carry no deprecation, so nothing would tell an application to move to the new name before it is removed.

The tests

pipeline/fiftyone_pipeline_engines/tests/test_public_names.py, five tests. Two of them fail without the fix, which are the from-import and the attribute read. The other three hold the rest of the behaviour and pass either way, which is on purpose, because the point of the file is the whole of the name's behaviour and not only the part that was broken.

Runs

  • Red, the tests alone at 6102da4b, is run 43857464367, failed. All ten Build and Test jobs failed, every Setting 'PullRequestSha' line reads 6102da4, and the only two FAILED lines in the whole log are the two new tests, with "ImportError: cannot import name 'REFRESH_TRIES'" and "AttributeError: module ... has no attribute 'REFRESH_TRIES'".
  • Green and full build, the head 60d98250, is run 43861636335, green, with 12 jobs a success and 2 skipped. Every one of its 11 Setting 'PullRequestSha' lines reads that head, and Configure printed "Left out 5 macOS entries".

macOS was left out of this draft's full build. The rc head is built with macOS before it merges into main.

What remains

The name is deprecated, not removed, so a later release that is allowed to remove a public name takes out the __getattr__, the two private names beside it and this file's tests. Nothing else is outstanding.

The engines package published REFRESH_TRIES at module level in
fiftyone_pipeline_engines.datafile_update_service, and a release removes
no public name, so the name still reads with the value it was given and a
DeprecationWarning that names DataFileUpdateService.REFRESH_TRIES, which
holds the tries the service makes.
The engines package gave REFRESH_TRIES at module level in
fiftyone_pipeline_engines.datafile_update_service, and the tries the
service makes are now DataFileUpdateService.REFRESH_TRIES, so the import
stopped working. A release removes no public name, so the module gives
the old name again through __getattr__, with the value it had and a
DeprecationWarning that names the new one. The module keeps no attribute
of that name, so dir(), vars() and the tools that list a module's names
do not offer it, and the package never reads it that way.
@jwrosewell
jwrosewell marked this pull request as ready for review November 16, 2026 15:54
@jwrosewell
jwrosewell merged commit 3b07802 into rc Nov 16, 2026
3 checks passed
@jwrosewell
jwrosewell deleted the fix/restore-refresh-tries branch November 16, 2026 15:55
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.

1 participant