More OSS cleanup#31
Merged
akshayjshah merged 20 commits intomainfrom Jul 10, 2023
Merged
Conversation
Recipe dependencies are run in dependency order, but otherwise don't have any guaranteed ordering. To make sure that `make -j 4 generate` retains license headers, we need to explicitly invoke `buf generate`, then add license headers. (Recursive make is generally evil, but this simple use case is innocuous enough.)
Add the comments so that user-facing Make targets are included in `make help`.
Especially with type hints, modern Python most commonly uses 120-char lines. This is also the default when using Hatch to create new projects.
Change the Makefile and Pipfile to install lint and formatting tools in the virtual environment, rather than dropping them into the host system. Along the way, tighten the lint settings, add a Make target for linting, and unify the target for unit and integration tests.
Python developers often don't have Go or make installed, so they may not be able to use the Makefile without some additional guidance.
Our license header tool and black don't agree about whether comment-only __init__.py files should have a trailing newline or now. Refactor the Makefile to stay DRY, but allow black to own the final formatting decisions.
Manually use isort to resort imports, considering the `protovalidate` and `buf` modules to be first-party code. This is a pre-factoring: later in this stack of commits, we'll automate this sort with ruff.
Python style is to use `snake_case` for function and method names. Later in this stack of commits, we'll enforce this with `ruff`.
Fix errors in constraint.py (bypassing spurious ones). Later in this stack of commits, ruff will require these fixes.
Bypass some spurious warnings in string_format.py.
Bypass spurious lint errors in validator.py.
Configure ruff to catch a wider variety of unidiomatic and error-prone patterns.
There's no reason to use the wordy xUnit-style `unittest`: we're using `pytest`, which supports a more Pythonic approach.
Use the Makefile in CI, rather than scripting directly in the YAML files. Also, ensure that the Go compiler is up-to-date in CI.
elliotmjackson
approved these changes
Jul 10, 2023
Contributor
elliotmjackson
left a comment
There was a problem hiding this comment.
it all looks straight forward to me
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.
This PR does some more housekeeping before we make the project public. Most notably, it
buf generateandlicense-header, so thatmake -j4 generatedoesn't remove all the licenses.Hopefully these changes are relatively uncontroversial! If anything looks off, let's discuss next week.