Skip to content

gh-117404: Soft deprecate zlib.ZLIB_RUNTIME_VERSION - #157816

Open
StanFromIreland wants to merge 3 commits into
python:mainfrom
StanFromIreland:ZLIB_RUNTIME_VERSION
Open

StanFromIreland wants to merge 3 commits into
python:mainfrom
StanFromIreland:ZLIB_RUNTIME_VERSION

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

As it's now an alias to zlib.zlib_version, I propose we soft deprecate the old API to encourage people to use the new one. It does still have a bit of use, so I'm not proposing we deprecate just yet.

@read-the-docs-community

read-the-docs-community Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

@serhiy-storchaka

Copy link
Copy Markdown
Member

Would not it be better to wait until we have zlib_version in all maintained versions?

@StanFromIreland

Copy link
Copy Markdown
Member Author

This is just a soft deprecation, I'd like to deprecate it normally then, which is a few years down the line.

Comment thread Doc/library/zlib.rst Outdated
.. versionadded:: next


.. data:: ZLIB_RUNTIME_VERSION

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn't it look confusing that an alias is added earlier?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Possibly, but I don't really foresee that being a particularly significant issue in practice. It's also not the first time this has happened, see re.match for example.

@serhiy-storchaka

Copy link
Copy Markdown
Member

I am confused by soft-deprecation. Why not leave it as is if it does not harm? @vstinner, @hugovk.

@StanFromIreland

Copy link
Copy Markdown
Member Author

It’s an indication that you shouldn’t use it (since we’re planning to remove the alias in a few years).

@serhiy-storchaka

Copy link
Copy Markdown
Member

I am just a wrong person to ask for review, because I do not completely understand soft deprecation.

@StanFromIreland

Copy link
Copy Markdown
Member Author

I see, no worries.

@hugovk, since I know you've soft-deprecated a few things before, do you think a soft-deprecation before a deprecation is reasonable?

@vstinner

Copy link
Copy Markdown
Member

It's surprising that Python 3.16 adds zlib.zlib_version and deprecates zlib.ZLIB_RUNTIME_VERSION. Usually, deprecation of the old API occurs in another Python version, no?

@StanFromIreland

Copy link
Copy Markdown
Member Author

Which is why I'm proposing a **soft-**deprecation, not a deprecation.

@serhiy-storchaka

Copy link
Copy Markdown
Member

The cost of having an old alias is very low, especially if it is a constant (we have aliases 20 or 30 years old). Soft deprecation disturbs documentation like normal deprecation.

@hugovk

hugovk commented Sep 21, 2026

Copy link
Copy Markdown
Member

@hugovk, since I know you've soft-deprecated a few things before, do you think a soft-deprecation before a deprecation is reasonable?

Soft deprecation is when we don't want people to use something (and ideally have a better alternative to suggest), and have no plans to remove it.

Doing a regular deprecation before removal is a different thing. A soft deprecation doesn't graduate into a regular one.

But if you are planning on removing something, don't hide it, do a regular deprecation. You can leave the removal open-ended, or pick some distant version and assess progress of removal closer to the time.

The cost of having an old alias is very low, especially if it is a constant (we have aliases 20 or 30 years old).

Agreed.

Perhaps we could have the preferred name as the main docs entry and add something like "Prefer zlib_version over its alias ZLIB_RUNTIME_VERSION"?

After that could open feature requests with Ruff's UP and pyupgrade to rewrite to the preferred name.

@StanFromIreland

Copy link
Copy Markdown
Member Author

If people prefer to keep the old alias, I won't fight this. Instead, I changed this to clearly note that the new name should be preferred.

@serhiy-storchaka

Copy link
Copy Markdown
Member

Perhaps we could have the preferred name as the main docs entry

We already have this.

@StanFromIreland

Copy link
Copy Markdown
Member Author

We already have this.

Personally, it doesn't look that way to me. They are both listed together, and it's not clear why there are two APIs for the same information, and which one should be used.

@serhiy-storchaka

Copy link
Copy Markdown
Member

and which one should be used.

Use what you want. You can use newer API, you can find it more consistent, but we should not force you.

@StanFromIreland

Copy link
Copy Markdown
Member Author

but we should not force you.

I don't think a recommendation is forcing anyone, a deprecation would, but I'm not planning that currently.

@serhiy-storchaka

Copy link
Copy Markdown
Member

Too much documentation can make things looking more complex than they are.

@StanFromIreland

Copy link
Copy Markdown
Member Author

In my opinion, one sentence here does not hurt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants