Skip to content

Test the examples against the packages published on PyPI - #294

Merged
jwrosewell merged 2 commits into
rcfrom
build/examples-vs-published-packages
Dec 1, 2026
Merged

jwrosewell merged 2 commits into
rcfrom
build/examples-vs-published-packages

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What changed

A new workflow, Examples vs Published Packages, with one job, "examples vs published packages". It runs the examples' own tests against the packages on PyPI:

  1. It checks that _51DEGREES_RESOURCE_KEY_BESPOKE, _51DEGREES_LICENSE_KEY_BESPOKE and _51DEGREES_LICENSE_KEY are available, and fails naming any that is not. A pull request from a fork gets a warning and nothing runs.
  2. It fetches the four free data files (51Degrees-LiteV4.1.hash, 20000 Evidence Records.yml, 51Degrees-IPIV4AsnIpiV41.ipi, 51Degrees-LiteIpiV41.ipi) with common-ci's fetch-assets action and the day's Actions cache, and TAC-HashV41.hash with the data license from LICENSE_KEY_V4TAC_IPIV4ENTERPRISE, not cached because it is licensed. The Device Detection tests of the data file update example serve a copy of the TAC file. Each file goes into cxx/data under the name the data repository saves it as, and a missing file fails the job.
  3. It pins every package ci/packages.json marks for publishing (16 today) to the version given when the workflow is run by hand, or otherwise to each package's latest version on PyPI, installs them from PyPI, then installs the three examples packages from this checkout with -c on the same pins, and runs pip check. The two on-premise packages are built from their source distributions, as on a customer's machine.
  4. It checks that each published package was installed from PyPI (no direct_url.json), at the pinned version, and is imported from site-packages.
  5. It runs pytest --continue-on-collection-errors in device-detection/fiftyone_devicedetection_examples, ip-intelligence/fiftyone_ipintelligence_examples and pipeline/fiftyone_pipeline_cloudrequestengine/examples, and fails on a failed test, a module that cannot be imported, a package where no test ran, or any skipped test, printing each skip's reason. The tests marked staging are left out, because only the Cloud Human Confidence workflow is given the staging cloud (ci/key-names.Tests.ps1 holds that rule). The versions and the totals per package go in the run summary.

It runs by hand (gh workflow run "Examples vs Published Packages" --ref <branch> once the file is on main), after each run of Publish or Nightly Pipeline that was not cancelled, and on a pull request that changes the workflow file. It does not run on other pull requests, because an example that needs a change not yet released fails until the release.

Why

No CI check ran the examples against what customers install from PyPI, so packages that do not work together, or that leave out something the examples need, would only be found after a release. The job follows the "examples vs published crates" job in the Rust repository.

How it was checked

  • ci/check-environment-variable-names.ps1 passes with the new file tracked.
  • The Pester tests in ci/key-names.Tests.ps1, ci/check-environment-variable-names.Tests.ps1 and ci/free-threaded-python.Tests.ps1: 246 passed, none failed. The CI script tests, Environment variable names, UTM link lint and Only rc into main checks pass on this pull request.
  • Run 46607827709, on 8e261c6, against the latest versions on PyPI today, which are 4.5.x: fiftyone-pipeline-core 4.5.43, -engines 4.5.43, -engines-fiftyone 4.5.44, -cloudrequestengine 4.5.44, -translation 4.5.43, -did 4.5.44, fiftyone-devicedetection-shared 4.5.102, -cloud, -onpremise and fiftyone-devicedetection 4.5.103, fiftyone-location 4.5.10, fiftyone-ipintelligence-shared 4.5.3, -cloud, -onpremise and fiftyone-ipintelligence 4.5.4, fiftyone-ipintelligence-translation 4.5.2. Every step up to the tests passed: data files in place, all 16 installed from PyPI and built where needed, pip check clean, each imported from site-packages. The test step failed as expected, because the examples on rc use changes that are not on PyPI yet. No test skipped.
Examples Tests Passed Failed Errors Skipped
fiftyone_devicedetection_examples 110 101 9 0 0
fiftyone_ipintelligence_examples 54 47 5 2 0
fiftyone_pipeline_examples 77 75 0 2 0

Each failure, with the change on rc that the published package does not have:

  1. fiftyone_ipintelligence_cloud.countries_translation_cloud is not in fiftyone-ipintelligence-cloud 4.5.4, so tests/test_countries_cloud_without_key.py and tests/test_find_out_more.py cannot be imported and test_examples.ExampleTests.test_cloud_countries_console fails (ModuleNotFoundError).
  2. fiftyone_pipeline_cloudrequestengine.humanconfidence is not in fiftyone-pipeline-cloudrequestengine 4.5.44, so tests/test_cloud_humanconfidence_web.py and tests/test_cloud_humanconfidence_web_offline.py cannot be imported.
  3. The on-premise engines in fiftyone-devicedetection-onpremise 4.5.103 and fiftyone-ipintelligence-onpremise 4.5.4 register their data file only when an automatic update or the file system watcher is on. The data file update example turns them all off for its programmatic update, so engine.data_file is None and fiftyone-pipeline-engines 4.5.43 raises AttributeError: 'NoneType' object has no attribute 'download'. "Keep the engine's data file so a programmatic update works" (Keep the engine's data file so a programmatic update works, and show one in the data file update example #223) is on rc only. That is test_onpremise_datafileupdate_programmatic and test_examples_without_settings...test_datafileupdate_console in both examples packages.
  4. fiftyone-pipeline-core 4.5.43 places usage sharing second rather than last ("Run usage sharing last and refuse a Pipeline that puts it elsewhere" is on rc only), so the two test_usage_sharing_last tests in each examples package fail on the element order.
  5. Asking for the product of the data file in use (FIX: Ask for the product of the data file in use when a license key holds several #268) and repeating the update request with the product (FIX: Repeat the update request with the product, as the specification says #270) are on rc only, not in fiftyone-pipeline-engines 4.5.43 or fiftyone-devicedetection-onpremise 4.5.103, and test_onpremise_datafileupdate_console_without_product fails with Auto update failed: UpdateStatus.AUTO_UPDATE_HTTPS_ERR against the test's stand-in Distributor.
  6. The four test_cloud_lookups_without_hardware...when_the_cloud_fails_once tests expect the hardware lookup examples to ask for the accessible properties again after one failed request. With fiftyone-devicedetection-cloud 4.5.103 and fiftyone-pipeline-cloudrequestengine 4.5.44 the example ends with CloudRequestException('Error returned from 51Degrees cloud service: ["The service is failing."]') instead.

The first run, on a022acd (run 46601762739, three attempts), showed the two gaps the second commit closes: the TAC file was missing, and a module that could not be imported stopped pytest before any test in that package ran. Its first two attempts failed fetching 51Degrees-LiteV4.1.hash, because the download from the Distributor stalled for GitHub's runners at 07:51 and 08:00 UTC. The data repository's get-data-files.ps1 (line 194) then reports Error formatting a string in place of its stall message, because the -f arguments are passed as two arguments to TimeoutException::new.

Outstanding

  • The job has not yet run against 4.6.2, which is not on PyPI. Once it is, run it by hand or let the run after Publish check it.
  • The stall message in the data repository's get-data-files.ps1 needs fixing there.

Nothing in CI ran the examples against the packages customers install
from PyPI, so a release whose packages do not work together, or that
leaves out something the examples need, was only found by a customer.

The new workflow, Examples vs Published Packages, installs every package
ci/packages.json marks for publishing from PyPI, each pinned to the
version given when the workflow is run by hand or otherwise to its latest
version, and takes only the three examples packages and their tests from
this checkout. It checks that each published package was installed from
PyPI at the pinned version, then runs the tests of the Device Detection,
IP Intelligence and Pipeline examples on the free data files, with the
resource key and licence keys the cloud tests read. A missing key, a
missing data file or a skipped test fails the run, because a run that
skips has checked nothing. The tests marked staging are left out, as only
the Cloud Human Confidence workflow is given the staging cloud.

It runs by hand, after each run of Publish or Nightly Pipeline that was
not cancelled, and on a pull request that changes the workflow.

Checked with ci/check-environment-variable-names.ps1 and the Pester tests
in ci/key-names.Tests.ps1, ci/check-environment-variable-names.Tests.ps1
and ci/free-threaded-python.Tests.ps1, 246 passed and none failed.
The first run against the packages on PyPI
(https://github.com/51Degrees/51degrees-python/actions/runs/46601762739,
attempt 3) showed two gaps in the job.

The Device Detection tests of the data file update example serve a copy
of TAC-HashV41.hash, and failed with "TAC-HashV41.hash is missing". The
job now fetches it with common-ci's fetch-assets action and the data
license from LICENSE_KEY_V4TAC_IPIV4ENTERPRISE, without keeping it in the
Actions cache because it is licensed, and puts it in
cxx/data/device-detection.

A test module that could not be imported stopped pytest before any test
of that package ran, so the IP Intelligence and Pipeline examples gave
no totals. pytest now runs with --continue-on-collection-errors, which
still fails the job on each module that cannot be imported.

Checked with ci/check-environment-variable-names.ps1 and the Pester tests
in ci/key-names.Tests.ps1, ci/check-environment-variable-names.Tests.ps1
and ci/free-threaded-python.Tests.ps1, 246 passed and none failed.
@jwrosewell
jwrosewell marked this pull request as ready for review December 1, 2026 08:41
@jwrosewell
jwrosewell merged commit 0026dd6 into rc Dec 1, 2026
5 of 6 checks passed
@jwrosewell
jwrosewell deleted the build/examples-vs-published-packages branch December 1, 2026 10:38
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