Skip to content

Conversation

@rawwar
Copy link
Contributor

@rawwar rawwar commented Jun 3, 2022

removed sqlite3.version and sqlite3.version_info

@ghost
Copy link

ghost commented Jun 3, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@rawwar
Copy link
Contributor Author

rawwar commented Jun 3, 2022

closes #93370

@rawwar
Copy link
Contributor Author

rawwar commented Jun 3, 2022

I think what I did is wrong. I should be deprecating instead of removing in current version. But, after thinking about how to deprecate sqlite3.version_info and sqlite3.version I don't understand how exactly I can do this. I saw several other deprecation PR's and all of them are either methods or class attributes. That makes it easy to raise a deprecation warning. But, here, version comes from _sqlite as a string constant. Not exactly sure how to display warning when calling an variable.

@AlexWaygood
Copy link
Member

AlexWaygood commented Jun 3, 2022

Not exactly sure how to display warning when calling an variable.

Take a look at https://peps.python.org/pep-0562/

Example usage for a DeprecationWarning:

def __getattr__(name):

@rawwar
Copy link
Contributor Author

rawwar commented Jun 3, 2022

@AlexWaygood , can you please check my usage of __getattr__

@rawwar
Copy link
Contributor Author

rawwar commented Jun 4, 2022

@AlexWaygood , Thank you so much for your feedback. I've incorporated your feedback

@rawwar rawwar requested a review from AlexWaygood June 4, 2022 00:15
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks! This is starting to look pretty good. However, it's still missing:

  • Tests
  • Updates to the documentation

Could you add those, please? 🙂 Take a look at #23064 as an example of a previous PR deprecating features — it should make clear the kinds of changes that you need to make to the test files and the docs.

Since this is your first contribution to CPython, you're also very welcome to add your name to https://github.com/python/cpython/blob/main/Misc/ACKS if you want to, though that isn't compulsory!

rawwar and others added 3 commits June 4, 2022 16:35
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

Some minor comments. As Alex said, you still need tests and to update the documentation.

A

Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

Thanks for your work @rawwar!

A

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Some documentation nits :)

Also, if you wanted to be super-thorough, you could also test that these also cause DeprecationWarning to be emitted:

from sqlite import version
from sqlite import version_info
from sqlite.dbapi2 import version
from sqlite.dbapi2 import version_info

erlend-aasland and others added 2 commits June 5, 2022 15:13
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

The line length of the tests is over 100 -- my suggestion doesn't bring it under 80, but makes it less egregious.

A

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

Looks good.

We haven't added warnings to sqlite3.dbapi2 before, only sqlite3 attributes, but it is ok; it will only stay for two versions :)

Also, I would probably have used subTest instead of spelling each test out.

@erlend-aasland
Copy link
Contributor

Thanks for reviewing everyone, and thanks for the PR, Kalyan! I'm going to merge this as soon as the CI is green.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate sqlite3.version and sqlite3.version_info

5 participants