|
3 | 3 | # Copyright (C) 2023 Benjamin Thomas Schwertfeger |
4 | 4 | # Github: https://github.com/btschwertfeger |
5 | 5 |
|
6 | | -import io |
7 | | -import os |
8 | | -import sys |
9 | | -from shutil import rmtree |
| 6 | +import setuptools_scm # pylint: disable=unused-import |
| 7 | +from setuptools import setup |
10 | 8 |
|
11 | | -from setuptools import Command, find_packages, setup |
12 | | - |
13 | | -NAME = "python-cmethods" |
14 | | -DESCRIPTION = ( |
15 | | - "Collection of bias adjustment procedures for multidimensional climate data" |
16 | | -) |
17 | | -URL = "https://github.com/btschwertfeger/Bias-Adjustment-Python" |
18 | | -EMAIL = "development@b-schwertfeger.de" |
19 | | -AUTHOR = "Benjamin Thomas Schwertfeger" |
20 | | -REQUIRES_PYTHON = ">=3.8.0" |
21 | | -VERSION = "0.6.3" |
22 | | - |
23 | | -# What packages are required for this module to be executed? |
24 | | -REQUIRED = [ |
25 | | - "xarray>=2022.11.0", |
26 | | - "netCDF4>=1.6.1", |
27 | | - "numpy", |
28 | | - "tqdm", |
29 | | -] |
30 | | - |
31 | | -# What packages are optional? |
32 | | -EXTRAS = { |
33 | | - "working examples notebook": ["matplotlib"], |
34 | | - "tests": ["scikit-learn", "scipy"], |
35 | | -} |
36 | | - |
37 | | -here = os.path.abspath(os.path.dirname(__file__)) |
38 | | - |
39 | | -# only works if 'README.md' is present in your MANIFEST.in file! |
40 | | -try: |
41 | | - with io.open(os.path.join(here, "README.md"), encoding="utf-8") as f: |
42 | | - long_description = f"\n{f.read()}" |
43 | | -except FileNotFoundError: |
44 | | - long_description = DESCRIPTION |
45 | | - |
46 | | - |
47 | | -class UploadCommand(Command): |
48 | | - """Support setup.py upload.""" |
49 | | - |
50 | | - description = "Build and publish the package." |
51 | | - user_options = [] |
52 | | - |
53 | | - @staticmethod |
54 | | - def status(s): |
55 | | - print(f"\033[1m{s}\033[0m") |
56 | | - |
57 | | - def initialize_options(self): |
58 | | - pass |
59 | | - |
60 | | - def finalize_options(self): |
61 | | - pass |
62 | | - |
63 | | - def run(self): |
64 | | - try: |
65 | | - self.status("Removing previous builds…") |
66 | | - rmtree(os.path.join(here, "dist")) |
67 | | - except OSError: |
68 | | - pass |
69 | | - |
70 | | - self.status("Building Source and Wheel (universal) distribution…") |
71 | | - os.system(f"{sys.executable} setup.py sdist bdist_wheel --universal") |
72 | | - |
73 | | - self.status("Uploading the package to PyPI via Twine…") |
74 | | - os.system("twine upload dist/*") |
75 | | - sys.exit(0) |
76 | | - |
77 | | - |
78 | | -class TestUploadCommand(Command): |
79 | | - """Support setup.py test upload.""" |
80 | | - |
81 | | - description = "Build and test publishing the package." |
82 | | - user_options = [] |
83 | | - |
84 | | - @staticmethod |
85 | | - def status(s): |
86 | | - print(f"\033[1m{s}\033[0m") |
87 | | - |
88 | | - def initialize_options(self): |
89 | | - pass |
90 | | - |
91 | | - def finalize_options(self): |
92 | | - pass |
93 | | - |
94 | | - def run(self): |
95 | | - try: |
96 | | - self.status("Removing previous builds…") |
97 | | - rmtree(os.path.join(here, "dist")) |
98 | | - except OSError: |
99 | | - pass |
100 | | - |
101 | | - self.status("Building Source and Wheel (universal) distribution…") |
102 | | - os.system(f"{sys.executable} setup.py sdist bdist_wheel --universal") |
103 | | - |
104 | | - self.status("Uploading the package to PyPI via Twine…") |
105 | | - os.system("twine upload -r testpypi dist/*") |
106 | | - |
107 | | - sys.exit(0) |
108 | | - |
109 | | - |
110 | | -setup( |
111 | | - name=NAME, |
112 | | - version=VERSION, |
113 | | - description=DESCRIPTION, |
114 | | - long_description=long_description, |
115 | | - long_description_content_type="text/markdown", |
116 | | - author=AUTHOR, |
117 | | - author_email=EMAIL, |
118 | | - python_requires=REQUIRES_PYTHON, |
119 | | - url=URL, |
120 | | - packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]), |
121 | | - install_requires=REQUIRED, |
122 | | - extras_require=EXTRAS, |
123 | | - include_package_data=True, |
124 | | - license="GPLv3", |
125 | | - classifiers=[ |
126 | | - # Trove classifiers |
127 | | - # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers |
128 | | - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", |
129 | | - "Programming Language :: Python", |
130 | | - "Programming Language :: Python :: 3.8", |
131 | | - "Natural Language :: English", |
132 | | - "Operating System :: MacOS", |
133 | | - "Operating System :: Unix", |
134 | | - ], |
135 | | - cmdclass={ |
136 | | - "upload": UploadCommand, |
137 | | - "test": TestUploadCommand, |
138 | | - }, |
139 | | -) |
| 9 | +setup() |
0 commit comments