Skip to content

Commit

Permalink
Update scripts and lint configs (open-telemetry#2929)
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthccv authored Sep 13, 2022
1 parent 41b9e26 commit 75313b6
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 33 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[run]
omit =
*/tests/*
*/setup.py
*/gen/*
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ exclude =
docs/examples/opentelemetry-example-app/build/*
opentelemetry-proto/build/*
opentelemetry-proto/src/opentelemetry/proto/
*/build/lib/*
6 changes: 2 additions & 4 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions eachdist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-api/src/opentelemetry/propagate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
)/
)
'''
Expand Down
8 changes: 3 additions & 5 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions scripts/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -15,7 +14,6 @@ function cov {
${1}
else
pytest \
--ignore-glob=*/setup.py \
--cov ${1} \
--cov-append \
--cov-branch \
Expand Down
16 changes: 8 additions & 8 deletions scripts/eachdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit 75313b6

Please sign in to comment.