Unverified Commit e489ad7a authored by Russell Bryant's avatar Russell Bryant Committed by GitHub
Browse files

[Misc] Add SPDX-License-Identifier headers to python source files (#12628)

- **Add SPDX license headers to python source files**
- **Check for SPDX headers using pre-commit**

commit 9d7ef44c3cfb72ca4c32e1c677d99259d10d4745
Author: Russell Bryant <rbryant@redhat.com>
Date:   Fri Jan 31 14:18:24 2025 -0500

    Add SPDX license headers to python source files
    
This commit adds SPDX license headers to python source files as
recommended to
the project by the Linux Foundation. These headers provide a concise way
that is
both human and machine readable for communicating license information
for each
source file. It helps avoid any ambiguity about the license of the code
and can
    also be easily used by tools to help manage license compliance.
    
The Linux Foundation runs license scans against the codebase to help
ensure
    we are in compliance with the licenses of the code we use, including
dependencies. Having these headers in place helps that tool do its job.
    
    More information can be found on the SPDX site:
    
    - https://spdx.dev/learn/handling-license-info/

Signed-off-by: default avatarRussell Bryant <rbryant@redhat.com>

commit 5a1cf1cb3b80759131c73f6a9dddebccac039dea
Author: Russell Bryant <rbryant@redhat.com>
Date:   Fri Jan 31 14:36:32 2025 -0500

    Check for SPDX headers using pre-commit
Signed-off-by: default avatarRussell Bryant <rbryant@redhat.com>

---------
Signed-off-by: default avatarRussell Bryant <rbryant@redhat.com>
parent f256ebe4
# SPDX-License-Identifier: Apache-2.0
import itertools
from typing import List
......
# SPDX-License-Identifier: Apache-2.0
import dataclasses
from typing import List, Tuple, Type
......
# SPDX-License-Identifier: Apache-2.0
from typing import List
import pytest
......
# SPDX-License-Identifier: Apache-2.0
import torch
from vllm.engine.arg_utils import EngineArgs
......
# SPDX-License-Identifier: Apache-2.0
import torch
from vllm.engine.arg_utils import EngineArgs
......
# SPDX-License-Identifier: Apache-2.0
import sys
SPDX_HEADER = "# SPDX-License-Identifier: Apache-2.0"
SPDX_HEADER_PREFIX = "# SPDX-License-Identifier:"
def check_spdx_header(file_path):
with open(file_path, encoding='UTF-8') as file:
lines = file.readlines()
if not lines:
# not necessary for an empty file like __init__.py
return True
if not lines[0].strip().startswith(SPDX_HEADER_PREFIX):
return False
return True
def add_header(file_path):
with open(file_path, 'r+', encoding='UTF-8') as file:
lines = file.readlines()
file.seek(0, 0)
file.write(SPDX_HEADER + '\n\n' + ''.join(lines))
def main():
files_with_missing_header = []
for file_path in sys.argv[1:]:
if not check_spdx_header(file_path):
files_with_missing_header.append(file_path)
if files_with_missing_header:
print("The following files are missing the SPDX header:")
for file_path in files_with_missing_header:
print(f" {file_path}")
add_header(file_path)
sys.exit(1 if files_with_missing_header else 0)
if __name__ == "__main__":
main()
# SPDX-License-Identifier: Apache-2.0
import argparse
import json
from typing import Dict
......
# SPDX-License-Identifier: Apache-2.0
import argparse
import copy
import json
......
# SPDX-License-Identifier: Apache-2.0
#!/usr/bin/env python3
# Copyright (c) 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
......
# SPDX-License-Identifier: Apache-2.0
import glob
requires_files = glob.glob('requirements*.txt')
......
# SPDX-License-Identifier: Apache-2.0
"""vLLM: a high-throughput and memory-efficient inference engine for LLMs"""
import os
......
# SPDX-License-Identifier: Apache-2.0
import contextlib
import importlib
from typing import TYPE_CHECKING, List, Optional, Tuple, Union
......
# SPDX-License-Identifier: Apache-2.0
from typing import List, Optional, Tuple
import torch
......
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from typing import Tuple
......
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
from typing import Any, Callable, Dict, Optional, TypeVar
......
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
......
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Callable, Dict, Optional, Set
......
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
from typing import Any, Optional, Set
......
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from typing import Literal
from urllib.parse import urljoin
......
# SPDX-License-Identifier: Apache-2.0
from functools import lru_cache
from pathlib import Path
from typing import Optional
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment