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

fix ci for core #26923

Merged
merged 12 commits into from
Oct 19, 2022
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
1 change: 1 addition & 0 deletions eng/conda_test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ adal
setuptools==46.4.0
pytest-asyncio==0.12.0
-e sdk/core/azure-core/tests/testserver_tests/coretestserver
azure-mgmt-storage
54 changes: 52 additions & 2 deletions eng/tox/install_depend_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@
import logging
import re
from subprocess import check_call
from typing import TYPE_CHECKING
from pkg_resources import parse_version
from pypi_tools.pypi import PyPIClient
from packaging.specifiers import SpecifierSet
from packaging.version import Version, parse
import pdb

from ci_tools.parsing import ParsedSetup, parse_require


from typing import List

DEV_REQ_FILE = "dev_requirements.txt"
NEW_DEV_REQ_FILE = "new_dev_requirements.txt"
PKGS_TXT_FILE = "packages.txt"
Expand All @@ -33,11 +40,19 @@
"azure-core": "1.11.0",
"requests": "2.19.0",
"six": "1.12.0",
"cryptography": "3.3.2"
"cryptography": "3.3.2",
}

MAXIMUM_VERSION_SUPPORTED_OVERRIDE = {"cryptography": "4.0.0"}

SPECIAL_CASE_OVERRIDES = {
# this package has an override
"azure-core": {
# if the version being installed matches this specifier, add the listed packages to the install list
"<1.24.0": ["msrest<0.7.0"]
}
}


def install_dependent_packages(setup_py_file_path, dependency_type, temp_dir):
# This method identifies latest/ minimal version of dependent packages and installs them from pyPI
Expand All @@ -46,13 +61,25 @@ def install_dependent_packages(setup_py_file_path, dependency_type, temp_dir):
# Minimum type will find minimum version on PyPI that satisfies requires of given package name

released_packages = find_released_packages(setup_py_file_path, dependency_type)

override_added_packages = []

# new section added to account for difficulties with msrest
for pkg_spec in released_packages:
override_added_packages.extend(check_pkg_against_overrides(pkg_spec))

logging.info("%s released packages: %s", dependency_type, released_packages)
# filter released packages from dev_requirements and create a new file "new_dev_requirements.txt"
dev_req_file_path = filter_dev_requirements(setup_py_file_path, released_packages, temp_dir)

if override_added_packages:
logging.info(f"Expanding the requirement set by the packages {override_added_packages}.")

install_set = released_packages + list(set(override_added_packages))

# install released dependent packages
if released_packages or dev_req_file_path:
install_packages(released_packages, dev_req_file_path)
install_packages(install_set, dev_req_file_path)

if released_packages:
# create a file with list of packages and versions found based on minimum or latest check on PyPI
Expand All @@ -64,6 +91,28 @@ def install_dependent_packages(setup_py_file_path, dependency_type, temp_dir):
logging.info("Created file %s to track azure packages found on PyPI", pkgs_file_path)


def check_pkg_against_overrides(pkg_specifier: str) -> List[str]:
"""
Checks a set of package specifiers of form "[A==1.0.0, B=2.0.0]". Used to inject additional package installations
as indicated by the SPECIAL_CASE_OVERRIDES dictionary.

:param str pkg_specifier: A specifically targeted package that is about to be passed to install_packages.
"""
additional_installs = []
target_package, target_version = pkg_specifier.split("==")

target_version = Version(target_version)
if target_package in SPECIAL_CASE_OVERRIDES:
special_case_specifiers = SPECIAL_CASE_OVERRIDES[target_package]

for specifier_set in special_case_specifiers.keys():
spec = SpecifierSet(specifier_set)
if target_version in spec:
additional_installs.extend(special_case_specifiers[specifier_set])

return additional_installs


def find_released_packages(setup_py_path, dependency_type):
# this method returns list of required available package on PyPI in format <package-name>==<version>

Expand All @@ -72,6 +121,7 @@ def find_released_packages(setup_py_path, dependency_type):

# Get available version on PyPI for each required package
avlble_packages = [x for x in map(lambda x: process_requirement(x, dependency_type), requires) if x]

return avlble_packages


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
../azure-mgmt-communication
aiohttp>=3.0
-e ../../../tools/azure-devtools
parameterized>=0.7.3
parameterized>=0.7.3
python-dateutil>=2.8.0
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@

from requests import Request, Response

from msrest import Deserializer

from azure.core.polling import async_poller, AsyncLROPoller
from azure.core.exceptions import DecodeError, HttpResponseError
from azure.core import AsyncPipelineClient
Expand Down
8 changes: 4 additions & 4 deletions sdk/core/azure-core/tests/async_tests/test_polling_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from azure.core import AsyncPipelineClient
from azure.core.polling import *
from azure.core.exceptions import ServiceResponseError
from msrest.serialization import Model
# from msrest.serialization import Model


@pytest.fixture
Expand Down Expand Up @@ -145,9 +145,9 @@ def deserialization_callback(response):
assert raw_poller.polling_method() is method
done_cb.assert_called_once_with(poller)

# Test with a basic Model
poller = AsyncLROPoller(client, initial_response, Model, method)
assert poller._polling_method._deserialization_callback == Model.deserialize
# # Test with a basic Model
xiangyan99 marked this conversation as resolved.
Show resolved Hide resolved
# poller = AsyncLROPoller(client, initial_response, Model, method)
# assert poller._polling_method._deserialization_callback == Model.deserialize

# Test poller that method do a run
method = PollingTwoSteps(sleep=1)
Expand Down
8 changes: 4 additions & 4 deletions sdk/core/azure-core/tests/test_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from azure.core.polling.base_polling import (
LROBasePolling, LocationPolling
)
from msrest.serialization import Model
# from msrest.serialization import Model


@pytest.fixture
Expand Down Expand Up @@ -181,9 +181,9 @@ def deserialization_callback(response):
assert poller.polling_method() is method
done_cb.assert_called_once_with(method)

# Test with a basic Model
poller = LROPoller(client, initial_response, Model, method)
assert poller._polling_method._deserialization_callback == Model.deserialize
# # Test with a basic Model
# poller = LROPoller(client, initial_response, Model, method)
# assert poller._polling_method._deserialization_callback == Model.deserialize

# Test poller that method do a run
method = PollingTwoSteps(sleep=1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

from requests import Request, Response

from msrest import Deserializer

from azure.core.polling import async_poller
from azure.core.exceptions import DecodeError, HttpResponseError
from azure.core import AsyncPipelineClient
Expand Down
2 changes: 0 additions & 2 deletions sdk/core/azure-mgmt-core/tests/test_arm_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

from requests import Request, Response

from msrest import Deserializer

from azure.core.polling import LROPoller
from azure.core.exceptions import DecodeError, HttpResponseError
from azure.core import PipelineClient
Expand Down
3 changes: 2 additions & 1 deletion sdk/identity/azure-identity/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
aiohttp>=3.0
typing_extensions>=3.7.2
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../../tools/azure-devtools
azure-mgmt-resource<=21.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
aiohttp>=3.0
azure-storage-blob==12.6.0
parameterized>=0.7.3
python-dateutil>=2.8.0
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
../../nspkg/azure-keyvault-nspkg
aiohttp>=3.0
parameterized>=0.7.3
python-dateutil>=2.8.0
1 change: 1 addition & 0 deletions sdk/keyvault/azure-keyvault-keys/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
aiohttp>=3.0
azure-identity
parameterized>=0.7.3
python-dateutil>=2.8.0
1 change: 1 addition & 0 deletions sdk/keyvault/azure-keyvault-secrets/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
../../nspkg/azure-keyvault-nspkg
aiohttp>=3.0
parameterized>=0.7.3
python-dateutil>=2.8.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
-e ../../../tools/azure-devtools
-e ../../identity/azure-identity
../../core/azure-core
aiohttp>=3.0
aiohttp>=3.0
python-dateutil>=2.8.0
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-blob/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
../../core/azure-core
azure-identity
-e ../../storage/azure-mgmt-storage
aiohttp>=3.0
aiohttp>=3.0
1 change: 1 addition & 0 deletions sdk/tables/azure-data-tables/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
../../nspkg/azure-data-nspkg
aiohttp>=3.0
azure-identity
python-dateutil>=2.8.0