Skip to content

Commit fa7dd33

Browse files
CaselITvytas7
andauthored
chore: modernize setup (#43)
* Add github actions Fixes: #39 * Fix workflow * Move setup information to setup.cfg * Use pep517 to build * chore: review feedback Co-authored-by: Vytautas Liuolia <[email protected]>
1 parent 8c4c3ce commit fa7dd33

File tree

5 files changed

+49
-63
lines changed

5 files changed

+49
-63
lines changed

.github/workflows/run-test.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
python-version:
15+
- "3.5"
1516
- "3.6"
1617
- "3.7"
1718
- "3.8"

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include README.rst LICENSE mimeparse_test.py testdata.json
1+
include README.rst LICENSE mimeparse_test.py testdata.json pyproject.toml

pyproject.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build-system]
2+
build-backend = "setuptools.build_meta"
3+
requires = [
4+
"setuptools>=47",
5+
"wheel>=0.34",
6+
]

setup.cfg

+40-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
1-
[bdist_wheel]
2-
universal = 1
1+
[metadata]
2+
name = python-mimeparse
3+
version = attr: mimeparse.__version__
4+
description = A module provides basic functions for parsing mime-type names and matching them against a list of media-ranges.
5+
long_description = file: README.rst
6+
long_description_content_type = text/x-rst
7+
url = https://github.com/falconry/python-mimeparse
8+
author = DB Tsai
9+
author_email = [email protected]
10+
maintainer = Falcon team
11+
maintainer_email = [email protected]
12+
license = MIT
13+
license_file = LICENSE
14+
classifiers =
15+
Programming Language :: Python
16+
Programming Language :: Python :: 3
17+
Programming Language :: Python :: 3.6
18+
Programming Language :: Python :: 3.7
19+
Programming Language :: Python :: 3.8
20+
Programming Language :: Python :: 3.9
21+
Programming Language :: Python :: 3.10
22+
Programming Language :: Python :: Implementation :: CPython
23+
Programming Language :: Python :: Implementation :: PyPy
24+
License :: OSI Approved :: MIT License
25+
Operating System :: OS Independent
26+
Development Status :: 5 - Production/Stable
27+
Intended Audience :: Developers
28+
Topic :: Internet :: WWW/HTTP
29+
Topic :: Software Development :: Libraries :: Python Modules
30+
keywords =
31+
mime-type
32+
project_urls =
33+
Issue Tracker=https://github.com/falconry/python-mimeparse
34+
35+
[options]
36+
python_requires = >=3.5
37+
py_modules = mimeparse
38+
install_requires =
39+
tests_require =
40+
pytest

setup.py

+1-60
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,3 @@
1-
#!/usr/bin/env python
2-
3-
import codecs
4-
import os
5-
import re
6-
71
from setuptools import setup
82

9-
10-
def get_version(filename):
11-
"""
12-
Return package version as listed in `__version__` in 'filename'.
13-
"""
14-
with open(filename) as fp:
15-
contents = fp.read()
16-
return re.search("__version__ = ['\"]([^'\"]+)['\"]", contents).group(1)
17-
18-
19-
version = get_version('mimeparse.py')
20-
if not version:
21-
raise RuntimeError('Cannot find version information')
22-
23-
24-
def read(fname):
25-
path = os.path.join(os.path.dirname(__file__), fname)
26-
with codecs.open(path, encoding='utf-8') as fp:
27-
return fp.read()
28-
29-
30-
setup(
31-
name="python-mimeparse",
32-
py_modules=["mimeparse"],
33-
version=version,
34-
description=("A module provides basic functions for parsing mime-type "
35-
"names and matching them against a list of media-ranges."),
36-
author="DB Tsai",
37-
license="MIT",
38-
author_email="[email protected]",
39-
url="https://github.com/dbtsai/python-mimeparse",
40-
download_url=("https://github.com/dbtsai/python-mimeparse/tarball/" + version),
41-
keywords=["mime-type"],
42-
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
43-
classifiers=[
44-
"Programming Language :: Python",
45-
"Programming Language :: Python :: 2",
46-
"Programming Language :: Python :: 2.7",
47-
"Programming Language :: Python :: 3",
48-
"Programming Language :: Python :: 3.4",
49-
"Programming Language :: Python :: 3.5",
50-
"Programming Language :: Python :: 3.6",
51-
"Programming Language :: Python :: 3.7",
52-
"Programming Language :: Python :: Implementation :: CPython",
53-
"Programming Language :: Python :: Implementation :: PyPy",
54-
"License :: OSI Approved :: MIT License",
55-
"Operating System :: OS Independent",
56-
"Development Status :: 5 - Production/Stable",
57-
"Intended Audience :: Developers",
58-
"Topic :: Internet :: WWW/HTTP",
59-
"Topic :: Software Development :: Libraries :: Python Modules",
60-
],
61-
long_description=read('README.rst')
62-
)
3+
setup()

0 commit comments

Comments
 (0)