Skip to content

Commit f72a82d

Browse files
committed
found tox.ini updates, and searched for references of mypy.
1 parent 34fe219 commit f72a82d

File tree

6 files changed

+25
-24
lines changed

6 files changed

+25
-24
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ htmlcov
5656
# Sphinx
5757
_build/
5858

59-
# mypy
60-
.mypy_cache/
6159
target
6260

6361
# Django example

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ You can run `tox` with the following arguments:
6060
- `tox -e lint-some-package` to run lint checks on `some-package`
6161
- `tox -e generate-workflows` to run creation of new CI workflows if tox environments have been updated
6262
- `tox -e ruff` to run ruff linter and formatter checks against the entire codebase
63+
- `tox -e pyright` to run pyright against entire code base.
64+
- `tox -e public-symbols-check` to run public_symbols_checker.py.
65+
- `tox -e docker-tests-{otlpexporter,opencensus}` to run tests in both or either one location.
66+
- `tox -e tracecontext` to run integration tests for tracecontext.
67+
- `tox -d sphinx-build` to build html sphinx docs.
6368

6469
`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:
6570

opentelemetry-sdk/tests/metrics/test_backward_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
and PeriodicExportingMetricReader concrete class. Those may freely be modified in a
2323
backward-compatible way for *callers*.
2424
25-
Ideally, we could use mypy for this as well, but SDK is not type checked atm.
25+
Ideally, we could use pyright for this as well, but SDK is not type checked atm.
2626
"""
2727

2828
from typing import Iterable, Sequence

pyproject.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,25 @@ include = [
99
"opentelemetry-api/src",
1010
"opentelemetry-sdk/src",
1111
"opentelemetry-semantic-conventions/src",
12+
"opentelemetry-proto/src",
13+
"scripts"
14+
]
15+
ignore = [
16+
"docs/**",
17+
"exporter/**",
18+
"propagator/**",
19+
"shim/**",
20+
1221
]
1322
reportUnnecessaryTypeIgnoreComment = true
14-
pythonVersion >= "3.9"
23+
pythonVersion = "3.9"
1524
reportPrivateUsage = false # Ignore private attributes added by instrumentation packages.
25+
reportUnusedFunction = true
26+
reportUnusedVariable = true
27+
reportUnusedImport = true
1628

1729
exclude = [
18-
"opentelemetry-python/tests/**",
30+
"tests/**",
1931
]
2032

2133
[tool.ruff]

scripts/proto_codegen.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cd $repo_root/opentelemetry-proto/src
5555

5656
# clean up old generated code
5757
find opentelemetry/ -regex ".*_pb2.*\.pyi?" -exec rm {} +
58-
58+
# unsure if we need to update this. I could not find the module referenced below in this repo. We would need to change this pyright.
5959
# generate proto code for all protos
6060
all_protos=$(find $PROTO_REPO_DIR/ -iname "*.proto")
6161
python -m grpc_tools.protoc \
@@ -70,7 +70,7 @@ service_protos=$(grep -REl "service \w+ {" $PROTO_REPO_DIR/opentelemetry/)
7070
python -m grpc_tools.protoc \
7171
-I $PROTO_REPO_DIR \
7272
--python_out=. \
73-
--mypy_out=. \
73+
--mypy_out=. \
7474
--grpc_python_out=. \
7575
$service_protos
7676

tox.ini

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ envlist =
8888

8989
spellcheck
9090
tracecontext
91-
mypy,mypyinstalled
9291
pyright
9392
docs
9493
docker-tests-{otlpexporter,opencensus}
@@ -99,7 +98,7 @@ envlist =
9998

10099
[testenv]
101100
deps =
102-
lint: -r dev-requirements.txt
101+
lint: -r dev-requirements.txt # I think we should look into using something like pip-sync to keep this env inline with the requirements.txt.
103102
coverage: pytest
104103
coverage: pytest-cov
105104

@@ -144,7 +143,6 @@ deps =
144143

145144
propagator-jaeger: -r {toxinidir}/propagator/opentelemetry-propagator-jaeger/test-requirements.txt
146145

147-
mypyinstalled: -e {toxinidir}/opentelemetry-api
148146

149147
getting-started: -r {toxinidir}/docs/getting_started/tests/requirements.txt
150148
getting-started: {env:CONTRIB_REPO}\#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http
@@ -160,7 +158,6 @@ setenv =
160158
; i.e: CONTRIB_REPO_SHA=dde62cebffe519c35875af6d06fae053b3be65ec tox -e <env to test>
161159
CONTRIB_REPO_SHA={env:CONTRIB_REPO_SHA:main}
162160
CONTRIB_REPO=git+https://github.com/open-telemetry/opentelemetry-python-contrib.git@{env:CONTRIB_REPO_SHA}
163-
mypy: MYPYPATH={toxinidir}/opentelemetry-api/src/:{toxinidir}/opentelemetry-semantic-conventions/src/:{toxinidir}/opentelemetry-sdk/src/:{toxinidir}/tests/opentelemetry-test-utils/src/
164161

165162
commands_pre =
166163
; In order to get a healthy coverage report,
@@ -230,19 +227,8 @@ commands =
230227

231228
coverage: {toxinidir}/scripts/coverage.sh
232229

233-
mypy: mypy --version
234-
mypy: mypy --install-types --non-interactive --namespace-packages --explicit-package-bases opentelemetry-api/src/opentelemetry/
235-
mypy: mypy --install-types --non-interactive --namespace-packages --explicit-package-bases opentelemetry-sdk/src/opentelemetry/sdk/resources
236-
mypy: mypy --install-types --non-interactive --namespace-packages --explicit-package-bases opentelemetry-semantic-conventions/src/opentelemetry/semconv/
237-
238-
; For test code, we don't want to enforce the full mypy strictness
239-
mypy: mypy --install-types --non-interactive --namespace-packages --config-file=mypy-relaxed.ini opentelemetry-api/tests/
240-
241-
; Test that mypy can pick up typeinfo from an installed package (otherwise,
242-
; implicit Any due to unfollowed import would result).
243-
mypyinstalled: mypy --install-types --non-interactive --namespace-packages opentelemetry-api/tests/mypysmoke.py --strict
244-
245-
[testenv:spellcheck]
230+
231+
[testenv:sphinx-build] # there were 2 instances of this name (spellcheck), renaming to sphinx-build
246232
basepython: python3
247233
recreate = True
248234
deps =

0 commit comments

Comments
 (0)