Skip to content

Move KV Keys to pyproject.toml #39100

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions eng/ci_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ typing-extensions<=4.6.3
pyproject-api<1.6
cibuildwheel==2.16.5
importlib-metadata==8.0.0
build==1.2.2.post1

# requirements leveraged for testing
pytest==7.3.1
Expand Down
2 changes: 1 addition & 1 deletion eng/scripts/get_package_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# Use abspath for the os.walk because if setup parsing fails it often changes cwd which throws off the relative walk
for root, dirs, files in os.walk(os.path.abspath(args.search_path)):
if re.search(r"sdk[\\/][^\\/]+[\\/][^\\/]+$", root):
if "setup.py" in files:
if "setup.py" or "pyproject.toml" in files:
try:
parsed = ParsedSetup.from_path(root)

Expand Down
1 change: 1 addition & 0 deletions eng/test_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ coverage==7.2.5
bandit==1.6.2
protobuf==3.17.3; python_version == '2.7'
pyproject-api<1.6
build==1.2.2.post1

# locking packages defined as deps from azure-sdk-tools
Jinja2==3.1.2
Expand Down
10 changes: 6 additions & 4 deletions eng/tox/install_depend_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def check_req_against_exclusion(req, req_to_exclude):


def filter_dev_requirements(
setup_py_path,
package_directory,
released_packages,
temp_dir,
additional_filter_fn: Optional[Callable[[str, List[str], List[Requirement]], List[str]]] = None,
Expand All @@ -323,7 +323,7 @@ def filter_dev_requirements(
by the package).
"""
# This method returns list of requirements from dev_requirements by filtering out packages in given list
dev_req_path = os.path.join(os.path.dirname(setup_py_path), DEV_REQ_FILE)
dev_req_path = os.path.join(package_directory, DEV_REQ_FILE)
requirements = []
with open(dev_req_path, "r") as dev_req_file:
requirements = dev_req_file.readlines()
Expand All @@ -347,7 +347,7 @@ def filter_dev_requirements(

if additional_filter_fn:
# this filter function handles the case where a dev requirement is incompatible with the current set of targeted packages
filtered_req = additional_filter_fn(setup_py_path, filtered_req, released_packages)
filtered_req = additional_filter_fn(package_directory, filtered_req, released_packages)

logging.info("Filtered dev requirements: %s", filtered_req)

Expand Down Expand Up @@ -409,10 +409,12 @@ def install_packages(packages, req_file):
)

args = parser.parse_args()
setup_path = os.path.join(os.path.abspath(args.target_package), "setup.py")

setup_path = os.path.join(os.path.abspath(args.target_package))

if not (os.path.exists(setup_path) and os.path.exists(args.work_dir)):
logging.error("Invalid arguments. Please make sure target directory and working directory are valid path")
sys.exit(1)


install_dependent_packages(setup_path, args.dependency_type, args.work_dir)
2 changes: 1 addition & 1 deletion eng/tox/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ envlist = whl,sdist
deps =
-r {repository_root}/eng/test_tools.txt


[coverage:paths]
source =
azure
Expand All @@ -45,6 +44,7 @@ pkgs =
packaging==23.1
urllib3==1.26.15
tomli==2.0.1
build==1.2.2.post1

[pytest]
ignore_args=--ignore=.tox --ignore=build --ignore=.eggs --ignore=samples
Expand Down
44 changes: 44 additions & 0 deletions sdk/keyvault/azure-keyvault-keys/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,46 @@
[build-system]
requires = ["setuptools>=61.0.0", "wheel"] # Requires 61.0.0 for dynamic version
build-backend = "setuptools.build_meta"

[project]
name = "azure-keyvault-keys"
authors = [
{name = "Microsoft Corporation", email = "[email protected]"},
]
description = "Microsoft Azure Key Vault Keys Client Library for Python"
keywords = ["azure", "azure sdk"]
requires-python = ">=3.8"
license = {text = "MIT License"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
]
dependencies = [
"azure-core>=1.31.0",
"cryptography>=2.1.4",
"isodate>=0.6.1",
"typing-extensions>=4.0.1",
]
dynamic = ["version", "readme"]

[project.urls]
repository = "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/keyvault/azure-keyvault-keys"

[tool.setuptools.dynamic]
version = {attr = "azure.keyvault.keys._version.VERSION"}
readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"}

[tool.setuptools.packages.find]
exclude = ["samples", "tests", "azure", "azure.keyvault"]

[tool.azure-sdk-build]
pyright = false
76 changes: 0 additions & 76 deletions sdk/keyvault/azure-keyvault-keys/setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tools/azure-sdk-tools/ci_tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def create_package(
pip_output = get_pip_list_output(sys.executable)
necessary_install_requirements = [req for req in setup_parsed.requires if parse_require(req).key not in pip_output.keys()]
run([sys.executable, "-m", "pip", "install", *necessary_install_requirements], cwd=setup_parsed.folder)
run([sys.executable, "-m", "build", f"-n{'s' if enable_sdist else ''}{'w' if enable_wheel else ''}", "-o", dist], cwd=setup_parsed.folder)
run([sys.executable, "-m", "build", f"-n{'s' if enable_sdist else ''}{'w' if enable_wheel else ''}", "-o", dist], cwd=setup_parsed.folder, check=True)
else:
if enable_wheel:
if setup_parsed.ext_modules:
Expand Down
2 changes: 1 addition & 1 deletion tools/azure-sdk-tools/ci_tools/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def process_requires(setup_py_path: str, is_dev_build: bool = False):
else:
logging.info("Packages not available on PyPI:{}".format(requirement_to_update))
update_requires(setup_py_path, requirement_to_update)
logging.info("Package requirement is updated in setup.py")
logging.info(f"Package requirement is updated in {'pyproject.toml' if pkg_details.is_pyproject else 'setup.py'}.")


def find_sdist(dist_dir: str, pkg_name: str, pkg_version: str) -> Optional[str]:
Expand Down
7 changes: 3 additions & 4 deletions tools/azure-sdk-tools/ci_tools/scenario/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def create_package_and_install(

commands_options = []
built_pkg_path = ""
setup_py_path = os.path.join(target_setup, "setup.py")
additional_downloaded_reqs = []

if not os.path.exists(distribution_directory):
Expand All @@ -69,10 +68,10 @@ def create_package_and_install(
commands_options.extend(["--cache-dir", cache_dir])

discovered_packages = discover_packages(
setup_py_path, distribution_directory, target_setup, package_type, force_create
target_setup, distribution_directory, target_setup, package_type, force_create
)

target_package = ParsedSetup.from_path(setup_py_path)
target_package = ParsedSetup.from_path(target_setup)

# ensure that discovered packages are always copied to the distribution directory regardless of other factors
for built_package in discovered_packages:
Expand Down Expand Up @@ -104,7 +103,7 @@ def create_package_and_install(
logging.info("Installing {w} from fresh built package.".format(w=built_package))

if not pre_download_disabled:
requirements = ParsedSetup.from_path(os.path.join(os.path.abspath(target_setup), "setup.py")).requires
requirements = ParsedSetup.from_path(os.path.join(os.path.abspath(target_setup))).requires
azure_requirements = [req.split(";")[0] for req in requirements if req.startswith("azure-")]

if azure_requirements:
Expand Down
Loading