Skip to content

Commit

Permalink
chore: streamline CI configuration and update dependencies
Browse files Browse the repository at this point in the history
- Simplify MegaLinter workflow by removing redundant steps and configurations.
- Update project dependencies and configuration files to reflect current standards.
- Enhance project description and requirements in `pyproject.toml`.
- Extend linting and type-checking configurations to centralize and simplify management.

Release-As: 0.0.0
  • Loading branch information
liblaf committed Nov 21, 2024
1 parent 6ee1db0 commit d017833
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 323 deletions.
4 changes: 2 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
"pyflow",
"pypa",
"pypackages",
"pypi",
"pyplot",
"pyrightconfig",
"pytest",
"pytype",
"pyvenv",
"pyvista",
"qwen",
"repomix",
"sarif",
"scrapy",
"sdist",
"stefanzweifel",
"trimesh",
"typer",
"venv"
Expand Down
3 changes: 2 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
watch_file uv.lock
if [[ ! -f .venv/bin/activate ]]; then
uv venv --system-site-packages
uv sync --all-extras
fi
# shellcheck disable=SC2016
sd '^(\s*)?(?P<key>include-system-site-packages)(\s*)?=(\s*)?(?<val>.*)$' '$key = true' .venv/pyvenv.cfg
# shellcheck disable=SC1091
source .venv/bin/activate
2 changes: 1 addition & 1 deletion .github/copier/.copier-answers.share.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: f98a063
_commit: f3ce1f6
_src_path: gh:liblaf/copier-share
copyright_holder: liblaf
license: MIT
Expand Down
130 changes: 5 additions & 125 deletions .github/workflows/mega-linter.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
# ref: <https://github.com/oxsecurity/megalinter/blob/225e1b5c3a044775005d0ec772cabee5d21006ed/mega-linter-runner/generators/mega-linter/templates/mega-linter.yml>
# ref: <https://megalinter.io>
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
# https://github.com/oxsecurity/megalinter/blob/main/mega-linter-runner/generators/mega-linter/templates/mega-linter.yml
# https://megalinter.io

name: MegaLinter

on:
push:
pull_request:

env:
APPLY_FIXES: all
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
mega-linter:
name: MegaLinter
Expand All @@ -29,117 +21,5 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ github.token }}
- id: ml
name: MegaLinter
uses: oxsecurity/megalinter@v8
# ref: <https://megalinter.io/latest/config-file/>
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Common Variables
MEGALINTER_CONFIG: .github/.mega-linter.yaml
VALIDATE_ALL_CODEBASE: true
# Reporters
TEXT_REPORTER: true
GITHUB_COMMENT_REPORTER: true
GITHUB_STATUS_REPORTER: true
SARIF_REPORTER: true
UPDATED_SOURCES_REPORTER: true
CONFIG_REPORTER: true
CONSOLE_REPORTER: true
JSON_REPORTER: true
MARKDOWN_SUMMARY_REPORTER: true
- if: success() || failure()
name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: MegaLinter reports
path: |-
mega-linter.log
megalinter-reports/
- if: success() || failure()
name: Upload MegaLinter scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: megalinter-reports/megalinter-report.sarif
- if: success() || failure()
name: Add GitHub summary
run: cat megalinter-reports/megalinter-report.md >> "$GITHUB_STEP_SUMMARY"
- id: cpr
if: >-
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
env.APPLY_FIXES_MODE == 'pull_request' &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
) &&
!contains(github.event.head_commit.message, 'skip fix')
name: Create Pull Request with applied fixes
uses: peter-evans/create-pull-request@v7
with:
token: ${{ github.token }}
commit-message: "chore(mega-linter): apply linters automatic fixes"
title: "chore(mega-linter): apply linters automatic fixes"
# TODO: add labels
- if: >-
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
env.APPLY_FIXES_MODE == 'pull_request' &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
) &&
!contains(github.event.head_commit.message, 'skip fix')
name: Create PR output
run: |
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
- if: >-
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
env.APPLY_FIXES_MODE == 'commit' &&
github.ref != 'refs/heads/main' &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
) &&
!contains(github.event.head_commit.message, 'skip fix')
name: Prepare commit
run: sudo chown -Rc $UID .git/
- if: >-
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
env.APPLY_FIXES_MODE == 'commit' &&
github.ref != 'refs/heads/main' &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
) &&
!contains(github.event.head_commit.message, 'skip fix')
name: Commit and push applied linter fixes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(mega-linter): apply linters fixes"
branch: >-
${{
github.event.pull_request.head.ref ||
github.head_ref ||
github.ref
}}
add_options: --update
commit_user_name: megalinter-bot
commit_user_email: nicolas.vuillamy@ox.security
- name: MegaLinter
uses: liblaf/actions/mega-linter@main
90 changes: 4 additions & 86 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,89 +1,7 @@
#:schema https://json.schemastore.org/ruff.json
builtins = ["ic"]
fix = true
show-fixes = true
target-version = "py312"

[format]
docstring-code-format = true

[lint]
explicit-preview-rules = true
ignore = [
"ANN002",
"ANN003",
"ANN401",
"COM812",
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"E501",
"ERA001",
"FIX002",
"INP001",
"PLR0913",
"PLR2004",
"RET504",
"S101",
"S603",
"S607",
"T201",
"TCH001",
"TCH002",
"TCH003",
"TD002",
"TD003",
"TD004",
"TD005",
]
preview = true
select = ["ALL", "RUF022"]

[lint.flake8-annotations]
allow-star-arg-any = true
extend = ".github/linters/.ruff.toml"

[lint.flake8-import-conventions.aliases]
"asyncio.subprocess" = "asp"
"jax.numpy" = "jnp"
"jax.typing" = "jxt"
"matplotlib" = "mpl"
"matplotlib.pyplot" = "plt"
"numpy" = "np"
"numpy.typing" = "npt"
"open3d" = "o3d"
"pandas" = "pd"
"polars" = "pl"
"pyvista" = "pv"
"seaborn" = "sns"
"subprocess" = "sp"
"taichi" = "ti"
"toolkit" = "tk"
"toolkit.array" = "at"
"toolkit.validation" = "tv"
"toolkit.array.jax" = "tj"
"toolkit.array.numpy" = "tn"
"toolkit.array.torch" = "tt"
"toolkit.typing" = "tp"
"trimesh" = "tm"
"trimesh.transformations" = "tf"

[lint.flake8-type-checking]
runtime-evaluated-base-classes = [
"pydantic.BaseModel",
"pydantic_settings.BaseSettings",
"sqlalchemy.orm.DeclarativeBase",
"toolkit.BaseConfig",
]
runtime-evaluated-decorators = [
"attrs.define",
"pydantic.validate_call",
"toolkit.main",
]

[lint.pydocstyle]
convention = "google"
"llm_cli" = "lc"
"llm_cli.cmd" = "lc"
"llm_cli.utils" = "lu"
1 change: 1 addition & 0 deletions docs/config/models.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#:schema https://github.com/liblaf/llm-cli/raw/refs/heads/main/docs/schema/models.json
model = "deepseek-chat"
provider = "deepseek"

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ dependencies = [
"transformers>=4.46.3",
"typer>=0.13.1",
]
description = "Add your description here"
description = "🚀 LLM CLI - A versatile command-line interface for interacting with various AI models, supporting multiple providers like DeepSeek, and offering seamless integration for AI-driven tasks."
name = "llm-cli"
readme = "README.md"
requires-python = ">=3.11"
requires-python = ">=3.12"
version = "0.0.0"

[project.scripts]
Expand Down
7 changes: 1 addition & 6 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json",
"typeCheckingMode": "standard",

"reportArgumentType": "information",
"reportAssignmentType": "information",
"reportPrivateImportUsage": "none",
"reportRedeclaration": "none"
"extends": ".github/linters/pyrightconfig.json"
}
Loading

0 comments on commit d017833

Please sign in to comment.