diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 574ff87dc..6670d22e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,20 +1,9 @@ +default_stages: [ commit ] + # Install # 1. pip install pre-commit # 2. pre-commit install(the first time you download the repo, it will be cached for future use) repos: - - repo: https://github.com/pycqa/flake8 - rev: 4.0.1 - hooks: - - id: flake8 - args: [ - "--show-source", - "--count", - "--statistics", - "--extend-ignore=E203,E402,C901,E501,E101,E266,E731,W291,F821,W191,E122,E125,E127,E128,W293", - "--per-file-ignores=__init__.py:F401", - ] # when necessary, ignore errors, https://flake8.pycqa.org/en/latest/user/error-codes.html - exclude: ^venv/ # exclude dir, e.g. (^foo/|^bar/) - - repo: https://github.com/pycqa/isort rev: 5.11.5 hooks: @@ -24,3 +13,14 @@ repos: (?x)^( .*__init__\.py$ ) + + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.0.284 + hooks: + - id: ruff + + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..72bc26543 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,69 @@ +[project] +name = "chatgit" +version = "0.1.0" +description = "chatgit is an LLM model-based open source project competition analysis research project, it can help you find the most suitable open source project for your needs" +authors = [ + {name = "hezz", email = "hezhaozhaog@gmail.com"}, +] +dependencies = [ + "requests>=2.31.0", +] +requires-python = ">=3.11" +readme = "README.md" +license = {text = "Apache"} + +[build-system] +requires = ["setuptools>=61", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.black] +line-length = 119 +target-version = ['py39'] + + +[tool.ruff] +# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default. +select = ["E", "F"] +ignore = ["E501", "E712", "E722", "F821"] + +# Allow autofix for all enabled rules (when `--fix`) is provided. +fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"] +unfixable = [] + +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".mypy_cache", + ".nox", + ".pants.d", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "venv", +] + +# Same as Black. +line-length = 119 + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +# Assume Python 3.9 +target-version = "py39" + +[tool.ruff.mccabe] +# Unlike Flake8, default to a complexity level of 10. +max-complexity = 10 \ No newline at end of file