Skip to content

Replace flatdict with a helper implementation#453

Closed
enza252 wants to merge 1 commit intozscaler:masterfrom
enza252:feature/implement-directionary-flattening-and-remote-flatdict
Closed

Replace flatdict with a helper implementation#453
enza252 wants to merge 1 commit intozscaler:masterfrom
enza252:feature/implement-directionary-flattening-and-remote-flatdict

Conversation

@enza252
Copy link
Contributor

@enza252 enza252 commented Feb 9, 2026

Description

  • flatdictis an old package which has not received an update or release in nearly 6 years by this point
  • The flatdict dependence on an old version of setuptools is causing build errors in downstream projects.
  • Since this project loosely depends on flatdict, this seems like a quick win to remove the dependence of an old package, and eliminate setuptools build errors
  • These changes were co-written with Claude, so all scrutinty is warranted and appreciated.

Example stack trace from trying to install zscaler-sdk-python with flatdict:

uv sync --dev
Resolved 145 packages in 8ms
  × Failed to build `flatdict==4.0.1`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)

      [stderr]
      Traceback (most recent call last):
        File "<string>", line 14, in <module>
          requires = get_requires_for_build({})
        File "/Users/ian.ensor/.cache/uv/builds-v0/.tmpRC1s8Y/lib/python3.13/site-packages/setuptools/build_meta.py", line 333, in
      get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/ian.ensor/.cache/uv/builds-v0/.tmpRC1s8Y/lib/python3.13/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "/Users/ian.ensor/.cache/uv/builds-v0/.tmpRC1s8Y/lib/python3.13/site-packages/setuptools/build_meta.py", line 520, in run_setup
          super().run_setup(setup_script=setup_script)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/ian.ensor/.cache/uv/builds-v0/.tmpRC1s8Y/lib/python3.13/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 1, in <module>
          import sys
      ModuleNotFoundError: No module named 'pkg_resources'

      hint: This error likely indicates that `flatdict@4.0.1` depends on `pkg_resources`, but doesn't declare it as a build dependency. If `flatdict` is a
      first-party package, consider adding `pkg_resources` to its `build-system.requires`. Otherwise, either add it to your `pyproject.toml` under:

      [tool.uv.extra-build-dependencies]
      flatdict = ["pkg_resources"]

      or `uv pip install pkg_resources` into the environment and re-run with `--no-build-isolation`.
  help: `flatdict` (v4.0.1) was included because `krakenator` (v0.8.4) depends on `zscaler-sdk-python` (v1.9.12) which depends on `flatdict`

Has your change been tested?

  • Existing unit tests are passing
  • New tests added for implemented helpers

Screenshots (if appropriate):

Types of changes

What sort of change does your code introduce/modify?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • This change is using publicly documented and stable APIs.

I appreciate that your CONTRIBUTING docs state that you are not welcoming contributions, however, as a large ZScaler customer, this a pain point for us, and we would appreciate your support in this.

* `flatdict`is an old package which has not received an update or release in nearly 6 years by this point
* The flatdict dependence on an old version of setuptools is causing build errors in downstream projects.
* Since this project loosely depends on flatdict, this seems like a quick win to remove the dependence of
an old package, and eliminate setuptools build errors
* These changes were co-written with Claude, so all scrutinty is warranted and appreciated.
@enza252 enza252 force-pushed the feature/implement-directionary-flattening-and-remote-flatdict branch from f1b224c to 9c57bad Compare February 9, 2026 06:04
@enza252 enza252 marked this pull request as ready for review February 9, 2026 06:33
@willguibr willguibr self-assigned this Feb 11, 2026
@willguibr willguibr added 🐛 type/bug :bug: type/bug documentation Improvements or additions to documentation type/enhancement New feature or request labels Feb 11, 2026
@willguibr willguibr moved this to ⚙️ In development in Zscaler Automation Dashboard 🛣 Feb 11, 2026
@willguibr
Copy link
Member

Hi @enza252 , thank you for taking the time to report this issue and submit a PR — we really appreciate it!

We've addressed this in #457, which replaces flatdict with internal flatten_dict/unflatten_dict helpers (same approach you proposed). Your contribution is credited in the changelog and release notes.
As noted in our README, we're not currently accepting external PRs, but we welcome issue reports and suggestions like yours. Closing this in favor of #457.

Zscaler DevRel

@willguibr willguibr closed this Feb 11, 2026
@github-project-automation github-project-automation bot moved this from ⚙️ In development to 🚀 Shipped in Zscaler Automation Dashboard 🛣 Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 type/bug :bug: type/bug documentation Improvements or additions to documentation type/enhancement New feature or request

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

2 participants