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

Minor improvements to setup.py #4

Merged
merged 1 commit into from
Dec 4, 2016
Merged
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
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from setuptools import setup, find_packages

from async_generator import __version__
Expand All @@ -6,15 +8,14 @@
name="async_generator",
version=__version__,
description="Async generators for Python 3.5",
long_description=open("README.rst").read(),
long_description=Path(__file__).with_name("README.rst").read_text('utf-8'),
Copy link
Member

Choose a reason for hiding this comment

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

What does this do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Figures out the path to setup.py, even if it's not in the current directory, and then changes the file name of the path to README.rst and finally reads the file contents as UTF-8 (the explicit encoding is necessary on Anaconda installs [like on RTD] where str.decode() for some incomprehensible reason does not default to utf-8!).
In the early days of my most popular project, APScheduler, I got a PR from someone who was doing RPM packaging of APScheduler. They were complaining that apscheduler's setup.py assumes that the working directory is the project directory, which apparently is not always the case. This line avoids that by not assuming anything about the CWD (and it closes the properly too, not that it really matters in the case of setup.py).

Copy link
Member

Choose a reason for hiding this comment

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

assumes that the working directory is the project directory, which apparently is not always the case.

......wuuut. really? .....I'm suddenly paranoid about all my packages. really? yikes.

author="Nathaniel J. Smith",
author_email="njs@pobox.com",
license="MIT",
packages=find_packages(),
url="https://github.com/njsmith/async_generator",
py_modules=["async_generator"],
classifiers=[
"Development Status :: 4 - Beta",
'Development Status :: 5 - Production/Stable',
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
Expand Down