Skip to content

Read the data files from the data repository in cxx/data - #28

Merged
jwrosewell merged 7 commits into
rcfrom
feature/data-submodule
Nov 4, 2026
Merged

jwrosewell merged 7 commits into
rcfrom
feature/data-submodule

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

This moves the examples, tests, packaging and CI from the old device-detection-data and ip-intelligence-data repositories to the public data repository. It is step 4 of the run book in 51Degrees/data#1 (version 2), and it moves every link to the old Azure blob storage to the data repository's script or the Distributor.

The data repository reaches this repository through cxx, as the cxx/data submodule. Each free data file there is a <file>.link holding the address it is downloaded from, and get-data-files.ps1 and get-data-files.sh at its root download them.

  1. Submodules. cxx moves to e866f6d3, the 4.5.103 release on cxx main, which carries the cxx change that adds the data submodule (Add the data repository as a submodule and move the examples, tests and CI to it 51degrees-cxx#96). This repository's own ip-intelligence/ip-intelligence-data submodule is removed from .gitmodules and from the index.
  2. Paths. Every cxx/device-detection-data path is now cxx/data/device-detection, in device-detection/ci/fetch-assets.ps1, the device detection on-premise tests, fiftyone_devicedetection/examples/gettingstarted.py and performance.py. Everything that read ip-intelligence/ip-intelligence-data now reads cxx/data/ip-intelligence. That is the translation package's setup.py and resources.py, the on-premise test constants and the IP Intelligence example_utils.py.
  3. Examples download a missing file. The two shared helpers do this, the device detection and IP Intelligence example_utils.py, so no example has its own copy. When a file isn't found and <file>.link is in the data folder, the helper prints the command and runs it. On Windows that is powershell -NoProfile -ExecutionPolicy Bypass -File <data>\get-data-files.ps1 <file> -Source examples-51degrees-python, and elsewhere sh <data>/get-data-files.sh -s examples-51degrees-python <file>. Then it looks again. If the file is still missing, the helper prints the command to run and returns None, and the example prints its own message.
  4. The device detection helper looks in cxx/data/device-detection first. It used to search the whole tree by file name and take the first match. cxx keeps its old device-detection-data submodule for one release. In CI, and in any clone without Git LFS, the files there are Git LFS pointers with the same names. So the helper now checks cxx/data/device-detection, in the working directory and each folder above it, before that search.
  5. Messages and links. The messages that said to update the device-detection-data or ip-intelligence-data submodule now say to get the data submodule with git submodule update --init --recursive and run the example again. The age warnings name the download script. The device detection readme's Git LFS steps are replaced by the script.
  6. Azure blob storage. The IP Intelligence web example and the on-premise readme linked 51ddatafiles.blob.core.windows.net. The web example now looks for 51Degrees-LiteV41.ipi, the name the data repository links the Lite file under, so it downloads the file as the other examples do. LITE_DATAFILE_NAME in fiftyone_ipintelligence_shared changes to that name. Nothing else in the repository uses that constant. The readme gives the script, and gives the Distributor's free download https://distributor.51degrees.com/api/v2/free/ipi-lite-v41 for anyone without a checkout.
  7. The ASN file in CI. 51Degrees-IPIV4AsnIpiV41.ipi was committed to ip-intelligence-data and is now a link. ip-intelligence/ci/fetch-assets.ps1 downloads it with the data repository's script. device-detection/ci/fetch-assets.ps1 runs the script for its folder after linking in the assets, which the script keeps, as cxx does.
  8. CommittedDataFileTests is now AsnDataFileTests. It checks that the downloaded ASN file is present, and fails with the command that gets it if not. Then it checks the engine opens the file. The Distributor always serves the latest ASN file, so the test now fails when the engine can't read the format 51Degrees publishes.
  9. ci/packages.json. The two ExtraPaths entries for the removed submodule are removed rather than renamed. A folder inside cxx never shows in this repository's diffs, so cxx/data/ip-intelligence would match nothing. Naming cxx itself would make a cxx update test only IP Intelligence, because Resolve-AffectedProducts counts a path in a package's folders as touching only that package's product and the products that depend on it. So a cxx update releases neither package, just as it already releases neither on-premise package. AGENTS.md now says so.
  10. Docs. The root README says how to download the files, and tells existing clones to delete the old folders, which Git leaves on disk. AGENTS.md and the product readmes describe the new layout.

The translations in the built package

setup.py copies the YAML files from ../../cxx/data/ip-intelligence/Translations, relative to itself. It still returns early when that folder is missing, because a build from the source distribution has no cxx folder but already holds the files. It still ignores errors while copying, too. So a wrong path would build a package without the YAML files, and give no error.

The new test PackagedTranslationsTests.test_translations_are_packaged checks that the package itself holds countrycodes.en_GB.yml and countries.de_DE.yml. tox builds a wheel and installs it before the tests run, so in the full build this test reads the installed package. The other translation tests can't show this on their own. When the package holds no YAML files, resources.py looks for cxx/data/ip-intelligence/Translations in up to eight folders above the installed package, and that search can reach the checkout.

At e866f6d3, cxx pins data at e448dcf, a commit on data's main. It has ip-intelligence/Translations/countrycodes.en_GB.yml and 16 files in ip-intelligence/Translations/OSM, which is what setup.py copies.

Merging rc into this branch

rc moved on after this branch was made. It took the regenerated SWIG wrappers (#27) and released them in #30, and the nightly submodule update (#26) moved two submodules. The merge commit fd49236 brings those in. Two paths conflicted, both of them submodules.

Path This branch rc Kept
cxx f03dbfd6 1bec7b57, the 4.5.102 release f03dbfd6, then e866f6d3 in the next commit
ip-intelligence/ip-intelligence-data removed b8b3d7d4, moved from b0f0b6af by the nightly removed
  • cxx. f03dbfd6 is 9 commits ahead of 1bec7b57 and none behind, with the same src/ tree (e2adedf2). So it has the 4.5.102 sources rc moved to, plus the data submodule this change needs.
  • ip-intelligence/ip-intelligence-data. The nightly's move only adds .github/workflows/only-rc-into-main.yml to that repository (compare). This change reads the IP Intelligence files from cxx/data/ip-intelligence instead, so the submodule stays removed.

The rest merged without conflict.

After the merge, the tree differs from ce3e12f, this branch's last commit before the merge, only in js_templates. The diff against rc is the same 44 files as before.

The cxx release

cxx released the data submodule change to main in its release pull request (51Degrees/51degrees-cxx#103), as e866f6d3, tagged 4.5.103. The commit after the merge, 5e5ba20, moves cxx from f03dbfd6 to e866f6d3. The two have the same src/ tree (e2adedf2), the same .gitmodules, and the same data (e448dcf), device-detection-data and ip-intelligence-data commits. They differ only in cxx's AGENTS.md, README.md, examples/dd/C/Hash/GettingStarted.c and examples/dd/C/Hash/OfflineProcessing.c. This repository reads only cxx/src and cxx/data, so nothing it builds or reads changes. cxx main now has the data folder, so the nightly submodule update, which moves cxx to the head of cxx main, keeps it.

Order

Nothing has to merge first any more.

  1. The SWIG wrappers change (Generate both SWIG wrappers again for 51degrees-cxx 4.5.102 #27) is merged into rc and released in Release candidate #30.
  2. The cxx change (Add the data repository as a submodule and move the examples, tests and CI to it 51degrees-cxx#96) is released in cxx 4.5.103, and cxx here points at that release.

What was checked

  • The tree was searched for device-detection-data, ip-intelligence-data, 51ddatafiles, blob.core.windows, Git LFS and CommittedDataFile. What remains is the README note for old clones and one code comment about LFS pointers. The two .gitattributes files still mark built .so and .pyd files for Git LFS. No tracked file matches them and they have nothing to do with the data, so they are unchanged.
  • On ce3e12f, git diff --name-only ce3e12f~1 ce3e12f -- cxx lists cxx, and git diff --name-only ce3e12f~1 ce3e12f -- cxx/data/ip-intelligence lists nothing.
  • The cxx commits were compared through the GitHub API. 1bec7b57 (4.5.102), f03dbfd6, cxx rc and e866f6d3 (4.5.103) all have the src/ tree e2adedf2, so the wrappers Generate both SWIG wrappers again for 51degrees-cxx 4.5.102 #27 generated for 4.5.102 still apply. f03dbfd6, cxx rc and e866f6d3 all pin data at e448dcf.
  • common-ci clones with --recurse-submodules and then runs git submodule update --init --recursive, in the configure job that fills the asset cache and in every build job. So cxx/data and its scripts are there when fetch-assets.ps1 runs.
  • Every changed Python file parses, and both fetch-assets.ps1 scripts parse in PowerShell 7. Line endings are unchanged.
  • Nothing was built or tested locally.
  • Two full builds were run from a temporary branch, with common-ci's merge step turned off. Each builds and tests every package on Python 3.10 to 3.14 on Ubuntu, Windows and macOS, 15 legs in all.
  • The test counts in run 41853354039 match the nightly build of Update submodules #26 on rc (run 41807348984) suite by suite on all 15 legs, with the same number of tests skipped in each suite. The one difference is the translation package's tests, 26 passed rather than 25, which is the new test_translations_are_packaged.
  • 5e5ba20 itself has not had a full build. It changes only the cxx pointer, to a commit with the same src/ tree and data as f03dbfd6.

Still to do

Between 4.5.100 and 4.5.102, 51degrees-cxx removed the two
EngineHash process overloads and the three EngineIpi process
overloads that take required property indexes. The committed
wrappers still called them, so neither on-premise package compiled
against 4.5.102, which the nightly submodule update brings in #26.

This moves the cxx submodule from 4110d681, the 4.5.100 release, to
1bec7b57, the 4.5.102 release, and generates hash_python_wrap.cxx,
DeviceDetectionHashEngineModule.py, ipi_python_wrap.cxx and
IpIntelligenceEngineModule.py again with SWIG 4.4.1 built from its
v4.4.1 tag. Run against 4110d681, the same command gives files byte
for byte the same as the ones committed before, so every difference
here comes from cxx. Both engines call only process(evidence), which
cxx keeps.
The examples, tests, packaging and CI now read the data files from
cxx/data/device-detection and cxx/data/ip-intelligence. That is the data
repository, which cxx has as a submodule. They no longer read
cxx/device-detection-data, or this repository's own
ip-intelligence/ip-intelligence-data submodule, which is removed.

- cxx moves to f03dbfd6, the head of its pull request that adds the data
  submodule.
- The examples' shared helpers, the two example_utils.py files, run the
  data repository's script for a linked file that is missing, then look
  again, and print the command if the file is still missing.
- The device detection helper looks in cxx/data/device-detection before
  searching by file name, so it does not pick up an older copy with the
  same name.
- CI downloads the ASN file with the data repository's script, because
  it is now a link rather than a committed file.
- AsnDataFileTests replaces CommittedDataFileTests and checks that the
  downloaded ASN file is present and opens.
- The translation package copies its YAML files from
  cxx/data/ip-intelligence/Translations, and a new test checks that the
  built package holds them.
- The web example and the on-premise readme no longer link the Azure
  blob storage. They use the data repository's script, or the
  Distributor's free download.
- The two ExtraPaths entries for the removed submodule are removed,
  because a folder inside cxx never shows in this repository's diffs.
rc has taken the regenerated SWIG wrappers (#27), release #30 and the
nightly submodule update (#26) since this branch started. This branch
already held the commits of #27, with the same result, so the wrappers
merge cleanly.

- cxx stays at f03dbfd6. rc has 1bec7b57, the 4.5.102 release, and
  f03dbfd6 is 9 commits ahead of it with nothing changed under src/, so
  it has the same sources plus the data submodule.
- ip-intelligence/ip-intelligence-data stays removed. The nightly moved
  it to b8b3d7d4, which only adds a workflow to that repository, and
  this branch reads the IP Intelligence data from cxx/data instead.
- js_templates takes the nightly's move to c773ce22.
cxx moves from f03dbfd6, the head of the cxx change that adds the data
submodule (51Degrees/51degrees-cxx#96), to e866f6d3, the 4.5.103 release
on cxx main that carries it. Both have the same src/ tree and the same
data, device-detection-data and ip-intelligence-data commits, so nothing
this repository builds or reads changes. They differ only in cxx's
AGENTS.md, README.md and two C Hash examples.

The nightly submodule update moves cxx to the head of cxx main, which now
has the data folder.
jwrosewell added a commit that referenced this pull request Nov 4, 2026
#28 moves the examples and tests to the data repository in cxx/data, and
removes ip-intelligence/ip-intelligence-data, and merges before this. The run
steps now give only that layout. The steps and pitfalls for the old data
submodules and Git LFS are gone, and so is the choice between two layouts.

Both examples, run with no argument, look for cxx/data from the folder they
run in upwards and download a missing file, and a path given as the argument
is used as it is. So the Device Detection example now runs with no argument,
and the Lite IP Intelligence file is downloaded before it is given. The Asn
file is a download now, not a committed file. The line endings pitfall is
gone, because the data repository keeps its shell script LF.
@jwrosewell
jwrosewell marked this pull request as ready for review November 4, 2026 17:24
@jwrosewell
jwrosewell merged commit 6732e18 into rc Nov 4, 2026
2 checks passed
@jwrosewell
jwrosewell deleted the feature/data-submodule branch November 4, 2026 17:24
@jwrosewell jwrosewell mentioned this pull request Nov 4, 2026
jwrosewell added a commit that referenced this pull request Nov 4, 2026
Releases what has collected on `rc` since #30:

- [#26](#26) Update submodules
- [#28](#28) Read the data files from the data repository in cxx/data
- [#34](#34) Say in AGENTS.md how to get the data, build and run the examples
- [#35](#35) Point package metadata and package READMEs at the right pages
- [#32](#32) Ask the country property for its no value message in the location example
- [#29](#29) Describe the rc approach to releases in AGENTS.md
- [#31](#31) Check the callback URL before the JavaScript builder writes it
- [#36](#36) Let FlowData and pipelines release native memory, and close them in the tests and examples

## Release note

From [#36](#36):

- `FlowData` and `Pipeline` now have `close()` and work in a `with` statement. Closing a FlowData releases the native results its element data holds. Closing a pipeline closes its flow elements, unless it was built with `auto_close_elements` set to false.
- The on-premise Device Detection and IP Intelligence packages now require `fiftyone_pipeline_core>=4.5.42` and `fiftyone_pipeline_engines>=4.5.42`, the versions this release publishes with `close()`.

## Notes

The cxx submodule moves from [4.5.102](https://github.com/51Degrees/51degrees-cxx/releases/tag/4.5.102) to [4.5.103](https://github.com/51Degrees/51degrees-cxx/releases/tag/4.5.103). That release adds the [data](https://github.com/51Degrees/data) repository at `cxx/data` and changes nothing under `src/`.

No commit asks for a major or minor version change, so the publish moves only patch numbers.

The last release into `main` was #30, merged at 09:23 UTC on 4 November 2026.
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