chore: switch to SPDX license headers#5177
Open
MikeGoldsmith wants to merge 2 commits intoopen-telemetry:mainfrom
Open
chore: switch to SPDX license headers#5177MikeGoldsmith wants to merge 2 commits intoopen-telemetry:mainfrom
MikeGoldsmith wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
Replace the 13-line Apache 2.0 license header with the 2-line SPDX equivalent across all Python files. Add a CI check to enforce the header on new files going forward. Closes open-telemetry#5170 Assisted-by: Claude Opus 4.6
Assisted-by: Claude Opus 4.6
90d483e to
815a670
Compare
herin049
approved these changes
May 6, 2026
|
|
||
|
|
||
| def main(): | ||
| root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
Contributor
There was a problem hiding this comment.
Small nit, but you could make this a bit less verbose:
Suggested change
| root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| root = str(Path(__file__).resolve().parents[1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
# SPDX-License-Identifier: Apache-2.0) across all Python filesscripts/check_license_header.pyenforcement script andlint-license-header-checktox env to catch missing headers in CI541 files had their existing Apache header replaced with the SPDX equivalent. During the migration, 31 files were found with missing or inconsistent headers:
opentelemetry-api/src/opentelemetry/trace/span.py, files intests/events/,tests/metrics/,shim/tests/testbed/)#line after the copyright)All of these now have the correct SPDX header. Generated files (
*_pb2.py,*_pb2_grpc.py,datamodel-codegenoutput) and empty__init__.pyfiles are excluded from the check.Motivation
Other OTel SDKs have already adopted SPDX headers:
The SPDX format is functionally and legally equivalent. It reduces visual noise and aligns Python with the rest of the OTel ecosystem.
Closes #5170
Changes
lint-license-header-checktox env + regeneratedlint.yml