fix(python-aiohttp): add python_dateutil to the generated requirements so dates are deserialized

Merged
KH
4d ago
+15-0

The python-aiohttp server's generated util.deserialize_date() / deserialize_datetime() import dateutil and return the raw string on ImportError. Its generated requirements.txt and setup.py don't declare python_dateutil, and none of the declared dependencies pull it in. So in a fresh install, date / date-time model properties silently stay strings (for example Order.from_dict({'shipDate': ...}).ship_date is a str). python-flask already declares it (python_dateutil >= 2.6.0), and so does python-blueplanet.

Changes

  • python-aiohttp/requirements.mustache and setup.mustache: add python_dateutil >= 2.6.0, in the same form and position as python-flask.
  • Regenerated samples/server/petstore/python-aiohttp-srclayout (requirements.txt, setup.py). bin/configs/python-aiohttp.yaml is the python client with library: asyncio; it already declares python_dateutil and doesn't change.
  • AbstractPythonConnexionServerCodegenTest: assert that both generated files contain the dependency.

Verification

  • Python*Test / AbstractPython*Test pass. The new test fails without the template change.
  • I created a fresh venv from the regenerated sample's requirements.txt and installed the package. Order.from_dict({'shipDate': '2013-10-20T19:20:30+01:00'}).ship_date is now a datetime. Before, without dateutil, it was the raw string.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    Regenerated the samples for bin/configs/python-aiohttp*.yaml and committed the two changed files. Generator options and docs are unchanged.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

cc @cbornet @tomplus @krjakbrjak @fa0311 (Python technical committee)

Parts of this change were drafted with AI coding assistants (Devin, Claude Code, with reviews by Codex and Fable) and reviewed and verified by me.

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes the python-aiohttp server generator so date and date-time properties are actually deserialized instead of silently staying strings. The generated requirements.txt and setup.py now declare python_dateutil >= 2.6.0, matching python-flask, and the regenerated sample and a new codegen test assert the dependency is present.