Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(python-sdk): add ruff linter and code formatter #478

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

evansims
Copy link
Member

@evansims evansims commented Jan 28, 2025

Description

This pull request does not include any functionality changes. It introduces a faster and more streamlined linter and code formatted tool and applies some suggested code formatting rules.

Changes include:

  • Updates the linter and code formatting tools used.

    • Adds the ruff linter and code formatted tool.
    • Removes the (now redundant) pyupgrade, isort, autoflake and black tools.
    • Replaces the previous setup.cfg file with a modern pyproject.toml equivalent.
  • Applies improvements suggested by the tool:

    • Whitespace improvements.
    • Removal of unused imports.
    • Adds __all__ definitions to the __init__.py files as a best practice for exposing the SDK's public API to developer IDEs.
  • Fixes a few minor issues in the examples and unit tests I identified while working on updating things:

    • Fixes the examples' setup.py files using incorrect header comment blocks.
    • Fixes minor issues identified in the example apps, like unused variable assignments.
    • Fixes a duplicately named unit test in api_test, which may have caused test_500_error_retry not to be run as intended.
  • Ensures the partial_header block is imported in all Python source files.

References

Please review DXAZT-368 for additional context.

Generates: openfga/python-sdk#166

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@evansims evansims added the python-sdk Affects the Python SDK label Jan 28, 2025
@evansims evansims marked this pull request as ready for review January 28, 2025 01:52
@evansims evansims requested a review from a team as a code owner January 28, 2025 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python-sdk Affects the Python SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant