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

WIP: Use Uv for managing packages and Ruff for code formatter. #534

Merged
merged 12 commits into from
Feb 5, 2025

Conversation

hongquan
Copy link
Member

@hongquan hongquan commented Feb 4, 2025

Summary by Sourcery

Update project dependencies and switch to Ruff for code formatting.

Build:

  • Switch to Uv for managing packages.

CI:

  • Use Ruff for linting and formatting the code.

Tests:

  • Update test dependencies and configuration.

Copy link

sourcery-ai bot commented Feb 4, 2025

Reviewer's Guide by Sourcery

This pull request introduces Uv for package management and Ruff for code formatting, aiming to improve dependency resolution and code consistency. It includes updates to project dependencies, CI configurations, test configurations, and documentation, along with the addition of pre-commit hooks for Ruff.

Flow diagram: Updated development workflow

flowchart TD
    start[Developer starts work] --> uv[Install dependencies with Uv]
    uv --> precommit[Install pre-commit hooks]
    precommit --> code[Write code]
    code --> ruff[Ruff auto-formats & lints]
    ruff --> commit[Commit changes]
    commit --> push[Push to repository]
    push --> ci{CI Pipeline}
    ci -->|Pass| merge[Ready to merge]
    ci -->|Fail| code
Loading

File-Level Changes

Change Details Files
Switched from pip to Uv for dependency management.
  • Replaced pip with Uv in Dockerfile for installing dependencies.
  • Updated GitHub Actions workflows to use Uv for setting up Python and installing dependencies.
  • Added uv.lock file.
pyproject.toml
Dockerfile
.github/workflows/strings.yml
.github/workflows/tests.yml
Integrated Ruff for linting and formatting.
  • Configured Ruff in pyproject.toml with line length, target version, and exclude settings.
  • Replaced flake8 and isort with Ruff in the style check workflow.
  • Added a pre-commit configuration file to run Ruff.
pyproject.toml
.github/workflows/style.yml
.pre-commit-config.yaml
Updated project dependencies in pyproject.toml.
  • Updated versions of Django, djangorestframework, python-dateutil, requests, webauthn, kombu, django-statici18n, bleach, sentry-sdk, stripe, django-i18nfield, psycopg, protobuf, pycryptodome, qrcode, django-allauth and pydantic.
  • Added new dependencies djlint and ruff under the lint group.
  • Added new dependencies pytest-mock, pytest, pytest-django, pytest-env, pytest-mypy, responses, potypo, freezegun, pytest-cache, pytest-cov, pytest-sugar, coveralls, coverage, pytest-rerunfailures and pytest-xdist under the test group.
  • Added new dependencies django-debug-toolbar and pre-commit under the dev group.
  • Added new dependencies sphinx-rtd-theme, sphinx, sphinxcontrib-httpdomain, sphinxemoji, pygments-markdown-lexer, sphinxcontrib-spelling and pyenchant under the doc group.
pyproject.toml
Updated test configurations and dependencies.
  • Modified the test workflow to use different Python versions and databases.
  • Removed eventyay-stripe and eventyay-paypal dependencies from the test workflow installation.
  • Updated pytest configuration in setup.cfg.
.github/workflows/tests.yml
src/setup.cfg
Updated documentation build process.
  • Updated documentation workflow to install system packages and dependencies.
  • Modified doc/conf.py to check for enchant using importlib.util.find_spec instead of try-except.
.github/workflows/docs.yml
doc/conf.py
Improved plugin compatibility checks.
  • Refactored plugin compatibility checks to use packaging.requirements and packaging.version.
  • Simplified compatibility checks and error reporting.
src/pretix/base/plugins.py
Removed unnecessary files and configurations.
  • Removed unnecessary .gitignore files.
  • Removed requirements.txt file.
  • Removed pytest configuration from setup.cfg.
doc/.gitignore
doc/requirements.txt
src/.gitignore
src/tests/.gitignore
src/setup.cfg

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@hongquan hongquan marked this pull request as draft February 4, 2025 04:25
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @hongquan - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please remove the WIP tag from the title when this is ready for review. The changes look good but we want to make sure you consider it complete before doing a full review.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Dockerfile Show resolved Hide resolved
doc/development/setup.rst Outdated Show resolved Hide resolved
@hongquan hongquan marked this pull request as ready for review February 5, 2025 02:41
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @hongquan - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -35,48 +37,66 @@ Your should install the following on your system:
Your local python environment
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): Typo: "Your" should be "You"

Suggested change
Your local python environment
Your Local Python Environment


`uv` automatically creates virtual environment in _.venv_ directory.
If you want to create virtual environment outside the project directory, you can do so with
a different tool and tell `uv` to repspect the activated virtual environment by setting the
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): Typo: "repspect" should be "respect"

Suggested change
a different tool and tell `uv` to repspect the activated virtual environment by setting the
a different tool and tell `uv` to respect the activated virtual environment by setting the

@hongquan
Copy link
Member Author

hongquan commented Feb 5, 2025

The unittest run successfully on localhost (though still having failed cases) but get errors on GH Action. I will merge this PR and try to fix the GH Action later.

@hongquan hongquan merged commit bd47a25 into fossasia:development Feb 5, 2025
3 of 6 checks passed
norbusan added a commit that referenced this pull request Feb 7, 2025
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