|
3 | 3 | https://packaging.python.org/en/latest/distributing.html |
4 | 4 | https://github.com/pypa/sampleproject |
5 | 5 | """ |
6 | | -from six import raise_from |
7 | 6 | from os import path |
8 | | - |
| 7 | +import pkg_resources |
9 | 8 | from setuptools import setup, find_packages |
10 | 9 |
|
11 | | -here = path.abspath(path.dirname(__file__)) |
| 10 | +pkg_resources.require("setuptools>=39.2") |
| 11 | +pkg_resources.require("setuptools_scm") |
| 12 | + |
| 13 | +from setuptools_scm import get_version # noqa: E402 |
12 | 14 |
|
13 | 15 | # *************** Dependencies ********* |
14 | 16 | INSTALL_REQUIRES = ['pyyaml'] |
|
17 | 19 | TESTS_REQUIRE = ['pytest', 'pytest-logging'] |
18 | 20 | EXTRAS_REQUIRE = {} |
19 | 21 |
|
20 | | -# simple check |
21 | | -try: |
22 | | - from setuptools_scm import get_version |
23 | | -except Exception as e: |
24 | | - raise_from(Exception('Required packages for setup not found. Please install `setuptools_scm`'), e) |
25 | | - |
26 | 22 | # ************** ID card ***************** |
27 | 23 | DISTNAME = 'yamlable' |
28 | 24 | DESCRIPTION = 'A thin wrapper of PyYaml to convert Python objects to YAML and back.' |
29 | 25 | MAINTAINER = 'Sylvain Marié' |
30 | 26 | MAINTAINER_EMAIL = 'sylvain.marie@schneider-electric.com' |
31 | 27 | URL = 'https://github.com/smarie/python-yamlable' |
| 28 | +DOWNLOAD_URL = URL + '/tarball/' + get_version() |
32 | 29 | LICENSE = 'BSD 3-Clause' |
33 | 30 | LICENSE_LONG = 'License :: OSI Approved :: BSD License' |
34 | | - |
35 | | -version_for_download_url = get_version() |
36 | | -DOWNLOAD_URL = URL + '/tarball/' + version_for_download_url |
37 | | - |
38 | 31 | KEYWORDS = 'yaml file parsing parse load dump read write object oo oriented codec format plugin pyYaml' |
39 | 32 |
|
| 33 | +here = path.abspath(path.dirname(__file__)) |
40 | 34 | with open(path.join(here, 'docs', 'long_description.md')) as f: |
41 | 35 | LONG_DESCRIPTION = f.read() |
42 | 36 |
|
43 | | -# ************* VERSION ************** |
44 | | -# --Get the Version number from VERSION file, see https://packaging.python.org/single_source_version/ option 4. |
45 | | -# THIS IS DEPRECATED AS WE NOW USE GIT TO MANAGE VERSION |
46 | | -# with open(path.join(here, 'VERSION')) as version_file: |
47 | | -# VERSION = version_file.read().strip() |
48 | 37 | # OBSOLETES = [] |
49 | 38 |
|
50 | 39 | setup( |
|
91 | 80 | 'Programming Language :: Python :: 3.5', |
92 | 81 | 'Programming Language :: Python :: 3.6', |
93 | 82 | 'Programming Language :: Python :: 3.7', |
| 83 | + |
| 84 | + # 'Framework :: Pytest' |
94 | 85 | ], |
95 | 86 |
|
96 | 87 | # What does your project relate to? |
97 | 88 | keywords=KEYWORDS, |
98 | 89 |
|
99 | 90 | # You can just specify the packages manually here if your project is |
100 | 91 | # simple. Or you can use find_packages(). |
101 | | - packages=find_packages(exclude=['contrib', 'docs', 'tests']), |
| 92 | + packages=find_packages(exclude=['contrib', 'docs', '*tests*']), |
102 | 93 |
|
103 | 94 | # Alternatively, if you want to distribute just a my_module.py, uncomment |
104 | 95 | # this: |
|
131 | 122 | # If there are data files included in your packages that need to be |
132 | 123 | # installed, specify them here. If using Python 2.6 or less, then these |
133 | 124 | # have to be included in MANIFEST.in as well. |
134 | | - # package_data={ |
135 | | - # 'sample': ['package_data.dat'], |
136 | | - # }, |
| 125 | + # Note: we use the empty string so that this also works with submodules |
| 126 | + package_data={"": ['py.typed', '*.pyi']}, |
| 127 | + # IMPORTANT: DO NOT set the `include_package_data` flag !! It triggers inclusion of all git-versioned files |
| 128 | + # see https://github.com/pypa/setuptools_scm/issues/190#issuecomment-351181286 |
| 129 | + # include_package_data=True, |
137 | 130 |
|
138 | 131 | # Although 'package_data' is the preferred approach, in some case you may |
139 | 132 | # need to place data files outside of your packages. See: |
|
149 | 142 | # 'sample=sample:main', |
150 | 143 | # ], |
151 | 144 | # }, |
| 145 | + |
| 146 | + # explicitly setting the flag to avoid `ply` being downloaded |
| 147 | + # see https://github.com/smarie/python-getversion/pull/5 |
| 148 | + # and to make mypy happy |
| 149 | + # see https://mypy.readthedocs.io/en/latest/installed_packages.html |
| 150 | + zip_safe=False, |
152 | 151 | ) |
0 commit comments