Consolidate packaging into pyproject.toml and adopt ruff#9
Merged
Conversation
Ported from MasoniteFramework/orm#955 (left as draft by the author until the other 3.x PRs landed) and adapted to the current repository state. - All project metadata moves from setup.py to the pyproject [project] table (masonite-framework-orm, cleo 2 pin, masonitedev URLs); setup.py is removed and python -m build is the supported build path (already what the publish workflow runs). - ruff replaces black, isort and flake8 for both linting (E/W/F/I/UP) and formatting; pytest options move from pytest.ini into pyproject. - pre-commit now runs ruff plus standard hygiene hooks; the makefile exposes lint / format / format-check / check targets backed by ruff. Differences from the original draft: line length stays at 79 (matching the existing black formatting, so adopting the formatter is near zero-churn) instead of 110, and E501 stays globally ignored as it was under flake8 because long SQL strings dominate the grammar modules.
…ions Mechanical application of the new tooling (ruff check --fix + ruff format): f-string conversions, import sorting, yield-from, format-spec upgrades and modern annotations in the Model stub. ruff's F811 also flagged real dead code, removed here: - QueryBuilder.get_connection (early stub returning connection_class) and QueryBuilder.get_relation (referenced a nonexistent self.owner) — both shadowed by the real definitions later in the class. - tests/mysql: a duplicated test_can_add_columns_with_foreign_key test whose first (shadowed) variant asserted malformed SQL and an impossible column count, plus User imports shadowed by local model classes in two files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
setup.pyinto thepyproject.toml[project]table (PyPI namemasonite-framework-orm, cleo 2 pin, masonitedev URLs,test/seederextras, both console scripts).setup.pyis deleted;python -m build— already what the publish workflow runs — is the supported build path. Verified locally: the wheel builds and contains all 110 package files plus both entry points.ruffreplaces black, isort, flake8 and flake8-pyproject for linting (E/W/F/I/UP) and formatting. pytest options move frompytest.iniinto pyproject. pre-commit now runs ruff plus standard hygiene hooks. The makefile exposeslint/format/format-check/check, and the CI lint gate picks them up unchanged.yield from, modern annotations in theModel.pyistub.Dead code found by the new linter
ruff's F811 flagged shadowed definitions that were silently dead, removed here:
QueryBuilder.get_connection— an early stub returningconnection_class(not a connection), shadowed by the real cached-connection getter.QueryBuilder.get_relation— referenced a nonexistentself.owner, shadowed by the real implementation.tests.Userand immediately shadowed it with a localUsermodel.Differences from the original draft
ruff formatat 79 is near zero-churn (24 files lightly reformatted vs a full rewrite).force-sort-within-sections) to keep import ordering compatible with the existing style.Tests
Full suite: 1058 passed;
scripts/check_test_asserts.pyclean;ruff checkandruff format --checkpass; wheel build verified.