Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline 'get_release_and_version' definition #240

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -15,7 +15,33 @@
import os
from setuptools import setup, find_packages
from typing import List, Dict, Tuple
from utils.artifacts import get_release_and_version


def get_release_and_version(package_path: str) -> Tuple[bool, bool, str, str, str, str]:
"""
Load version and release info from compressed-tensors package
"""
# compressed-tensors/src/compressed_tensors/version.py always exists, default source of truth
version_path = os.path.join(package_path, "version.py")

# exec() cannot set local variables so need to manually
locals_dict = {}
exec(open(version_path).read(), globals(), locals_dict)
is_release = locals_dict.get("is_release", False)
version = locals_dict.get("version", "unknown")
version_major = locals_dict.get("version_major", "unknown")
version_minor = locals_dict.get("version_minor", "unknown")
version_bug = locals_dict.get("version_bug", "unknown")

print(f"Loaded version {version} from {version_path}")

return (
is_release,
version,
version_major,
version_minor,
version_bug,
)


package_path = os.path.join(
Expand All @@ -35,7 +61,7 @@
_PACKAGE_NAME = "compressed-tensors"
else:
_PACKAGE_NAME = "compressed-tensors-nightly"


def _setup_long_description() -> Tuple[str, str]:
return open("README.md", "r", encoding="utf-8").read(), "text/markdown"
Expand All @@ -44,7 +70,7 @@ def _setup_packages() -> List:
return find_packages(
"src", include=["compressed_tensors", "compressed_tensors.*"], exclude=["*.__pycache__.*"]
)

def _setup_install_requires() -> List:
return ["torch>=1.7.0", "transformers", "pydantic>=2.0"]

Expand Down
44 changes: 0 additions & 44 deletions utils/artifacts.py

This file was deleted.