diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12fd411..238c636 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,9 +20,9 @@ jobs: with: enable-cache: true - name: Ruff lint - run: uvx ruff@latest check packages/dash0-opentelemetry-distro examples scripts + run: uvx ruff@latest check packages/dash0-opentelemetry examples scripts - name: Ruff format check - run: uvx ruff@latest format --check packages/dash0-opentelemetry-distro examples scripts + run: uvx ruff@latest format --check packages/dash0-opentelemetry examples scripts - name: Check uv.lock is up to date run: uv lock --check - name: Check exact dependency pins @@ -44,9 +44,9 @@ jobs: python-version: ${{ matrix.python-version }} - name: Run distribution unit tests run: > - uv run --package dash0-opentelemetry-distro + uv run --package dash0-opentelemetry --python ${{ matrix.python-version }} - python -m pytest packages/dash0-opentelemetry-distro/tests -v + python -m pytest packages/dash0-opentelemetry/tests -v sitecustomize-python27: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7d050f..d022b6d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,6 +60,11 @@ jobs: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.mode == 'rebuild-assets') runs-on: ubuntu-latest + outputs: + # JSON array of the PyPI project names built this run; drives the + # per-package publish-pypi matrix below. Empty ("[]") when every + # filename is already indexed and nothing was built. + packages: ${{ steps.select.outputs.packages }} permissions: contents: write id-token: write @@ -117,7 +122,7 @@ jobs: f"releases must carry release-form versions" ) - distro_version = versions["dash0-opentelemetry-distro"] + distro_version = versions["dash0-opentelemetry"] assert tag == f"v{distro_version}", ( f"tag {tag} does not match the distro version: " f"expected v{distro_version}" @@ -136,6 +141,9 @@ jobs: prerelease = bool(re.search(r"(?:a|b|rc)[0-9]+", distro_version)) with open(os.environ["GITHUB_OUTPUT"], "a") as out: out.write(f"prerelease={str(prerelease).lower()}\n") + # The publish-pypi matrix iterates exactly the packages built + # this run, so already-published names are never re-published. + out.write(f"packages={json.dumps(to_build)}\n") print(f"building: {to_build or 'nothing (all filenames already indexed)'}") EOF - name: Build packages @@ -275,6 +283,56 @@ jobs: - uses: actions/deploy-pages@v5 id: deploy + publish-pypi: + needs: [build] + # Publish to PyPI only on tag-triggered runs (not manual dispatches or + # UI-published events) and only when the build job produced artifacts. + if: >- + github.event_name == 'push' && needs.build.result == 'success' && + needs.build.outputs.packages != '[]' + # One job per package built this run. Each package is published from its + # OWN GitHub environment whose name equals the package's PyPI project + # name. This is load-bearing, not cosmetic: a PyPI *pending* trusted + # publisher is unique on (owner, repo, workflow, environment), so a single + # shared environment could authorize only one of these names. A distinct + # environment per package gives each its own (…, release.yml, ) + # tuple, which is what lets this one workflow publish all of them. Each + # environment must exist with a matching pending/trusted publisher on PyPI + # (see RELEASING.rst). + strategy: + fail-fast: false + matrix: + package: ${{ fromJSON(needs.build.outputs.packages) }} + runs-on: ubuntu-latest + environment: + name: ${{ matrix.package }} + url: https://pypi.org/project/${{ matrix.package }}/ + permissions: + id-token: write + env: + TAG: ${{ github.ref_name }} + GH_TOKEN: ${{ github.token }} + PACKAGE: ${{ matrix.package }} + steps: + - name: Download this package's release assets + run: | + set -euo pipefail + mkdir dist + # Wheel/sdist filenames normalize runs of -_. to a single _, so the + # trailing hyphen before the version makes each prefix unambiguous: + # "dash0_opentelemetry-*" matches the distro but not + # "dash0_opentelemetry_pyproto-*". + dist_name="${PACKAGE//-/_}" + gh release download "$TAG" \ + --repo "$GITHUB_REPOSITORY" \ + --pattern "${dist_name}-*.whl" \ + --pattern "${dist_name}-*.tar.gz" \ + --dir dist/ + ls -l dist/ + - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 + with: + packages-dir: dist/ + index-dry-run: if: github.event_name == 'workflow_dispatch' && inputs.mode == 'dry-run' runs-on: ubuntu-latest diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 5b04935..59daa06 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -15,7 +15,7 @@ Prerequisites Project layout ============== -- ``packages/dash0-opentelemetry-distro`` — the distribution: ``Dash0Distro`` +- ``packages/dash0-opentelemetry`` — the distribution: ``Dash0Distro`` and ``Dash0Configurator`` plus resource detection and settings. **This is the Dash0-authored code.** - ``packages/opentelemetry-*`` — the pure-Python (pyproto) OTLP exporter @@ -34,7 +34,7 @@ Setup .. code-block:: bash - uv sync --package dash0-opentelemetry-distro + uv sync --package dash0-opentelemetry This creates ``.venv`` with the distribution, the in-repo pyproto exporters, and the dev dependencies. @@ -47,8 +47,8 @@ Distribution unit tests (fast, no Docker): .. code-block:: bash - uv run --package dash0-opentelemetry-distro \ - python -m pytest packages/dash0-opentelemetry-distro/tests -v + uv run --package dash0-opentelemetry \ + python -m pytest packages/dash0-opentelemetry/tests -v End-to-end example (requires Docker; builds the distro into a container, runs a Flask app under ``opentelemetry-instrument``, and asserts on the exported @@ -70,8 +70,8 @@ pyproto packages are excluded via ``ruff.toml``): .. code-block:: bash - uvx ruff@latest check packages/dash0-opentelemetry-distro examples - uvx ruff@latest format --check packages/dash0-opentelemetry-distro examples + uvx ruff@latest check packages/dash0-opentelemetry examples + uvx ruff@latest format --check packages/dash0-opentelemetry examples Apply fixes with ``ruff check --fix`` and ``ruff format`` (drop ``--check``). diff --git a/README.rst b/README.rst index 2a3e7c6..3a120bf 100644 --- a/README.rst +++ b/README.rst @@ -54,7 +54,7 @@ Architecture :: packages/ - dash0-opentelemetry-distro/ the distribution (distro + configurator) + dash0-opentelemetry/ the distribution (distro + configurator) opentelemetry-pyproto/ pure-Python protobuf message classes opentelemetry-exporter-otlp-pyproto-common/ shared OTLP encoding opentelemetry-exporter-otlp-pyproto-http/ pure-Python OTLP/HTTP exporter (default) @@ -130,25 +130,23 @@ defaults (with ``setdefault``) and never overrides values you provide. Installation ============ -Releases are published on the Dash0 package index — a static PEP 503 simple -index on GitHub Pages whose artifacts are GitHub release assets of this -repository — not on public PyPI: +Releases are published on **public PyPI** and on the Dash0 package index (a +static PEP 503 simple index on GitHub Pages): .. code-block:: bash - pip install \ - --extra-index-url https://dash0hq.github.io/opentelemetry-python-distribution/simple/ \ - dash0-opentelemetry-distro + pip install dash0-opentelemetry -Production consumers (such as the dash0-operator's instrumentation image -build) should install with a fully hashed lockfile, ``--require-hashes``, and +The Dash0 index hosts the full set of workspace packages (including the +vendored pyproto exporters) and remains the authoritative source for +production consumers that install with ``--require-hashes`` and ``--only-binary :all:``; see the consumer contract in `RELEASING.rst`_. For development, consume the workspace directly: .. code-block:: bash - uv sync --package dash0-opentelemetry-distro + uv sync --package dash0-opentelemetry Development diff --git a/RELEASING.rst b/RELEASING.rst index e78d93a..3d6c573 100644 --- a/RELEASING.rst +++ b/RELEASING.rst @@ -9,12 +9,20 @@ on. Publishing channel ================== -Packages are **not** published to public PyPI. Each release attaches wheels -and sdists as GitHub release assets, and a static `PEP 503 -`_ "simple" index served from GitHub Pages -points at them with ``#sha256=`` fragments: +Each release publishes packages to **two channels**: - https://dash0hq.github.io/opentelemetry-python-distribution/simple/ +1. **Public PyPI** — via OIDC trusted publishing in the ``release.yml`` + ``publish-pypi`` job. Consumers can install with a plain + ``pip install dash0-opentelemetry``. +2. **Dash0 package index** — a static `PEP 503 + `_ "simple" index served from GitHub + Pages, backed by GitHub release assets with ``#sha256=`` fragments: + + https://dash0hq.github.io/opentelemetry-python-distribution/simple/ + + This index hosts all five workspace packages (including the vendored pyproto + exporters) and is the authoritative source for production consumers that + install with ``--require-hashes`` and ``--only-binary :all:``. ``.github/workflows/release.yml`` implements the pipeline; the index is regenerated statelessly from all published releases by @@ -33,11 +41,10 @@ The three decisions that used to gate publishing are resolved: entry-point names stay upstream-shaped: when upstream publishes the official packages, the distribution switches its dependencies over and the renamed copies are deprecated. The ``dash0-opentelemetry-*`` names are - defensively registered on public PyPI (see `Name reservation`_). + claimed on public PyPI via the first real release. 2. **Scope.** All five workspace packages are published to the self-hosted - index. Public PyPI publication of the real packages is deferred until - there is a non-operator audience; the artifacts and the already-claimed - names make that step additive. + index. The main ``dash0-opentelemetry`` package and the four supporting + pyproto packages are also published to public PyPI. 3. **Versioning.** The distribution versions independently (semver). The vendored packages carry their upstream base version with ``.postN`` increments for Dash0-side changes (e.g. ``1.44.0``, ``1.44.0.post1``). @@ -146,29 +153,21 @@ Repository (an admin, before the first release): manifest commits; do not widen branch protection for the generic Actions token instead. 6. Create the ``pypi`` environment with **required reviewers** and a - deployment policy restricted to the default branch (used only by the name - reservation below). - -.. _Name reservation: + deployment policy restricted to tag refs matching ``v*`` (the + ``publish-pypi`` job runs on every tag push). -Name reservation on public PyPI (an org admin, **before the rename lands on -the default branch** — the names are guessable from the public history the -moment it merges): +PyPI trusted publishing (an org admin, once, before the first release): 1. Create the Dash0 **organization account** on PyPI with enforced 2FA. -2. Check each of the five names is still unclaimed, then add a **pending - trusted publisher** per name, bound to ``reserve-pypi-names.yml`` and the - ``pypi`` environment of this repository. Pending publishers do not reserve - names — only the first upload does — so proceed immediately. -3. Run the ``Reserve PyPI names`` workflow. It publishes ``0.0.0.devN`` stubs - whose README points at the real index. Re-runs are safe - (``skip-existing``). -4. **Mandatory:** remove the five trusted publishers on PyPI in the same - session and verify in each project's Publishing settings that none remain. - A standing publisher binding is a publish capability to the public names - for anyone who can run the workflow. (Re-adding one takes two minutes if a - stub ever needs refreshing; increment ``N`` — PyPI permanently forbids - filename reuse.) +2. For each of the five package names, add a **pending trusted publisher** + bound to ``release.yml``, the ``publish-pypi`` job, and the ``pypi`` + environment of this repository. Pending publishers claim names on first + upload without pre-registering them. +3. SHA-pin ``pypa/gh-action-pypi-publish`` in ``release.yml`` (the current + placeholder uses ``@release/v1``; replace with the SHA of the latest + release and a version comment before merging). +4. Verify by pushing a pre-release tag (e.g. ``v0.3.0rc1``) and confirming + all five packages appear on PyPI under the Dash0 organization. 5. When the PEP 755 namespace-grant process goes live on PyPI, apply for a restricted grant on the ``dash0`` prefix through the organization account. @@ -247,7 +246,7 @@ Local build (dry run) dash0-opentelemetry-exporter-otlp-pyproto-common \ dash0-opentelemetry-exporter-otlp-pyproto-http \ dash0-opentelemetry-exporter-otlp-pyproto-grpc \ - dash0-opentelemetry-distro; do + dash0-opentelemetry; do uv build --package "$name" --out-dir dist \ --build-constraints scripts/build-constraints.txt done diff --git a/examples/dash0-distro-flask/docker-compose.yml b/examples/dash0-distro-flask/docker-compose.yml index 4f8f1e8..20b2bec 100644 --- a/examples/dash0-distro-flask/docker-compose.yml +++ b/examples/dash0-distro-flask/docker-compose.yml @@ -33,7 +33,7 @@ services: /workspace/packages/opentelemetry-exporter-otlp-pyproto-common \ /workspace/packages/opentelemetry-exporter-otlp-pyproto-http \ /workspace/packages/opentelemetry-exporter-otlp-pyproto-grpc \ - /workspace/packages/dash0-opentelemetry-distro \ + /workspace/packages/dash0-opentelemetry \ flask \ requests \ opentelemetry-instrumentation-flask diff --git a/examples/dash0-distro-flask/verify_pyproto.py b/examples/dash0-distro-flask/verify_pyproto.py index ff5b3ed..837aa95 100644 --- a/examples/dash0-distro-flask/verify_pyproto.py +++ b/examples/dash0-distro-flask/verify_pyproto.py @@ -24,7 +24,7 @@ "dash0-opentelemetry-exporter-otlp-pyproto-common", "dash0-opentelemetry-exporter-otlp-pyproto-http", "dash0-opentelemetry-exporter-otlp-pyproto-grpc", - "dash0-opentelemetry-distro", + "dash0-opentelemetry", ) # The non-opentelemetry-* packages the agent is allowed to pull in transitively, # as PEP 503-normalized names. Most are pure-Python support libraries of @@ -33,7 +33,7 @@ # a compiled extension but is deliberately accepted so the curated set can ship # system metrics. Everything else - including grpcio and protobuf - is rejected. # Keep this list in sync when bumping the pinned opentelemetry versions in -# dash0-opentelemetry-distro's pyproject.toml. +# dash0-opentelemetry's pyproject.toml. ALLOWED_NON_OTEL_REQUIREMENTS = ( "asgiref", "packaging", diff --git a/packages/dash0-opentelemetry-distro/README.rst b/packages/dash0-opentelemetry/README.rst similarity index 97% rename from packages/dash0-opentelemetry-distro/README.rst rename to packages/dash0-opentelemetry/README.rst index 91b5089..a332754 100644 --- a/packages/dash0-opentelemetry-distro/README.rst +++ b/packages/dash0-opentelemetry/README.rst @@ -1,6 +1,6 @@ -========================== -dash0-opentelemetry-distro -========================== +================== +dash0-opentelemetry +================== The Dash0 OpenTelemetry distribution for Python. It is the Python counterpart of the Dash0 Node.js distribution (``@dash0/opentelemetry``), adapted to Python's @@ -127,7 +127,7 @@ building an injectable tree — such as the dash0-operator's instrumentation image — 1. installs the distribution into a self-contained directory: - ``pip install --target dash0-opentelemetry-distro``; + ``pip install --target dash0-opentelemetry``; 2. copies the script to ``/sitecustomize.py``; 3. generates ``/all-dependencies.txt``, a flattened list of every requirement of the installed tree (one PEP 508 requirement per line). @@ -164,6 +164,6 @@ Status Prototype. The ``otlp_proto_http`` exporter is resolved from the in-repo pyproto workspace member, published as ``dash0-opentelemetry-exporter-otlp-pyproto-http`` -on the Dash0 package index (not on public PyPI). Not yet done: the injector's +on the Dash0 package index and on public PyPI. Not yet done: the injector's per-``libc`` packaging and the integration/injection test matrix. Unit tests do not require a running collector. diff --git a/packages/dash0-opentelemetry-distro/pyproject.toml b/packages/dash0-opentelemetry/pyproject.toml similarity index 97% rename from packages/dash0-opentelemetry-distro/pyproject.toml rename to packages/dash0-opentelemetry/pyproject.toml index b5959a3..4223891 100644 --- a/packages/dash0-opentelemetry-distro/pyproject.toml +++ b/packages/dash0-opentelemetry/pyproject.toml @@ -3,7 +3,7 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "dash0-opentelemetry-distro" +name = "dash0-opentelemetry" dynamic = ["version"] description = "Dash0 OpenTelemetry distribution for Python" readme = "README.rst" @@ -33,8 +33,7 @@ dependencies = [ # Pure-Python OTLP exporters (no native dependencies), vendored in this # workspace from open-telemetry/opentelemetry-packaging under Dash0-owned # distribution names (import paths and entry points stay upstream-shaped). - # Published on the Dash0 package index, not on public PyPI; resolvable there - # or from this workspace. + # Published on both the Dash0 package index and public PyPI. "dash0-opentelemetry-exporter-otlp-pyproto-http == 1.44.0", "dash0-opentelemetry-exporter-otlp-pyproto-grpc == 1.44.0", diff --git a/packages/dash0-opentelemetry-distro/src/dash0/__init__.py b/packages/dash0-opentelemetry/src/dash0/__init__.py similarity index 100% rename from packages/dash0-opentelemetry-distro/src/dash0/__init__.py rename to packages/dash0-opentelemetry/src/dash0/__init__.py diff --git a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/__init__.py b/packages/dash0-opentelemetry/src/dash0/opentelemetry/__init__.py similarity index 100% rename from packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/__init__.py rename to packages/dash0-opentelemetry/src/dash0/opentelemetry/__init__.py diff --git a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/_environment_variables.py b/packages/dash0-opentelemetry/src/dash0/opentelemetry/_environment_variables.py similarity index 100% rename from packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/_environment_variables.py rename to packages/dash0-opentelemetry/src/dash0/opentelemetry/_environment_variables.py diff --git a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/configurator.py b/packages/dash0-opentelemetry/src/dash0/opentelemetry/configurator.py similarity index 100% rename from packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/configurator.py rename to packages/dash0-opentelemetry/src/dash0/opentelemetry/configurator.py diff --git a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/distro.py b/packages/dash0-opentelemetry/src/dash0/opentelemetry/distro.py similarity index 100% rename from packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/distro.py rename to packages/dash0-opentelemetry/src/dash0/opentelemetry/distro.py diff --git a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/injector/__init__.py b/packages/dash0-opentelemetry/src/dash0/opentelemetry/injector/__init__.py similarity index 100% rename from packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/injector/__init__.py rename to packages/dash0-opentelemetry/src/dash0/opentelemetry/injector/__init__.py diff --git a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/injector/sitecustomize.py b/packages/dash0-opentelemetry/src/dash0/opentelemetry/injector/sitecustomize.py similarity index 97% rename from packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/injector/sitecustomize.py rename to packages/dash0-opentelemetry/src/dash0/opentelemetry/injector/sitecustomize.py index c651a68..8b1198b 100644 --- a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/injector/sitecustomize.py +++ b/packages/dash0-opentelemetry/src/dash0/opentelemetry/injector/sitecustomize.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # Bootstrap script for injector-based activation of the Dash0 OpenTelemetry distribution for Python. # -# This file ships inside the dash0-opentelemetry-distro wheel, but it is not meant to be imported from its packaged +# This file ships inside the dash0-opentelemetry wheel, but it is not meant to be imported from its packaged # location (importing it executes it). Consumers that build an injectable tree — such as the dash0-operator's # instrumentation image build — install the distribution into a self-contained directory -# (`pip install --target dash0-opentelemetry-distro`) and copy this file from its packaged location to +# (`pip install --target dash0-opentelemetry`) and copy this file from its packaged location to # `/sitecustomize.py`. The OpenTelemetry injector (https://github.com/open-telemetry/opentelemetry-injector) then # prepends `` to the PYTHONPATH environment variable of the processes to instrument, so that Python's `site` # machinery imports this script on interpreter startup. The script initializes the OpenTelemetry @@ -110,7 +110,7 @@ def _self_deactivate(current_site): def _shipped_opentelemetry_package_names(current_site): # The OpenTelemetry packages this distribution ships: the injected tree at current_site is exactly the pinned - # dependency closure of dash0-opentelemetry-distro (see its pyproject.toml), so enumerate the packages installed + # dependency closure of dash0-opentelemetry (see its pyproject.toml), so enumerate the packages installed # there instead of maintaining a hardcoded list. Only the OpenTelemetry-related packages count for the double # instrumentation check; overlap on the general-purpose support packages we also ship (wrapt, psutil, ...) is # common and is handled by the dependency version conflict check instead. diff --git a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/resource.py b/packages/dash0-opentelemetry/src/dash0/opentelemetry/resource.py similarity index 100% rename from packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/resource.py rename to packages/dash0-opentelemetry/src/dash0/opentelemetry/resource.py diff --git a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/settings.py b/packages/dash0-opentelemetry/src/dash0/opentelemetry/settings.py similarity index 100% rename from packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/settings.py rename to packages/dash0-opentelemetry/src/dash0/opentelemetry/settings.py diff --git a/packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/version.py b/packages/dash0-opentelemetry/src/dash0/opentelemetry/version.py similarity index 100% rename from packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/version.py rename to packages/dash0-opentelemetry/src/dash0/opentelemetry/version.py diff --git a/packages/dash0-opentelemetry-distro/tests/__init__.py b/packages/dash0-opentelemetry/tests/__init__.py similarity index 100% rename from packages/dash0-opentelemetry-distro/tests/__init__.py rename to packages/dash0-opentelemetry/tests/__init__.py diff --git a/packages/dash0-opentelemetry-distro/tests/test_distro.py b/packages/dash0-opentelemetry/tests/test_distro.py similarity index 100% rename from packages/dash0-opentelemetry-distro/tests/test_distro.py rename to packages/dash0-opentelemetry/tests/test_distro.py diff --git a/packages/dash0-opentelemetry-distro/tests/test_instrumentations.py b/packages/dash0-opentelemetry/tests/test_instrumentations.py similarity index 98% rename from packages/dash0-opentelemetry-distro/tests/test_instrumentations.py rename to packages/dash0-opentelemetry/tests/test_instrumentations.py index ff769f0..196cbf6 100644 --- a/packages/dash0-opentelemetry-distro/tests/test_instrumentations.py +++ b/packages/dash0-opentelemetry/tests/test_instrumentations.py @@ -13,7 +13,7 @@ from opentelemetry.instrumentation import bootstrap_gen from packaging.requirements import Requirement -_DISTRO = "dash0-opentelemetry-distro" +_DISTRO = "dash0-opentelemetry" def _declared(): diff --git a/packages/dash0-opentelemetry-distro/tests/test_resource.py b/packages/dash0-opentelemetry/tests/test_resource.py similarity index 100% rename from packages/dash0-opentelemetry-distro/tests/test_resource.py rename to packages/dash0-opentelemetry/tests/test_resource.py diff --git a/packages/dash0-opentelemetry-distro/tests/test_settings.py b/packages/dash0-opentelemetry/tests/test_settings.py similarity index 100% rename from packages/dash0-opentelemetry-distro/tests/test_settings.py rename to packages/dash0-opentelemetry/tests/test_settings.py diff --git a/packages/dash0-opentelemetry-distro/tests/test_sitecustomize.py b/packages/dash0-opentelemetry/tests/test_sitecustomize.py similarity index 100% rename from packages/dash0-opentelemetry-distro/tests/test_sitecustomize.py rename to packages/dash0-opentelemetry/tests/test_sitecustomize.py diff --git a/pyproject.toml b/pyproject.toml index c0dd4dc..0d6da3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ members = ["packages/*"] exclude = ["examples/*"] [tool.uv.sources] -dash0-opentelemetry-distro = { workspace = true } +dash0-opentelemetry = { workspace = true } dash0-opentelemetry-pyproto = { workspace = true } dash0-opentelemetry-exporter-otlp-pyproto-common = { workspace = true } dash0-opentelemetry-exporter-otlp-pyproto-http = { workspace = true } diff --git a/ruff.toml b/ruff.toml index 7815598..f661a9f 100644 --- a/ruff.toml +++ b/ruff.toml @@ -8,7 +8,7 @@ extend-exclude = [ # The injector bootstrap script must stay valid Python 2.7+ (it runs, and # gracefully self-deactivates, on any interpreter the injector touches), so # the py310 style rules cannot apply to it. - "packages/dash0-opentelemetry-distro/src/dash0/opentelemetry/injector/sitecustomize.py", + "packages/dash0-opentelemetry/src/dash0/opentelemetry/injector/sitecustomize.py", "packages/opentelemetry-pyproto", "packages/opentelemetry-exporter-otlp-pyproto-common", "packages/opentelemetry-exporter-otlp-pyproto-http", diff --git a/scripts/check_pinned_dependencies.py b/scripts/check_pinned_dependencies.py index 6cfd3bf..ad4fc59 100644 --- a/scripts/check_pinned_dependencies.py +++ b/scripts/check_pinned_dependencies.py @@ -1,7 +1,7 @@ """Enforce the distribution's dependency policy (see its README). The distro ships a curated set of upstream packages, so every dependency in -``packages/dash0-opentelemetry-distro/pyproject.toml`` must be pinned to an +``packages/dash0-opentelemetry/pyproject.toml`` must be pinned to an exact version (``== X.Y.Z``). Two exemptions: * uv workspace members (the in-repo pyproto packages): their version is fixed @@ -27,7 +27,7 @@ import tomllib ROOT = Path(__file__).resolve().parent.parent -DISTRO_PYPROJECT = ROOT / "packages" / "dash0-opentelemetry-distro" / "pyproject.toml" +DISTRO_PYPROJECT = ROOT / "packages" / "dash0-opentelemetry" / "pyproject.toml" # name, optional [extras], remainder (version specifier); the environment # marker (after ';') is split off before matching. @@ -73,7 +73,7 @@ def _distro_closure(): "uv", "export", "--package", - "dash0-opentelemetry-distro", + "dash0-opentelemetry", "--frozen", "--no-dev", "--no-hashes", diff --git a/scripts/check_sitecustomize_python27.py b/scripts/check_sitecustomize_python27.py index 2fc5894..44b8b12 100644 --- a/scripts/check_sitecustomize_python27.py +++ b/scripts/check_sitecustomize_python27.py @@ -29,7 +29,7 @@ SITECUSTOMIZE = ( REPO_ROOT / "packages" - / "dash0-opentelemetry-distro" + / "dash0-opentelemetry" / "src" / "dash0" / "opentelemetry" diff --git a/scripts/tests/test_build_simple_index.py b/scripts/tests/test_build_simple_index.py index 8e4f51a..d929915 100644 --- a/scripts/tests/test_build_simple_index.py +++ b/scripts/tests/test_build_simple_index.py @@ -16,7 +16,7 @@ REPO = "dash0hq/opentelemetry-python-distribution" URL_PREFIX = f"https://github.com/{REPO}/releases/download" -DISTRO_WHEEL = "dash0_opentelemetry_distro-0.1.0-py3-none-any.whl" +DISTRO_WHEEL = "dash0_opentelemetry-0.1.0-py3-none-any.whl" PYPROTO_WHEEL = "dash0_opentelemetry_pyproto-1.44.0-py3-none-any.whl" @@ -114,7 +114,7 @@ def test_github_prerelease_assets_are_indexed(): # legitimately carries stable-versioned vendored wheels, and a # post-publish index failure on immutable assets would deadlock the # pipeline. Pre-releaseness lives in the PEP 440 version string. - rc_wheel = "dash0_opentelemetry_distro-0.1.0rc1-py3-none-any.whl" + rc_wheel = "dash0_opentelemetry-0.1.0rc1-py3-none-any.whl" entries, _ = collect( [release("v0.1.0rc1", [rc_wheel, PYPROTO_WHEEL], prerelease=True)], contents={rc_wheel: b"rc", PYPROTO_WHEEL: b"pyproto"}, @@ -157,7 +157,7 @@ def test_excluded_filenames_skip_both_guard_and_index(): def test_yanked_versions_carry_reason(): - yanked = {("dash0-opentelemetry-distro", "0.1.0"): "broken"} + yanked = {("dash0-opentelemetry", "0.1.0"): "broken"} entries, _ = collect([release("v0.1.0", [DISTRO_WHEEL])], yanked=yanked) assert entries[0].yanked_reason == "broken" @@ -165,7 +165,7 @@ def test_yanked_versions_carry_reason(): def test_yank_entry_matching_nothing_aborts(): # A yank that matches no indexed file is a silent no-op: the withdrawn # version would keep being served. Generation must fail instead. - yanked = {("dash0-opentelemetry-distro", "0.1.0-rc1"): "broken"} + yanked = {("dash0-opentelemetry", "0.1.0-rc1"): "broken"} with pytest.raises(bsi.IndexGenerationError) as excinfo: collect([release("v0.1.0", [DISTRO_WHEEL])], yanked=yanked) assert "matched no indexed file" in str(excinfo.value) @@ -175,7 +175,7 @@ def test_yank_entry_matching_nothing_aborts(): def test_expected_projects_derived_from_workspace(): assert bsi.expected_projects() == frozenset( { - "dash0-opentelemetry-distro", + "dash0-opentelemetry", "dash0-opentelemetry-pyproto", "dash0-opentelemetry-exporter-otlp-pyproto-common", "dash0-opentelemetry-exporter-otlp-pyproto-http", @@ -186,7 +186,7 @@ def test_expected_projects_derived_from_workspace(): def test_project_names_normalize_per_pep503(): entries, _ = collect([release("v0.1.0", [DISTRO_WHEEL])]) - assert entries[0].project == "dash0-opentelemetry-distro" + assert entries[0].project == "dash0-opentelemetry" def test_generated_site_shape(tmp_path): @@ -197,12 +197,12 @@ def test_generated_site_shape(tmp_path): bsi.generate_site(entries, tmp_path, REPO) simple = (tmp_path / "simple" / "index.html").read_text() - assert '' in simple + assert '' in simple assert '' in simple assert '' in simple distro = ( - tmp_path / "simple" / "dash0-opentelemetry-distro" / "index.html" + tmp_path / "simple" / "dash0-opentelemetry" / "index.html" ).read_text() assert f'href="{URL_PREFIX}/v0.1.0/{DISTRO_WHEEL}#sha256={sha256(b"distro")}"' in ( distro @@ -289,7 +289,7 @@ def test_generated_site_escapes_hostile_filename_and_url(tmp_path): # The artifact regex admits HTML metacharacters in the version segment, so # a hostile asset name must not break out of the href/text it is rendered # into. (Requires release-write access; this is defense in depth.) - hostile = 'dash0_opentelemetry_distro-0.1.0">