diff --git a/.github/workflows/misc_0.yml b/.github/workflows/misc_0.yml index 34e4d16bfa..18a1a499a3 100644 --- a/.github/workflows/misc_0.yml +++ b/.github/workflows/misc_0.yml @@ -157,8 +157,8 @@ jobs: - name: Run tests run: tox -e shellcheck - ruff: - name: ruff + precommit: + name: precommit runs-on: ubuntu-latest timeout-minutes: 30 steps: @@ -174,7 +174,7 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e ruff + run: tox -e precommit typecheck: name: typecheck diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 587e1cd8c6..5b9bf9973f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,3 +13,9 @@ repos: rev: 0.6.0 hooks: - id: uv-lock + - repo: https://github.com/rstcheck/rstcheck + rev: 77490ffa33bfc0928975ae3cf904219903db755d # frozen: v6.2.5 + hooks: + - id: rstcheck + additional_dependencies: ['rstcheck[sphinx]'] + args: ["--report-level", "warning"] diff --git a/.rstcheck.cfg b/.rstcheck.cfg new file mode 100644 index 0000000000..afd93e4dc3 --- /dev/null +++ b/.rstcheck.cfg @@ -0,0 +1,2 @@ +[rstcheck] +ignore_directives = automodule diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c959bec2e..b63232109b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `opentelemetry-instrumentation`: botocore: Add support for AWS Secrets Manager semantic convention attribute ([#3765](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3765)) +- Add `rstcheck` to pre-commit to stop introducing invalid RST + ([#3777](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3777)) + ## Version 1.37.0/0.58b0 (2025-09-11) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 908e33df4a..ee4ebea01d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -84,8 +84,9 @@ You can run `tox` with the following arguments: * `tox -e lint-some-package` to run lint checks on `some-package` * `tox -e generate-workflows` to run creation of new CI workflows if tox environments have been updated * `tox -e ruff` to run ruff linter and formatter checks against the entire codebase +* `tox -e precommit` to run all `pre-commit` actions -`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment: +`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` and `rstcheck` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment: ```console pip install pre-commit -c dev-requirements.txt diff --git a/_template/README.rst b/_template/README.rst index 78226bba43..16e1043988 100644 --- a/_template/README.rst +++ b/_template/README.rst @@ -1,5 +1,5 @@ OpenTelemetry Instrumentation -=========================== +========================================== |pypi| @@ -20,5 +20,5 @@ Installation References ---------- -* `OpenTelemetry / Tracing /.html>`_ +* `OpenTelemetry REPLACE ME/ Tracing `_ * `OpenTelemetry Project `_ diff --git a/instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/manual/README.rst b/instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/manual/README.rst index 182c5fc11a..79301aa5d4 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/manual/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/manual/README.rst @@ -1,5 +1,5 @@ OpenTelemetry Google GenAI SDK Manual Instrumentation Example -============================================ +============================================================= This is an example of how to instrument Google GenAI SDK calls when configuring OpenTelemetry SDK and Instrumentations manually. diff --git a/instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/zero-code/README.rst b/instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/zero-code/README.rst index a04433c846..0833906275 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/zero-code/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-google-genai/examples/zero-code/README.rst @@ -1,5 +1,5 @@ OpenTelemetry Google GenAI SDK Manual Instrumentation Example -============================================ +============================================================= This is an example of how to instrument Google GenAI SDK calls with zero code changes, using `opentelemetry-instrument`. diff --git a/instrumentation-genai/opentelemetry-instrumentation-langchain/examples/manual/README.rst b/instrumentation-genai/opentelemetry-instrumentation-langchain/examples/manual/README.rst index 2c829bc801..45d67f9acd 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-langchain/examples/manual/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-langchain/examples/manual/README.rst @@ -1,12 +1,12 @@ OpenTelemetry Langcahin Instrumentation Example -============================================ +=============================================== This is an example of how to instrument Langchain when configuring OpenTelemetry SDK and instrumentations manually. -When :code:`main.py `_ is run, it exports traces to an OTLP-compatible endpoint. +When `main.py `_ is run, it exports traces to an OTLP-compatible endpoint. Traces include details such as the span name and other attributes. -Note: :code:`.env <.env>`_ file configures additional environment variables: +Note: `.env <.env>`_ file configures additional environment variables: - :code:`OTEL_LOGS_EXPORTER=otlp` to specify exporter type. - :code:`OPENAI_API_KEY` open AI key for accessing the OpenAI API. - :code:`OTEL_EXPORTER_OTLP_ENDPOINT` to specify the endpoint for exporting traces (default is http://localhost:4317). @@ -14,7 +14,7 @@ Note: :code:`.env <.env>`_ file configures additional environment variables: Setup ----- -Minimally, update the :code:`.env <.env>`_ file with your :code:`OPENAI_API_KEY`. +Minimally, update the `.env <.env>`_ file with your :code:`OPENAI_API_KEY`. An OTLP compatible endpoint should be listening for traces http://localhost:4317. If not, update :code:`OTEL_EXPORTER_OTLP_ENDPOINT` as well. diff --git a/instrumentation-genai/opentelemetry-instrumentation-langchain/examples/zero-code/README.rst b/instrumentation-genai/opentelemetry-instrumentation-langchain/examples/zero-code/README.rst index 3d141ed033..368da6807d 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-langchain/examples/zero-code/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-langchain/examples/zero-code/README.rst @@ -1,13 +1,13 @@ OpenTelemetry Langchain Zero-Code Instrumentation Example -====================================================== +========================================================= This is an example of how to instrument Langchain with zero code changes, using `opentelemetry-instrument`. -When :code:`main.py `_ is run, it exports traces to an OTLP-compatible endpoint. +When `main.py `_ is run, it exports traces to an OTLP-compatible endpoint. Traces include details such as the span name and other attributes. -Note: :code:`.env <.env>`_ file configures additional environment variables: +Note: `.env <.env>`_ file configures additional environment variables: - :code:`OTEL_LOGS_EXPORTER=otlp` to specify exporter type. - :code:`OPENAI_API_KEY` open AI key for accessing the OpenAI API. - :code:`OTEL_EXPORTER_OTLP_ENDPOINT` to specify the endpoint for exporting traces (default is http://localhost:4317). @@ -15,7 +15,7 @@ Note: :code:`.env <.env>`_ file configures additional environment variables: Setup ----- -Minimally, update the :code:`.env <.env>`_ file with your :code:`OPENAI_API_KEY`. +Minimally, update the `.env <.env>`_ file with your :code:`OPENAI_API_KEY`. An OTLP compatible endpoint should be listening for traces http://localhost:4317. If not, update :code:`OTEL_EXPORTER_OTLP_ENDPOINT` as well. diff --git a/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/manual/README.rst b/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/manual/README.rst index ab5e7d1c5c..c9cbdc8d2e 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/manual/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/manual/README.rst @@ -1,5 +1,5 @@ OpenTelemetry VertexAI Instrumentation Example -============================================ +============================================== This is an example of how to instrument VertexAI calls when configuring OpenTelemetry SDK and Instrumentations manually. @@ -12,8 +12,8 @@ your VertexAI requests. Note: `.env <.env>`_ file configures additional environment variables: - `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true` configures -VertexAI instrumentation to capture prompt and completion contents on -events. + VertexAI instrumentation to capture prompt and completion contents on + events. Setup ----- diff --git a/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/README.rst b/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/README.rst index 6fe161f82f..19a132d443 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/README.rst @@ -1,5 +1,5 @@ OpenTelemetry VertexAI Instrumentation Example -============================================ +============================================== This is an example of how to instrument VertexAI calls with zero code changes, using `opentelemetry-instrument`. diff --git a/instrumentation/opentelemetry-instrumentation-urllib/README.rst b/instrumentation/opentelemetry-instrumentation-urllib/README.rst index f673fb07f9..514dbf2814 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/README.rst +++ b/instrumentation/opentelemetry-instrumentation-urllib/README.rst @@ -37,7 +37,7 @@ The hooks can be configured as follows: # `request_obj` is an instance of urllib.request.Request # `response` is an instance of http.client.HTTPResponse - def response_hook(span, request_obj, response) + def response_hook(span, request_obj, response): pass URLLibInstrumentor().instrument( diff --git a/tox.ini b/tox.ini index 7674f700db..854c3e7884 100644 --- a/tox.ini +++ b/tox.ini @@ -429,7 +429,7 @@ envlist = generate generate-workflows shellcheck - ruff + precommit typecheck [testenv] @@ -1047,7 +1047,7 @@ commands_pre = commands = sh -c "find {toxinidir} -name \*.sh | xargs shellcheck --severity=warning" -[testenv:ruff] +[testenv:{precommit,ruff}] basepython: python3 deps = -c {toxinidir}/dev-requirements.txt