Skip to content

Commit 61887a2

Browse files
committed
Use setup.cfg rather than setup.py.
A setup.cfg is cleaner, is easy to parse, and does not require running any Python code. Its usage should be showcased.
1 parent cbabca3 commit 61887a2

File tree

3 files changed

+185
-198
lines changed

3 files changed

+185
-198
lines changed

sample/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
__version__ = '1.3.0'
2+
13

24
def main():
35
"""Entry point for the application script"""

setup.cfg

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,189 @@
1+
# Arguments marked as "Required" below must be included for upload to PyPI.
2+
# Fields marked as "Optional" may be commented out.
3+
14
[metadata]
5+
# This is the name of your project. The first time you publish this
6+
# package, this name will be registered for you. It will determine how
7+
# users can install this project, e.g.:
8+
#
9+
# $ pip install sampleproject
10+
#
11+
# And where it will live on PyPI: https://pypi.org/project/sampleproject/
12+
#
13+
# There are some restrictions on what makes a valid project name
14+
# specification here:
15+
# https://packaging.python.org/specifications/core-metadata/#name
16+
# Required
17+
name = sampleproject
18+
19+
# Versions should comply with PEP 440:
20+
# https://www.python.org/dev/peps/pep-0440/
21+
# You may also specify the version directly: version = 1.3.0
22+
version = attr:sample.__version__
23+
24+
# This is a one-line description or tagline of what your project does. This
25+
# corresponds to the "Summary" metadata field:
26+
# https://packaging.python.org/specifications/core-metadata/#summary
27+
# Optional
28+
description = A sample Python project
29+
30+
# This is an optional longer description of your project that represents
31+
# the body of text which users will see when they visit PyPI.
32+
#
33+
# Often, this is the same as your README, so you can just read it in from
34+
# that file directly (as we have already done above)
35+
#
36+
# This field corresponds to the "Description" metadata field:
37+
# https://packaging.python.org/specifications/core-metadata/#description-optional
38+
# Optional
39+
long_description = file: README.md
40+
41+
# Denotes that our long_description is in Markdown; valid values are
42+
# text/plain, text/x-rst, and text/markdown
43+
#
44+
# Optional if long_description is written in reStructuredText (rst) but
45+
# required for plain-text or Markdown; if unspecified, "applications should
46+
# attempt to render [the long_description] as text/x-rst; charset=UTF-8 and
47+
# fall back to text/plain if it is not valid rst" (see link below)
48+
#
49+
# This field corresponds to the "Description-Content-Type" metadata field:
50+
# https://packaging.python.org/specifications/core-metadata/#description-content-type-optional
51+
# Optional (see note above)
52+
long_description_content_type = text/markdown
53+
254
# This includes the license file(s) in the wheel.
355
# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file
456
license_files = LICENSE.txt
557

58+
# This should be a valid link to your project's main homepage.
59+
#
60+
# This field corresponds to the "Home-Page" metadata field:
61+
# https://packaging.python.org/specifications/core-metadata/#home-page-optional
62+
# Optional
63+
url = https://github.com/pypa/sampleproject
64+
65+
# This should be your name or the name of the organization which owns the
66+
# project.
67+
# Optional
68+
author = The Python Packaging Authority
69+
70+
# This should be a valid email address corresponding to the author listed
71+
# above.
72+
# Optional
73+
author_email = [email protected]
74+
75+
# Classifiers help users find your project by categorizing it.
76+
#
77+
# For a list of valid classifiers, see https://pypi.org/classifiers/
78+
classifiers = # Optional
79+
# How mature is this project? Common values are
80+
# 3 - Alpha
81+
# 4 - Beta
82+
# 5 - Production/Stable
83+
Development Status :: 3 - Alpha
84+
# Indicate who your project is intended for
85+
Intended Audience :: Developers
86+
Topic :: Software Development :: Build Tools
87+
88+
# Pick your license as you wish
89+
License :: OSI Approved :: MIT License
90+
91+
# Specify the Python versions you support here. In particular, ensure
92+
# that you indicate whether you support Python 2, Python 3 or both.
93+
# These classifiers are *not* checked by 'pip install'. See instead
94+
# 'python_requires' below.
95+
Programming Language :: Python :: 2
96+
Programming Language :: Python :: 2.7
97+
Programming Language :: Python :: 3
98+
Programming Language :: Python :: 3.4
99+
Programming Language :: Python :: 3.5
100+
Programming Language :: Python :: 3.6
101+
Programming Language :: Python :: 3.7
102+
# This field adds keywords for your project which will appear on the
103+
# project page. What does your project relate to?
104+
# Optional
105+
keywords =
106+
sample
107+
setuptools
108+
development
109+
110+
# Specify which Python versions you support. In contrast to the
111+
# 'Programming Language' classifiers above, 'pip install' will check this
112+
# and refuse to install the project if the version does not match. If you
113+
# do not support Python 2, you can simplify this to '>=3.5' or similar, see
114+
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
115+
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4
116+
117+
# List additional URLs that are relevant to your project as a dict.
118+
#
119+
# This field corresponds to the "Project-URL" metadata fields:
120+
# https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use
121+
#
122+
# Examples listed include a pattern for specifying where the package tracks
123+
# issues, where the source is hosted, where to say thanks to the package
124+
# maintainers, and where to support the project financially. The key is
125+
# what's used to render the link text on PyPI.
126+
# Optional
127+
project_urls =
128+
Bug Reports = https://github.com/pypa/sampleproject/issues
129+
Funding = https://donate.pypi.org
130+
Say Thanks! = http://saythanks.io/to/example
131+
Source = https://github.com/pypa/sampleproject/
132+
133+
[options]
134+
packages = find:
135+
# This field lists other packages that your project depends on to run.
136+
# Any package you put here will be installed by pip when your project is
137+
# installed, so they must be valid existing projects.
138+
#
139+
# For an analysis of "install_requires" vs pip's requirements files see:
140+
# https://packaging.python.org/en/latest/requirements.html
141+
# Optional
142+
install_requires =
143+
peppercorn
144+
145+
[options.extras_require]
146+
# List additional groups of dependencies here (e.g. development
147+
# dependencies). Users will be able to install these using the "extras"
148+
# syntax, for example:
149+
#
150+
# $ pip install sampleproject[dev]
151+
#
152+
# Similar to `install_requires` above, these must be valid existing
153+
# projects.
154+
dev =
155+
check-manifest
156+
test =
157+
coverage
158+
159+
[options.entry_points]
160+
# To provide executable scripts, use entry points in preference to the
161+
# "scripts" keyword. Entry points provide cross-platform support and allow
162+
# `pip` to create the appropriate form of executable for the target
163+
# platform.
164+
#
165+
# For example, the following would provide a command called `sample` which
166+
# executes the function `main` from this package when invoked:
167+
console_scripts =
168+
sample = sample:main
169+
170+
# If there are data files included in your packages that need to be
171+
# installed, specify them here.
172+
#
173+
# If using Python 2.6 or earlier, then these have to be included in
174+
# MANIFEST.in as well.
175+
[options.package_data]
176+
sample = package_data.dat
177+
178+
[options.data_files]
179+
# Although 'package_data' is the preferred approach, in some case you may
180+
# need to place data files outside of your packages. See:
181+
# http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files
182+
#
183+
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
184+
my_data = data/data_file
185+
186+
6187
[bdist_wheel]
7188
# This flag says to generate wheels that support both Python 2 and Python
8189
# 3. If your code will not run unchanged on both Python 2 and 3, you will

0 commit comments

Comments
 (0)