From 75313b6c6d58945c1401622b6683ccdd28657984 Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Tue, 13 Sep 2022 22:28:28 +0530 Subject: [PATCH] Update scripts and lint configs (#2929) --- .coveragerc | 1 - .flake8 | 1 + RELEASING.md | 6 ++---- eachdist.ini | 11 ----------- .../src/opentelemetry/propagate/__init__.py | 2 +- pyproject.toml | 4 +++- scripts/build.sh | 8 +++----- scripts/coverage.sh | 2 -- scripts/eachdist.py | 16 ++++++++-------- 9 files changed, 18 insertions(+), 33 deletions(-) diff --git a/.coveragerc b/.coveragerc index 6f2257aba5a..cc035b23826 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,5 +1,4 @@ [run] omit = */tests/* - */setup.py */gen/* diff --git a/.flake8 b/.flake8 index 9c1f4b2d41e..cd5fe860b53 100644 --- a/.flake8 +++ b/.flake8 @@ -24,3 +24,4 @@ exclude = docs/examples/opentelemetry-example-app/build/* opentelemetry-proto/build/* opentelemetry-proto/src/opentelemetry/proto/ + */build/lib/* diff --git a/RELEASING.md b/RELEASING.md index 5ba0fcb1b48..975fdf94409 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -83,10 +83,8 @@ A `hotfix` is defined as a small change developed to correct a bug that should b 3. On your local machine, update `CHANGELOG.md` with the date of the hotfix change. 4. With administrator privileges for PyPi, manually publish the affected packages. 1. Install [twine](https://pypi.org/project/twine/) and [build](https://pypi.org/project/build/) - 2. Navigate to where the `setup.py` or `pyproject.toml` file exists for the package you want to publish. - 3. To build the package: - - If a `setup.py` file exists, run `python setup.py sdist bdist_wheel`. You may have to install [wheel](https://pypi.org/project/wheel/) as well. - - Otherwise, run `python -m build`. + 2. Navigate to where the `pyproject.toml` file exists for the package you want to publish. + 3. To build the package: run `python -m build`. 4. Validate your built distributions by running `twine check dist/*`. 5. Upload distributions to PyPi by running `twine upload dist/*`. 5. Note that since hotfixes are manually published, the build scripts for publish after creating a release are not run. diff --git a/eachdist.ini b/eachdist.ini index 44b1d15eb8a..5d42f3c2988 100644 --- a/eachdist.ini +++ b/eachdist.ini @@ -41,17 +41,6 @@ packages= opentelemetry-test-utils tests -[experimental] -version=1.10a0 - -packages= - opentelemetry-exporter-prometheus-remote-write - opentelemetry-api - opentelemetry-sdk - opentelemetry-exporter-otlp-proto-grpc - opentelemetry-exporter-otlp-proto-http - opentelemetry-exporter-otlp - [lintroots] extraroots=examples/*,scripts/ subglob=*.py,tests/,test/,src/*,examples/* diff --git a/opentelemetry-api/src/opentelemetry/propagate/__init__.py b/opentelemetry-api/src/opentelemetry/propagate/__init__.py index f197f1f9149..a39d8a44d1f 100644 --- a/opentelemetry-api/src/opentelemetry/propagate/__init__.py +++ b/opentelemetry-api/src/opentelemetry/propagate/__init__.py @@ -27,7 +27,7 @@ ``opentelemetry.trace.propagation.tracecontext.TraceContextTextMapPropagator`` and other of type ``opentelemetry.baggage.propagation.W3CBaggagePropagator``. Notice that these propagator classes are defined as -``opentelemetry_propagator`` entry points in the ``setup.cfg`` file of +``opentelemetry_propagator`` entry points in the ``pyproject.toml`` file of ``opentelemetry``. Example:: diff --git a/pyproject.toml b/pyproject.toml index 15e2fed2e5c..a20a4056752 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,10 +5,12 @@ exclude = ''' /( # generated files .tox| venv| + .*/build/lib/.*| exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/gen| exporter/opentelemetry-exporter-jaeger-thrift/src/opentelemetry/exporter/jaeger/thrift/gen| exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/v2/gen| - opentelemetry-proto/src/opentelemetry/proto/.*/.* + opentelemetry-proto/src/opentelemetry/proto/.*/.*| + scripts )/ ) ''' diff --git a/scripts/build.sh b/scripts/build.sh index 2ba7e4c0abb..ed875838607 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -21,11 +21,9 @@ DISTDIR=dist echo "building $d" cd "$d" # Some ext directories (such as docker tests) are not intended to be - # packaged. Verify the intent by looking for a setup.py. - if [ -f setup.py ]; then - python3 setup.py sdist --dist-dir "$BASEDIR/dist/" clean --all - else if [ -f pyproject.toml ]; then - HATCH_BUILD_CLEAN=1 python3 -m build --outdir "$BASEDIR/dist/" + # packaged. Verify the intent by looking for a pyproject.toml. + if [ -f pyproject.toml ]; then + python3 -m build --outdir "$BASEDIR/dist/" fi ) done diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 72b7adec74f..df43010ec6d 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -6,7 +6,6 @@ function cov { if [ ${TOX_ENV_NAME:0:4} == "py34" ] then pytest \ - --ignore-glob=*/setup.py \ --ignore-glob=instrumentation/opentelemetry-instrumentation-opentracing-shim/tests/testbed/* \ --cov ${1} \ --cov-append \ @@ -15,7 +14,6 @@ function cov { ${1} else pytest \ - --ignore-glob=*/setup.py \ --cov ${1} \ --cov-append \ --cov-branch \ diff --git a/scripts/eachdist.py b/scripts/eachdist.py index cd2a3938f42..dc803af4cf1 100755 --- a/scripts/eachdist.py +++ b/scripts/eachdist.py @@ -81,7 +81,7 @@ def parse_args(args=None): commands according to `format` and `--all`. Target paths are initially all Python distribution root paths - (as determined by the existence of setup.py, etc. files). + (as determined by the existence of pyproject.toml, etc. files). They are then augmented according to the section of the `PROJECT_ROOT/eachdist.ini` config file specified by the `--mode` option. @@ -518,18 +518,18 @@ def lint_args(args): runsubprocess( args.dry_run, - ("black", ".") + (("--diff", "--check") if args.check_only else ()), + ("black", "--config", "pyproject.toml", ".") + (("--diff", "--check") if args.check_only else ()), cwd=rootdir, check=True, ) runsubprocess( args.dry_run, - ("isort", ".") + ("isort", "--settings-path", ".isort.cfg", ".") + (("--diff", "--check-only") if args.check_only else ()), cwd=rootdir, check=True, ) - runsubprocess(args.dry_run, ("flake8", rootdir), check=True) + runsubprocess(args.dry_run, ("flake8", "--config", ".flake8", rootdir), check=True) execute_args( parse_subargs( args, ("exec", "pylint {}", "--all", "--mode", "lintroots") @@ -629,7 +629,7 @@ def update_dependencies(targets, version, packages): for pkg in packages: update_files( targets, - "setup.cfg", + "pyproject.toml", rf"({basename(pkg)}.*)==(.*)", r"\1== " + version, ) @@ -694,19 +694,19 @@ def test_args(args): def format_args(args): - format_dir = str(find_projectroot()) + root_dir = format_dir = str(find_projectroot()) if args.path: format_dir = os.path.join(format_dir, args.path) runsubprocess( args.dry_run, - ("black", "."), + ("black", "--config", f"{root_dir}/pyproject.toml", "."), cwd=format_dir, check=True, ) runsubprocess( args.dry_run, - ("isort", "--profile", "black", "."), + ("isort", "--settings-path", f"{root_dir}/.isort.cfg", "--profile", "black", "."), cwd=format_dir, check=True, )