standardize project metadata

This commit is contained in:
David Lord 2019-06-22 13:10:50 -07:00
parent e666f7a69c
commit 24498afed5
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
6 changed files with 68 additions and 281 deletions

View File

@ -1,11 +1,8 @@
include Makefile CHANGES.rst CONTRIBUTING.rst LICENSE AUTHORS tox.ini
include CHANGES.rst
include CONTRIBUTING.rst
include tox.ini
graft artwork
graft tests
graft examples
graft docs
global-exclude *.py[co]
prune docs/_build
prune docs/_themes
graft examples
graft tests

View File

@ -1,35 +0,0 @@
.PHONY: all install-dev test coverage cov test-all tox docs audit release clean-pyc upload-docs ebook
all: test
install-dev:
pip install -q -e .[dev]
test: clean-pyc install-dev
pytest
coverage: clean-pyc install-dev
coverage run -m pytest
coverage report
coverage html
cov: coverage
test-all: install-dev
tox
tox: test-all
docs: clean-pyc install-dev
$(MAKE) -C docs html
audit:
python setup.py audit
release:
python scripts/make-release.py
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +

View File

@ -32,9 +32,9 @@ A Simple Example
app = Flask(__name__)
@app.route('/')
@app.route("/")
def hello():
return 'Hello, World!'
return "Hello, World!"
.. code-block:: text
@ -59,12 +59,10 @@ Links
* Website: https://www.palletsprojects.com/p/flask/
* Documentation: http://flask.pocoo.org/docs/
* License: `BSD <https://github.com/pallets/flask/blob/master/LICENSE>`_
* Releases: https://pypi.org/project/Flask/
* Code: https://github.com/pallets/flask
* Issue tracker: https://github.com/pallets/flask/issues
* Test status: https://dev.azure.com/pallets/pallets/_build?definitionId=2
* Test coverage: https://codecov.io/gh/pallets/flask
* Official chat: https://discord.gg/t6rrQZH
.. _WSGI: https://wsgi.readthedocs.io

View File

@ -1,164 +0,0 @@
#!/usr/bin/env python
from __future__ import print_function
import os
import re
import sys
from datetime import date, datetime
from subprocess import PIPE, Popen
_date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')
def parse_changelog():
with open('CHANGES.rst') as f:
lineiter = iter(f)
for line in lineiter:
match = re.search('^Version\s+(.*)', line.strip())
if match is None:
continue
version = match.group(1).strip()
if next(lineiter).count('-') != len(match.group(0)):
continue
while 1:
change_info = next(lineiter).strip()
if change_info:
break
match = re.search(
r'released on (\w+\s+\d+\w+\s+\d+)(?:, codename (.*))?',
change_info,
flags=re.IGNORECASE
)
if match is None:
continue
datestr, codename = match.groups()
return version, parse_date(datestr), codename
def bump_version(version):
try:
parts = [int(i) for i in version.split('.')]
except ValueError:
fail('Current version is not numeric')
parts[-1] += 1
return '.'.join(map(str, parts))
def parse_date(string):
string = _date_strip_re.sub('', string)
return datetime.strptime(string, '%B %d %Y')
def set_filename_version(filename, version_number, pattern):
changed = []
def inject_version(match):
before, old, after = match.groups()
changed.append(True)
return before + version_number + after
with open(filename) as f:
contents = re.sub(
r"^(\s*%s\s*=\s*')(.+?)(')" % pattern,
inject_version, f.read(),
flags=re.DOTALL | re.MULTILINE
)
if not changed:
fail('Could not find %s in %s', pattern, filename)
with open(filename, 'w') as f:
f.write(contents)
def set_init_version(version):
info('Setting __init__.py version to %s', version)
set_filename_version('flask/__init__.py', version, '__version__')
def build():
cmd = [sys.executable, 'setup.py', 'sdist', 'bdist_wheel']
Popen(cmd).wait()
def fail(message, *args):
print('Error:', message % args, file=sys.stderr)
sys.exit(1)
def info(message, *args):
print(message % args, file=sys.stderr)
def get_git_tags():
return set(
Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines()
)
def git_is_clean():
return Popen(['git', 'diff', '--quiet']).wait() == 0
def make_git_commit(message, *args):
message = message % args
Popen(['git', 'commit', '-am', message]).wait()
def make_git_tag(tag):
info('Tagging "%s"', tag)
Popen(['git', 'tag', tag]).wait()
def main():
os.chdir(os.path.join(os.path.dirname(__file__), '..'))
rv = parse_changelog()
if rv is None:
fail('Could not parse changelog')
version, release_date, codename = rv
dev_version = bump_version(version) + '.dev'
info(
'Releasing %s (codename %s, release date %s)',
version, codename, release_date.strftime('%d/%m/%Y')
)
tags = get_git_tags()
if version in tags:
fail('Version "%s" is already tagged', version)
if release_date.date() != date.today():
fail(
'Release date is not today (%s != %s)',
release_date.date(), date.today()
)
if not git_is_clean():
fail('You have uncommitted changes in git')
try:
import wheel # noqa: F401
except ImportError:
fail('You need to install the wheel package.')
set_init_version(version)
make_git_commit('Bump version number to %s', version)
make_git_tag(version)
build()
set_init_version(dev_version)
if __name__ == '__main__':
main()

View File

@ -1,14 +1,10 @@
[aliases]
release = egg_info -Db ''
[metadata]
license_file = LICENSE.rst
[bdist_wheel]
universal = 1
[metadata]
license_file = LICENSE
universal = true
[tool:pytest]
minversion = 3.0
testpaths = tests
[coverage:run]
@ -21,4 +17,4 @@ source =
source =
flask
.tox/*/lib/python*/site-packages/flask
.tox/pypy/site-packages/flask
.tox/*/site-packages/flask

119
setup.py Executable file → Normal file
View File

@ -1,81 +1,76 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import re
from collections import OrderedDict
from setuptools import find_packages
from setuptools import setup
with io.open('README.rst', 'rt', encoding='utf8') as f:
with io.open("README.rst", "rt", encoding="utf8") as f:
readme = f.read()
with io.open('flask/__init__.py', 'rt', encoding='utf8') as f:
version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)
with io.open("flask/__init__.py", "rt", encoding="utf8") as f:
version = re.search(r"__version__ = \'(.*?)\'", f.read()).group(1)
setup(
name='Flask',
name="Flask",
version=version,
url='https://www.palletsprojects.com/p/flask/',
project_urls=OrderedDict((
('Documentation', 'http://flask.pocoo.org/docs/'),
('Code', 'https://github.com/pallets/flask'),
('Issue tracker', 'https://github.com/pallets/flask/issues'),
)),
license='BSD',
author='Armin Ronacher',
author_email='armin.ronacher@active-4.com',
maintainer='Pallets team',
maintainer_email='contact@palletsprojects.com',
description='A simple framework for building complex web applications.',
url="https://palletsprojects.com/p/flask/",
project_urls={
"Documentation": "http://flask.palletsprojects.com/",
"Code": "https://github.com/pallets/flask",
"Issue tracker": "https://github.com/pallets/flask/issues",
},
license="BSD-3-Clause",
author="Armin Ronacher",
author_email="armin.ronacher@active-4.com",
maintainer="Pallets",
maintainer_email="contact@palletsprojects.com",
description="A simple framework for building complex web applications.",
long_description=readme,
packages=['flask', 'flask.json'],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Flask",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
],
packages=find_packages(),
include_package_data=True,
zip_safe=False,
platforms='any',
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
install_requires=[
'Werkzeug>=0.14',
'Jinja2>=2.10',
'itsdangerous>=0.24',
'click>=5.1',
"Werkzeug>=0.14",
"Jinja2>=2.10",
"itsdangerous>=0.24",
"click>=5.1",
],
extras_require={
'dotenv': ['python-dotenv'],
'dev': [
'pytest>=3',
'coverage',
'tox',
'sphinx',
'pallets-sphinx-themes',
'sphinxcontrib-log-cabinet',
"dotenv": ["python-dotenv"],
"dev": [
"pytest",
"coverage",
"tox",
"sphinx",
"pallets-sphinx-themes",
"sphinxcontrib-log-cabinet",
"sphinx-issues",
],
'docs': [
'sphinx',
'pallets-sphinx-themes',
'sphinxcontrib-log-cabinet',
]
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Flask',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
'Topic :: Software Development :: Libraries :: Application Frameworks',
'Topic :: Software Development :: Libraries :: Python Modules',
],
entry_points={
'console_scripts': [
'flask = flask.cli:main',
"docs": [
"sphinx",
"pallets-sphinx-themes",
"sphinxcontrib-log-cabinet",
"sphinx-issues",
],
},
entry_points={"console_scripts": ["flask = flask.cli:main"]},
)