]> git.madduck.net Git - etc/vim.git/blob - setup.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

19df9beb24eb8369250f8af7d2a915236e6528ea
[etc/vim.git] / setup.py
1 # Copyright (C) 2020 Łukasz Langa
2 from setuptools import setup, find_packages
3 import sys
4 import os
5
6 assert sys.version_info >= (3, 6, 2), "black requires Python 3.6.2+"
7 from pathlib import Path  # noqa E402
8
9 CURRENT_DIR = Path(__file__).parent
10 sys.path.insert(0, str(CURRENT_DIR))  # for setuptools.build_meta
11
12
13 def get_long_description() -> str:
14     return (
15         (CURRENT_DIR / "README.md").read_text(encoding="utf8")
16         + "\n\n"
17         + (CURRENT_DIR / "CHANGES.md").read_text(encoding="utf8")
18     )
19
20
21 USE_MYPYC = False
22 # To compile with mypyc, a mypyc checkout must be present on the PYTHONPATH
23 if len(sys.argv) > 1 and sys.argv[1] == "--use-mypyc":
24     sys.argv.pop(1)
25     USE_MYPYC = True
26 if os.getenv("BLACK_USE_MYPYC", None) == "1":
27     USE_MYPYC = True
28
29 if USE_MYPYC:
30     mypyc_targets = [
31         "src/black/__init__.py",
32         "src/blib2to3/pytree.py",
33         "src/blib2to3/pygram.py",
34         "src/blib2to3/pgen2/parse.py",
35         "src/blib2to3/pgen2/grammar.py",
36         "src/blib2to3/pgen2/token.py",
37         "src/blib2to3/pgen2/driver.py",
38         "src/blib2to3/pgen2/pgen.py",
39     ]
40
41     from mypyc.build import mypycify
42
43     opt_level = os.getenv("MYPYC_OPT_LEVEL", "3")
44     ext_modules = mypycify(mypyc_targets, opt_level=opt_level)
45 else:
46     ext_modules = []
47
48 setup(
49     name="black",
50     use_scm_version={
51         "write_to": "src/_black_version.py",
52         "write_to_template": 'version = "{version}"\n',
53     },
54     description="The uncompromising code formatter.",
55     long_description=get_long_description(),
56     long_description_content_type="text/markdown",
57     keywords="automation formatter yapf autopep8 pyfmt gofmt rustfmt",
58     author="Łukasz Langa",
59     author_email="lukasz@langa.pl",
60     url="https://github.com/psf/black",
61     project_urls={"Changelog": "https://github.com/psf/black/blob/main/CHANGES.md"},
62     license="MIT",
63     py_modules=["_black_version"],
64     ext_modules=ext_modules,
65     packages=find_packages(where="src"),
66     package_dir={"": "src"},
67     package_data={
68         "blib2to3": ["*.txt"],
69         "black": ["py.typed"],
70         "black_primer": ["primer.json"],
71     },
72     python_requires=">=3.6.2",
73     zip_safe=False,
74     install_requires=[
75         "click>=7.1.2",
76         "platformdirs>=2",
77         "tomli>=0.2.6,<2.0.0",
78         "typed-ast>=1.4.2; python_version < '3.8'",
79         "regex>=2020.1.8",
80         "pathspec>=0.9.0, <1",
81         "dataclasses>=0.6; python_version < '3.7'",
82         "typing_extensions>=3.10.0.0",
83         # 3.10.0.1 is broken on at least Python 3.10,
84         # https://github.com/python/typing/issues/865
85         "typing_extensions!=3.10.0.1; python_version >= '3.10'",
86         "mypy_extensions>=0.4.3",
87     ],
88     extras_require={
89         "d": ["aiohttp>=3.6.0"],
90         "colorama": ["colorama>=0.4.3"],
91         "python2": ["typed-ast>=1.4.2"],
92         "uvloop": ["uvloop>=0.15.2"],
93         "jupyter": ["ipython>=7.8.0", "tokenize-rt>=3.2.0"],
94     },
95     test_suite="tests.test_black",
96     classifiers=[
97         "Development Status :: 4 - Beta",
98         "Environment :: Console",
99         "Intended Audience :: Developers",
100         "License :: OSI Approved :: MIT License",
101         "Operating System :: OS Independent",
102         "Programming Language :: Python",
103         "Programming Language :: Python :: 3.6",
104         "Programming Language :: Python :: 3.7",
105         "Programming Language :: Python :: 3.8",
106         "Programming Language :: Python :: 3.9",
107         "Programming Language :: Python :: 3 :: Only",
108         "Topic :: Software Development :: Libraries :: Python Modules",
109         "Topic :: Software Development :: Quality Assurance",
110     ],
111     entry_points={
112         "console_scripts": [
113             "black=black:patched_main",
114             "blackd=blackd:patched_main [d]",
115             "black-primer=black_primer.cli:main",
116         ]
117     },
118 )