Skip to content

CLI: Optimize generate_clients.py with dirs pruning#4243

Open
MonkeyCanCode wants to merge 2 commits intoapache:mainfrom
MonkeyCanCode:cli_generate_clients_optimize
Open

CLI: Optimize generate_clients.py with dirs pruning#4243
MonkeyCanCode wants to merge 2 commits intoapache:mainfrom
MonkeyCanCode:cli_generate_clients_optimize

Conversation

@MonkeyCanCode
Copy link
Copy Markdown
Contributor

This PR primary optimizes generate_clients.py with dirs pruning by using os.walk as oppose to rglob. The previous code scanned up to 6.4k files path and the updated one will scanned only ~250.

Here is the old output (in verbose mode):

$ python3 generate_clients.py -v
...
test/test_privileges_command.py: skipped (path excluded)
...
templates/header-md.txt: skipped (path excluded)
...
.venv/bin/activate.bat: skipped (path excluded)
...
.venv/lib/python3.11/site-packages/pyroaring.cpython-311-darwin.so: skipped (path excluded)
...
apache_polaris/sdk/catalog/__pycache__/rest.cpython-311.pyc: skipped (extension excluded)
...
apache_polaris/cli/command/__pycache__/__init__.cpython-313.pyc: skipped (extension excluded)

And the new output (in verbose mode) which we skipped a lot of those no-ops dirs/files:

$ python3 generate_clients.py -v
...
apache_polaris/sdk/__init__.py: updated
...
apache_polaris/sdk/management/api/polaris_default_api.py: updated
...

Beside the above change, this PR also addresses couple NITs:

  1. Change dir from test to tests as there is more than one test file now
  2. Skip test dir cleanup logic as that is no longer needed since f0ee460 (as I added --global-property=apiDocs=false,modelDocs=false,modelTests=false,apiTests=false
  3. Cleanup .openapi-generator-ignore as bit to remove default comments and non-existed files

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

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