-
Notifications
You must be signed in to change notification settings - Fork 180
Upgrade to Python 3.7 and above #12
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
Conversation
@lpozo Here are some updates to bring us into the modern Python age 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @gahjelle!
The update LGTM!
I just have a few comments. Please, take a look at them and let me know if they look good to you.
Thanks for taking the time to do this!
Leodanis
README.md
Outdated
|
||
The reader is supported on Python 2.7, as well as Python 3.4 and above. | ||
The reader is supported on Python 3.7 and above. Older versions of Python, including Python 2.7, is supported by version 1.0.0 of the reader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reader is supported on Python 3.7 and above. Older versions of Python, including Python 2.7, is supported by version 1.0.0 of the reader. | |
The reader is supported on Python 3.7 and above. Older versions of Python, including Python 2.7, are supported by version 1.0.0 of the reader. |
from ConfigParser import ConfigParser as _ConfigParser | ||
|
||
from configparser import ConfigParser | ||
from importlib import resources | ||
|
||
# Version of realpython-reader package | ||
__version__ = "1.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update the version number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I usually don't do that in a PR like this. At least in a bigger project, there might be other commits coming in, etc. Instead, I usually bump the version as the first step in the release process.
reader/feed.py
Outdated
@@ -9,32 +9,31 @@ | |||
# Reader imports | |||
from reader import URL | |||
|
|||
_CACHED_FEEDS = dict() # type: Dict[str, feedparser.FeedParserDict] | |||
_CACHED_FEEDS: Dict[str, feedparser.FeedParserDict] = dict() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have info about the data type, so probably using a dict
literal is more straightforward and faster.
_CACHED_FEEDS: Dict[str, feedparser.FeedParserDict] = dict() | |
_CACHED_FEEDS: Dict[str, feedparser.FeedParserDict] = {} |
reader/__main__.py
Outdated
|
||
|
||
def main(): # type: () -> None | ||
def main() -> None: | ||
"""Read the Real Python article feed""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we adhere to PEP 257, then this type of docstring should end in a period.
Thanks @lpozo I've fixed the docstrings and the few other issues you mentioned. I propose that we handle the version number as part of the release to PyPI after this PR is merged (although the reference to v1.0.0 in README might seem inconsistent, it's still true in terms of what you get when installing from PyPI). |
Hey @gahjelle! The update LGTM! Thanks for taking the time to do this! I think you can merge the PR now. |
Update the code to be more "modern". In particular:
.format()
(Python 3.6+)importlib.resources
(Python 3.7+)pathlib
instead ofos.path
(Python 3.4+)