Commit Graph

19 Commits

Author SHA1 Message Date
QuantumGhost 5cb24625c3 ci(python): Add CI Pipeline for Python SDK (#72)
* chore(python): temporarily disable `UP007` rule in Ruff

Disable the `UP007` rule temporarily due to numerous existing
violations in the current codebase.

* ci(python): add lint and test for Python SDK

* ci: Add mega-linter

* chore(python): Add final newline to markdown files

* fix(python): Fix linter issues by using ruff's auto fix

* fix(python): Fix TRY400 linter violations

Ruff suggests using `logger.exception` to log when
logging an exception, instead of using `logging.error`.

The former logs the exception and the traceback
automatically.

ref: https://docs.astral.sh/ruff/rules/error-instead-of-exception/

* fix(python): fix ruff linter violations

* test(python): Add Test cases for LLM entities

Test the initialization of `LLMResult` and `LLMResultChunk`.

* test(python): Add test for `AgentModelConfig`

Ensures that the `history_prompt_messages` attribute is
not shared between instances of `AgentModelConfig`.

* chore(python): output diffs in Ruff's format check

* style(python): format code with Ruff

* chore(python): Add a bash script for fix and format python code

* chore: add `persist-credentials: false` to checkout action

Enhances security by preventing subsequent
steps from accessing GitHub credentials, reducing
potential attack surfaces.

Ref: https://github.com/actions/checkout#checkout-v4
2025-04-14 20:25:19 +08:00
QuantumGhost ef530695c7 feat(python): Enable Ruff ruleset (RUF), disable preview mode (#70)
* feat(python): Enable Ruff ruleset (RUF)

Refactor the codebase to address and resolve pre-existing style
violations flagged by the Ruff ruleset.

* feat(python): disable preview mode in Ruff

Preview rules in Ruff are unstable and subject to frequent changes.
Disabling them helps prevent potential confusion for developers.

* chore(python): disable deprecated UP038 rule in Ruff

The UP038 rule is deprecated and its suggested practice is not recommended.
Disabling this rule helps avoid unnecessary code rewrites.
2025-03-25 23:23:00 +09:00
QuantumGhost bf79e6591d feat(python): Enable pycodestyle (W) warning ruleset with ruff (#69)
Refactor codebase to fix pre-existing style issues flagged by the ruleset.
2025-03-24 19:21:00 +08:00
QuantumGhost c83c6f41ed feat(python): Enforce FBT003 rule in ruff for boolean arguments (#68)
Configure ruff to require boolean arguments to be passed as keyword arguments in function calls.
This enhances code readability and clarity at call sites.
2025-03-24 19:15:08 +08:00
QuantumGhost 22ae421dd6 feat(python): Integrate flake8-builtins (A) ruleset with ruff (#66)
Introduce the flake8-builtins (A) ruleset to prevent accidental shadowing
of Python's built-in functions.

Address existing issues primarily by adding `# noqa` to suppress warnings where necessary.
2025-03-24 18:58:50 +08:00
QuantumGhost 4eb0de0857 feat(python): Introduct flake8-debugger (T10) ruleset with ruff (#67)
Prohibit calls to `breakpoint()` in committed code.
2025-03-24 18:54:40 +08:00
QuantumGhost 9e084d7d09 feat(python): upgrade ruff to v0.11.2, integrate flake8-bandit ruleset for security linting (#65)
* chore(python): update .gitignore for Python SDK

Adjust .gitignore for Python SDK based on the templated generated by
gitignore.io, with minor custom modifications.

* chore: add .editorconfig for consistent formatting

Add a .editorconfig file to enforce consistent file encoding,
indentation, and end-of-line characters across the project.

* chore(python): upgrade ruff version to v0.11.2

* feat(python): Integrate flake8-bandit ruleset for security linting

Enable the flake8-bandit (S) ruleset in ruff to enforce security-related
best practices and mitigate potential vulnerabilities in the codebase.

Suppress existing issues in the current code using `noqa` comments, primarily for
instances of `requests` calls without a specified `timeout` parameter.
2025-03-24 18:00:14 +08:00
-LAN- 99cc3d9d28 chore: remove unused ruff config
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:58:39 +08:00
-LAN- f4e49cef4f chore: update ruff config
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:53:08 +08:00
-LAN- 102a9cc2ba fix: strip-with-multi-characters
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:43:08 +08:00
-LAN- 71b5791c2c chore: Remove unused variables
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:20:45 +08:00
-LAN- b4b0c29169 refactor: prevent raise-without-from-inside-except
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:18:56 +08:00
-LAN- da41fbf0ab refactor: suppressible-exception
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:13:06 +08:00
-LAN- 061cf9e456 chore: prevent if-else-block-instead-of-if-exp
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:05:48 +08:00
-LAN- 6358a80025 chore: prevent collapsible-if
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 21:59:13 +08:00
-LAN- 7436c3c98c refactor: prevent multiple-with-statements
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 21:56:57 +08:00
-LAN- ef7b886db4 refactor: prevent yoda-conditions
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 21:55:35 +08:00
-LAN- 105606e34b refactor: Remove un-needed bool
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 21:53:23 +08:00
-LAN- 43a1a30415 feat: Add .ruff.toml
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 21:10:19 +08:00