Skip to content

delphi-utils dual-year geocoding files are not being exported in the package #1388

@krivard

Description

@krivard

While testing the jhu indicator on staging I discovered that it doesn't actually run:

[indicators@app-mono-dev-01 jhu]$ env/bin/python -m delphi_jhu
Traceback (most recent call last):
  File "/home/indicators/.pyenv/versions/3.8.2/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/indicators/.pyenv/versions/3.8.2/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/mnt/data/indicators/runtime/jhu/delphi_jhu/__main__.py", line 12, in <module>
    run_module(read_params())  # pragma: no cover
  File "/mnt/data/indicators/runtime/jhu/delphi_jhu/run.py", line 91, in run_module
    gmpr = GeoMapper()
  File "/mnt/data/indicators/runtime/jhu/env/lib/python3.8/site-packages/delphi_utils/geomap.py", line 136, in __init__
    self._load_crosswalk_from_file(from_code,
  File "/mnt/data/indicators/runtime/jhu/env/lib/python3.8/site-packages/delphi_utils/geomap.py", line 145, in _load_crosswalk_from_file
    stream = pkg_resources.resource_stream(__name__, data_path)
  File "/mnt/data/indicators/runtime/jhu/env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1150, in resource_stream
    return get_provider(package_or_requirement).get_resource_stream(
  File "/mnt/data/indicators/runtime/jhu/env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1613, in get_resource_stream
    return open(self._fn(self.module_path, resource_name), 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/data/indicators/runtime/jhu/env/lib/python3.8/site-packages/delphi_utils/data/2020/zip_fips_table.csv'

However I couldn't replicate it in my dev environment until I swapped the editable-install command used by make test for the uneditable-install command used by build-and-package.sh.

Looks like we didn't update the package spec when we added in the 2010/2020 year split:

package_data={'': ['data/*.csv']}

CI didn't catch it because it always uses pip install -e 😭 , and it hasn't shown up as an error in production because Jenkins hasn't actually been deploying releases for quite some time. Thankfully Jenkins is fixed now, but we should:

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions