Repository navigation
Test the examples against the packages published on PyPI - #294
Merged
Merged
Conversation
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
marked this pull request as ready for review
December 1, 2026 08:41
This was referenced Dec 1, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
_51DEGREES_RESOURCE_KEY_BESPOKE,_51DEGREES_LICENSE_KEY_BESPOKEand_51DEGREES_LICENSE_KEYare available, and fails naming any that is not. A pull request from a fork gets a warning and nothing runs.51Degrees-LiteV4.1.hash,20000 Evidence Records.yml,51Degrees-IPIV4AsnIpiV41.ipi,51Degrees-LiteIpiV41.ipi) with common-ci'sfetch-assetsaction and the day's Actions cache, andTAC-HashV41.hashwith the data license fromLICENSE_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 intocxx/dataunder the name the data repository saves it as, and a missing file fails the job.ci/packages.jsonmarks 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-con the same pins, and runspip check. The two on-premise packages are built from their source distributions, as on a customer's machine.direct_url.json), at the pinned version, and is imported from site-packages.pytest --continue-on-collection-errorsindevice-detection/fiftyone_devicedetection_examples,ip-intelligence/fiftyone_ipintelligence_examplesandpipeline/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 markedstagingare left out, because only the Cloud Human Confidence workflow is given the staging cloud (ci/key-names.Tests.ps1holds 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 onmain), 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.ps1passes with the new file tracked.ci/key-names.Tests.ps1,ci/check-environment-variable-names.Tests.ps1andci/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.pip checkclean, each imported from site-packages. The test step failed as expected, because the examples onrcuse changes that are not on PyPI yet. No test skipped.Each failure, with the change on
rcthat the published package does not have:fiftyone_ipintelligence_cloud.countries_translation_cloudis not in fiftyone-ipintelligence-cloud 4.5.4, sotests/test_countries_cloud_without_key.pyandtests/test_find_out_more.pycannot be imported andtest_examples.ExampleTests.test_cloud_countries_consolefails (ModuleNotFoundError).fiftyone_pipeline_cloudrequestengine.humanconfidenceis not in fiftyone-pipeline-cloudrequestengine 4.5.44, sotests/test_cloud_humanconfidence_web.pyandtests/test_cloud_humanconfidence_web_offline.pycannot be imported.engine.data_fileisNoneand fiftyone-pipeline-engines 4.5.43 raisesAttributeError: '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 onrconly. That istest_onpremise_datafileupdate_programmaticandtest_examples_without_settings...test_datafileupdate_consolein both examples packages.rconly), so the twotest_usage_sharing_lasttests in each examples package fail on the element order.rconly, not in fiftyone-pipeline-engines 4.5.43 or fiftyone-devicedetection-onpremise 4.5.103, andtest_onpremise_datafileupdate_console_without_productfails withAuto update failed: UpdateStatus.AUTO_UPDATE_HTTPS_ERRagainst the test's stand-in Distributor.test_cloud_lookups_without_hardware...when_the_cloud_fails_oncetests 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 withCloudRequestException('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'sget-data-files.ps1(line 194) then reportsError formatting a stringin place of its stall message, because the-farguments are passed as two arguments toTimeoutException::new.Outstanding
get-data-files.ps1needs fixing there.