diff options
Diffstat (limited to 'pyproject.toml')
-rw-r--r-- | pyproject.toml | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6e737ab --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,159 @@ +[tool.poetry] +name = "aristaproto" +version = "0.1.2" +description = "Arista Protobuf / Python gRPC bindings generator & library" +authors = ["Arista Networks <ansible@arista.com>"] +readme = "README.md" +repository = "https://github.com/aristanetworks/python-aristaproto" +keywords = ["protobuf", "gRPC", "aristanetworks", "arista"] +license = "MIT" +packages = [ + { include = "aristaproto", from = "src" } +] + +[tool.poetry.dependencies] +python = "^3.9" +black = { version = ">=23.1.0", optional = true } +grpclib = "^0.4.1" +jinja2 = { version = ">=3.0.3", optional = true } +python-dateutil = "^2.8" +isort = {version = "^5.11.5", optional = true} +typing-extensions = "^4.7.1" +betterproto-rust-codec = { version = "0.1.1", optional = true } + +[tool.poetry.group.dev.dependencies] +asv = "^0.4.2" +bpython = "^0.19" +jinja2 = ">=3.0.3" +mypy = "^0.930" +sphinx = "3.1.2" +sphinx-rtd-theme = "0.5.0" +pre-commit = "^2.17.0" +grpcio-tools = "^1.54.2" +tox = "^4.0.0" + +[tool.poetry.group.test.dependencies] +poethepoet = ">=0.9.0" +pytest = "^7.3.2" +pytest-asyncio = "^0.23.0" +pytest-cov = "^2.9.0" +pytest-mock = "^3.12.0" +pydantic = ">=1.8.0,<2" +protobuf = "^4" +cachelib = "^0.10.2" +tomlkit = ">=0.7.0" + +[tool.poetry.scripts] +protoc-gen-python_aristaproto = "aristaproto.plugin:main" + +[tool.poetry.extras] +compiler = ["black", "isort", "jinja2"] +rust-codec = ["betterproto-rust-codec"] + + +# Dev workflow tasks + +[tool.poe.tasks.generate] +script = "tests.generate:main" +help = "Generate test cases (do this once before running test)" + +[tool.poe.tasks.test] +cmd = "pytest" +help = "Run tests" + +[tool.poe.tasks.types] +cmd = "mypy src --ignore-missing-imports" +help = "Check types with mypy" + +[tool.poe.tasks] +_black = "black . --exclude tests/output_ --target-version py310" +_isort = "isort . --extend-skip-glob 'tests/output_*/**/*'" + +[tool.poe.tasks.format] +sequence = ["_black", "_isort"] +help = "Apply black and isort formatting to source code" + +[tool.poe.tasks.docs] +cmd = "sphinx-build docs docs/build" +help = "Build the sphinx docs" + +[tool.poe.tasks.bench] +shell = "asv run master^! && asv run HEAD^! && asv compare master HEAD" +help = "Benchmark current commit vs. master branch" + +[tool.poe.tasks.clean] +cmd = """ +rm -rf .asv .coverage .mypy_cache .pytest_cache + dist aristaproto.egg-info **/__pycache__ + testsoutput_* +""" +help = "Clean out generated files from the workspace" + +[tool.poe.tasks.generate_lib] +cmd = """ +protoc + --plugin=protoc-gen-custom=src/aristaproto/plugin/main.py + --custom_opt=INCLUDE_GOOGLE + --custom_out=src/aristaproto/lib/std + -I /usr/local/include/ + /usr/local/include/google/protobuf/**/*.proto +""" +help = "Regenerate the types in aristaproto.lib.std.google" + +# CI tasks + +[tool.poe.tasks.full-test] +shell = "poe generate && tox" +help = "Run tests with multiple pythons" + +[tool.poe.tasks.check-style] +cmd = "black . --check --diff" +help = "Check if code style is correct" + +[tool.isort] +py_version = 37 +profile = "black" +force_single_line = false +combine_as_imports = true +lines_after_imports = 2 +include_trailing_comma = true +force_grid_wrap = 2 +src_paths = ["src", "tests"] + +[tool.black] +target-version = ['py37'] + +[tool.doc8] +paths = ["docs"] +max_line_length = 88 + +[tool.doc8.ignore_path_errors] +"docs/migrating.rst" = [ + "D001", # contains table which is longer than 88 characters long +] + +[tool.coverage.run] +omit = ["aristaproto/tests/*"] + +[tool.tox] +legacy_tox_ini = """ +[tox] +requires = + tox>=4.2 + tox-poetry-installer[poetry]==1.0.0b1 +env_list = + py311 + py39 + +[testenv] +commands = + pytest {posargs: --cov aristaproto} +poetry_dep_groups = + test +require_locked_deps = true +require_poetry = true +""" + +[build-system] +requires = ["poetry-core>=1.0.0,<2"] +build-backend = "poetry.core.masonry.api" |