-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add Ruff workflow generation and uv support #499
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,8 @@ class WorkflowSettings(BaseModel): | |
| include_autopep8: bool = Field(default=False, description="Include autopep8 formatter workflow.") | ||
| include_fix_pep8: bool = Field(default=False, description="Include fix-pep8 command workflow.") | ||
| include_pypi: bool = Field(default=False, description="Include PyPI publish workflow.") | ||
| include_ruff: bool = Field(default=False, description="Include Ruff linter and formatter workflow.") | ||
| use_uv: bool = Field(default=False, description="Use uv instead of pip for dependency installation in workflows.") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| python_versions: List[str] = Field( | ||
| default_factory=lambda: ["3.9", "3.10"], | ||
| description="Python versions for workflows.", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ jobs: | |
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: {python_version} | ||
| - name: "Install dependencies" | ||
| run: "pip install {tool}" | ||
| {uv_setup_step} - name: "Install dependencies" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| run: "{install_command}" | ||
| - name: "Run {tool}" | ||
| run: {tool_command} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: {name} | ||
| on: | ||
| {on_section} | ||
| jobs: | ||
| ruff: | ||
| name: "Ruff Lint & Format" | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: "Checkout repo" | ||
| uses: actions/checkout@v4 | ||
| - name: "Run Ruff linter" | ||
| uses: astral-sh/ruff-action@v3 | ||
| with: | ||
| args: "check {src}" | ||
| - name: "Run Ruff formatter" | ||
| uses: astral-sh/ruff-action@v3 | ||
| with: | ||
| args: "format --check {src}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,6 @@ autopep8_fix: | |
| image: python:{python_version} | ||
| stage: fix | ||
| script: | ||
| - pip install autopep8 | ||
| {uv_bootstrap} - {install_command} autopep8 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| - autopep8 --in-place --recursive {src} | ||
| {branches_section} | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,6 @@ black_formatter: | |||||||||||
| image: python:{python_version} | ||||||||||||
| stage: lint | ||||||||||||
| script: | ||||||||||||
| - pip install black | ||||||||||||
| {uv_bootstrap} - {install_command} black | ||||||||||||
| - black {src} {black_options} | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| {branches_section} | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ fix_pep8: | |
| image: python:{python_version} | ||
| stage: fix | ||
| script: | ||
| - pip install autopep8 | ||
| {uv_bootstrap} - {install_command} autopep8 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| - autopep8 --in-place --recursive {src} | ||
| when: manual | ||
| {branches_section} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,6 @@ pep8_check: | |
| image: python:{python_version} | ||
| stage: lint | ||
| script: | ||
| - pip install {tool} | ||
| {uv_bootstrap} - {install_command} {tool} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| - {tool} {src} | ||
| {branches_section} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ unit_test: | |
| {matrix_yaml} | ||
| image: python:${{PYTHON_VERSION}} | ||
| before_script: | ||
| - pip install -r requirements.txt pytest | ||
| {uv_bootstrap} - {install_command} -r requirements.txt pytest | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| script: | ||
| - pytest {test_dir} | ||
| {branches_section} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we format this line as "Note: ..." not as "!!! warning".