Skip to content

Fix compatibility with tabulate 0.10.0#107

Merged
rolandwalker merged 4 commits intodbcli:mainfrom
musicinmybrain:tabulate-0.10
Mar 5, 2026
Merged

Fix compatibility with tabulate 0.10.0#107
rolandwalker merged 4 commits intodbcli:mainfrom
musicinmybrain:tabulate-0.10

Conversation

@musicinmybrain
Copy link
Contributor

Description

In tabulate 0.10.0, the tabulate.PRESERVE_WHITESPACE module-scope global variable was replaced with a preserve_whitespace keyword argument to tabulate(). See astanin/python-tabulate@v0.9.0...v0.10.0.

Because tabulate.PRESERVE_WHITESPACE was replaced with a keyword argument but was not removed from the module namespace (even though modifying it no longer has any effect), the only way to check whether we should pass the new preserve_whitespace argument is to examine tabulate.__version__. This required adding a dependency on packaging to parse and compare the version string.

Checklist

  • I've added this contribution to the CHANGELOG.
  • I've added my name to the AUTHORS file (or it's already there).
  • I installed pre-commit hooks (pip install pre-commit && pre-commit install), and ran black on my code. Pre-commit hooks are stale: I don’t have a Python 3.7 interpreter on my system because it is long past end of life. I tried running black without pre-commit, but the only changes it suggested were in places I hadn’t modified.
  • Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)

Because `tabulate.PRESERVE_WHITESPACE` was replaced with a keyword
argument but was not removed from the module namespace (even though
modifying it no longer has any effect), the only way to check whether we
should pass the new `preserve_whitespace` argument is to examine
`tabulate.__version__`. This required adding a dependency on `packaging`
to parse and compare the version string.
@musicinmybrain musicinmybrain changed the title Tabulate 0.10 Fix compatibility with tabulate 0.10.0 Mar 5, 2026
@rolandwalker
Copy link
Contributor

Hi! Thanks! Is requiring the newest tabulate an option?

@musicinmybrain
Copy link
Contributor Author

Hi! Thanks! Is requiring the newest tabulate an option?

Sure, if it works for you. It would certainly be simpler.

@musicinmybrain
Copy link
Contributor Author

This PR now requires tabulate>=0.10.0, so it doesn’t need to add a packaging dependency.

@rolandwalker rolandwalker merged commit 40d0b86 into dbcli:main Mar 5, 2026
2 checks passed
@rolandwalker
Copy link
Contributor

Sorry about the commit hooks! This whole repo needs a refresh.

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.

2 participants