Skip to content

Replace deprecated collections.Iterable with collections.abc.Iterable#19329

Merged
wangxin merged 1 commit intosonic-net:masterfrom
yutongzhang-microsoft:yutongzhang/replace_iterable
Jul 3, 2025
Merged

Replace deprecated collections.Iterable with collections.abc.Iterable#19329
wangxin merged 1 commit intosonic-net:masterfrom
yutongzhang-microsoft:yutongzhang/replace_iterable

Conversation

@yutongzhang-microsoft
Copy link
Copy Markdown
Contributor

Description of PR

Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Approach

What is the motivation for this PR?

Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?

We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?

We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@wangxin wangxin merged commit 92a27c6 into sonic-net:master Jul 3, 2025
18 checks passed
@yutongzhang-microsoft yutongzhang-microsoft deleted the yutongzhang/replace_iterable branch July 3, 2025 02:40
Copy link
Copy Markdown
Collaborator

@lolyu lolyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix.

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jul 3, 2025
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202505: #19388

@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202405: Azure/sonic-mgmt.msft#492

mssonicbld pushed a commit that referenced this pull request Jul 3, 2025
What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202412: Azure/sonic-mgmt.msft#500

nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Aug 7, 2025
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.
ashutosh-agrawal pushed a commit to ashutosh-agrawal/sonic-mgmt that referenced this pull request Aug 14, 2025
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.

Signed-off-by: opcoder0 <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.

Signed-off-by: Guy Shemesh <[email protected]>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.

Signed-off-by: Aharon Malkin <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.

Signed-off-by: Guy Shemesh <[email protected]>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.

Signed-off-by: Guy Shemesh <[email protected]>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.

Signed-off-by: Yael Tzur <[email protected]>
auspham pushed a commit to auspham/sonic-mgmt that referenced this pull request Feb 3, 2026
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.
auspham pushed a commit to auspham/sonic-mgmt that referenced this pull request Feb 3, 2026
…le (sonic-net#19329) (sonic-net#502)

Cherry sonic-net#19329
What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor
of collections.abc.Iterable, though it remained temporarily supported
for backward compatibility. However, as of Python 3.10, the old
reference has been officially removed. Doc image

Since we are upgrading Python from 3.8 to 3.12—where
collections.Iterable is no longer supported—we will update all such
references to use collections.abc.Iterable to ensure compatibility and
prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to
ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly
-- test by pipeline itself. And then, we need to make sure that this
change works in the new version -- test locally.
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Mar 27, 2026
…#19329)

What is the motivation for this PR?
Starting with Python 3.3, collections.Iterable was deprecated in favor of collections.abc.Iterable, though it remained temporarily supported for backward compatibility. However, as of Python 3.10, the old reference has been officially removed. Doc
image

Since we are upgrading Python from 3.8 to 3.12—where collections.Iterable is no longer supported—we will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you do it?
We will update all such references to use collections.abc.Iterable to ensure compatibility and prevent runtime errors.

How did you verify/test it?
We need to make sure that this change won't affect current test firstly -- test by pipeline itself. And then, we need to make sure that this change works in the new version -- test locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment