Browse Source

[deps] package with setuptools

Maxime Alves LIRMM@home 4 years ago
parent
commit
a38c66b417
5 changed files with 274 additions and 3 deletions
  1. 10
    0
      MANIFEST.in
  2. 2
    3
      pyproject.toml
  3. 4
    0
      setup.cfg
  4. 222
    0
      setup.py
  5. 36
    0
      tox.ini

+ 10
- 0
MANIFEST.in View File

@@ -0,0 +1,10 @@
1
+include pyproject.toml
2
+
3
+# Include the README
4
+include *.md
5
+
6
+# Include the license file
7
+include LICENSE.txt
8
+
9
+# Include the data files
10
+recursive-include data *

+ 2
- 3
pyproject.toml View File

@@ -24,6 +24,5 @@ pytest-asyncio = "^0.14.0"
24 24
 pyheatpump = 'pyheatpump.cli:cli'
25 25
 
26 26
 [build-system]
27
-requires = ["poetry>=0.12"]
28
-build-backend = "poetry.masonry.api"
29
-
27
+requires = ["setuptools>=40.8.0", "wheel"]
28
+build-backend = "setuptools.build_meta"

+ 4
- 0
setup.cfg View File

@@ -0,0 +1,4 @@
1
+[metadata]
2
+# This includes the license file(s) in the wheel.
3
+# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file
4
+license_files = LICENSE

+ 222
- 0
setup.py View File

@@ -0,0 +1,222 @@
1
+"""A setuptools based setup module.
2
+
3
+See:
4
+https://packaging.python.org/guides/distributing-packages-using-setuptools/
5
+https://github.com/pypa/sampleproject
6
+"""
7
+
8
+# Always prefer setuptools over distutils
9
+from setuptools import setup, find_packages
10
+import pathlib
11
+import os
12
+
13
+__version__ = '__0.0.0__'
14
+with open('pyheatpump/__init__.py') as f:
15
+    line = f.readline()
16
+    __version__ = line.split("'")[1]
17
+
18
+here = pathlib.Path(__file__).parent.resolve()
19
+
20
+# Get the long description from the README file
21
+long_description = (here / 'README.md').read_text(encoding='utf-8')
22
+
23
+# Arguments marked as "Required" below must be included for upload to PyPI.
24
+# Fields marked as "Optional" may be commented out.
25
+
26
+
27
+def get_packages(package):
28
+    """
29
+    Return root package and all sub-packages.
30
+    """
31
+    return [
32
+        dirpath
33
+        for dirpath, dirnames, filenames in os.walk(package)
34
+        if os.path.exists(os.path.join(dirpath, "__init__.py"))
35
+    ]
36
+
37
+
38
+setup(
39
+    # This is the name of your project. The first time you publish this
40
+    # package, this name will be registered for you. It will determine how
41
+    # users can install this project, e.g.:
42
+    #
43
+    # $ pip install sampleproject
44
+    #
45
+    # And where it will live on PyPI: https://pypi.org/project/sampleproject/
46
+    #
47
+    # There are some restrictions on what makes a valid project name
48
+    # specification here:
49
+    # https://packaging.python.org/specifications/core-metadata/#name
50
+    name='pyHeatpump',  # Required
51
+
52
+    # Versions should comply with PEP 440:
53
+    # https://www.python.org/dev/peps/pep-0440/
54
+    #
55
+    # For a discussion on single-sourcing the version across setup.py and the
56
+    # project code, see
57
+    # https://packaging.python.org/en/latest/single_source_version.html
58
+    version=__version__,  # Required
59
+
60
+    # This is a one-line description or tagline of what your project does. This
61
+    # corresponds to the "Summary" metadata field:
62
+    # https://packaging.python.org/specifications/core-metadata/#summary
63
+    description='pyHeatpump connects modbus to REST APIs',  # Optional
64
+
65
+    # This is an optional longer description of your project that represents
66
+    # the body of text which users will see when they visit PyPI.
67
+    #
68
+    # Often, this is the same as your README, so you can just read it in from
69
+    # that file directly (as we have already done above)
70
+    #
71
+    # This field corresponds to the "Description" metadata field:
72
+    # https://packaging.python.org/specifications/core-metadata/#description-optional
73
+    #long_description=long_description, # Optional
74
+
75
+    # Denotes that our long_description is in Markdown; valid values are
76
+    # text/plain, text/x-rst, and text/markdown
77
+    #
78
+    # Optional if long_description is written in reStructuredText (rst) but
79
+    # required for plain-text or Markdown; if unspecified, "applications should
80
+    # attempt to render [the long_description] as text/x-rst; charset=UTF-8 and
81
+    # fall back to text/plain if it is not valid rst" (see link below)
82
+    #
83
+    # This field corresponds to the "Description-Content-Type" metadata field:
84
+    # https://packaging.python.org/specifications/core-metadata/#description-content-type-optional
85
+    #long_description_content_type='text/markdown',  # Optional (see note above)
86
+
87
+    # This should be a valid link to your project's main homepage.
88
+    #
89
+    # This field corresponds to the "Home-Page" metadata field:
90
+    # https://packaging.python.org/specifications/core-metadata/#home-page-optional
91
+    url='https://git.yannweb.net/maxime-alves/pyHeatpump',  # Optional
92
+
93
+    # This should be your name or the name of the organization which owns the
94
+    # project.
95
+    author='Maxime Alves',  # Optional
96
+
97
+    # This should be a valid email address corresponding to the author listed
98
+    # above.
99
+    author_email='maxime@freepoteries.fr',  # Optional
100
+
101
+    # Classifiers help users find your project by categorizing it.
102
+    #
103
+    # For a list of valid classifiers, see https://pypi.org/classifiers/
104
+    # classifiers=[  # Optional
105
+    #     # How mature is this project? Common values are
106
+    #     #   3 - Alpha
107
+    #     #   4 - Beta
108
+    #     #   5 - Production/Stable
109
+    #     'Development Status :: 3 - Alpha',
110
+    #
111
+    #     # Indicate who your project is intended for
112
+    #     'Intended Audience :: Developers',
113
+    #     'Topic :: Software Development :: Build Tools',
114
+    #
115
+    #     # Pick your license as you wish
116
+    #     'License :: OSI Approved :: MIT License',
117
+    #
118
+    #     # Specify the Python versions you support here. In particular, ensure
119
+    #     # that you indicate you support Python 3. These classifiers are *not*
120
+    #     # checked by 'pip install'. See instead 'python_requires' below.
121
+    #     'Programming Language :: Python :: 3',
122
+    #     'Programming Language :: Python :: 3.5',
123
+    #     'Programming Language :: Python :: 3.6',
124
+    #     'Programming Language :: Python :: 3.7',
125
+    #     'Programming Language :: Python :: 3.8',
126
+    #     'Programming Language :: Python :: 3 :: Only',
127
+    # ],
128
+
129
+    # This field adds keywords for your project which will appear on the
130
+    # project page. What does your project relate to?
131
+    #
132
+    # Note that this is a list of additional keywords, separated
133
+    # by commas, to be used to assist searching for the distribution in a
134
+    # larger catalog.
135
+    keywords='modbus, api',  # Optional
136
+
137
+    # When your source code is in a subdirectory under the project root, e.g.
138
+    # `src/`, it is necessary to specify the `package_dir` argument.
139
+    package_dir={'pyheatpump': 'pyheatpump'},  # Optional
140
+
141
+    # You can just specify package directories manually here if your project is
142
+    # simple. Or you can use find_packages().
143
+    #
144
+    # Alternatively, if you just want to distribute a single Python file, use
145
+    # the `py_modules` argument instead as follows, which will expect a file
146
+    # called `my_module.py` to exist:
147
+    #
148
+    #   py_modules=["my_module"],
149
+    #
150
+    packages=get_packages('pyheatpump'),  # Required
151
+
152
+    # Specify which Python versions you support. In contrast to the
153
+    # 'Programming Language' classifiers above, 'pip install' will check this
154
+    # and refuse to install the project if the version does not match. See
155
+    # https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
156
+    python_requires='>=3.5, <4',
157
+
158
+    # This field lists other packages that your project depends on to run.
159
+    # Any package you put here will be installed by pip when your project is
160
+    # installed, so they must be valid existing projects.
161
+    #
162
+    # For an analysis of "install_requires" vs pip's requirements files see:
163
+    # https://packaging.python.org/en/latest/requirements.html
164
+    install_requires=[
165
+        'starlette>=0.13,<1',
166
+        'uvicorn>=0.11,<1',
167
+        'umodbus>=1.0.3,<2',
168
+        'click>=7.1.2,<8',
169
+        'requests>=2.24.0,<3',
170
+        'netifaces>=0.10.9,<1'
171
+    ], 
172
+
173
+    # List additional groups of dependencies here (e.g. development
174
+    # dependencies). Users will be able to install these using the "extras"
175
+    # syntax, for example:
176
+    #
177
+    #   $ pip install sampleproject[dev]
178
+    #
179
+    # Similar to `install_requires` above, these must be valid existing
180
+    # projects.
181
+    extras_require={  # Optional
182
+        'test': ['pytest', 'asynctest', 'pytest-asyncio'],
183
+    },
184
+
185
+    # If there are data files included in your packages that need to be
186
+    # installed, specify them here.
187
+    package_data={  # Optional
188
+        'db': ['db/pyheatpump.sql'],
189
+    },
190
+
191
+    # Although 'package_data' is the preferred approach, in some case you may
192
+    # need to place data files outside of your packages. See:
193
+    # http://docs.python.org/distutils/setupscript.html#installing-additional-files
194
+    #
195
+    # In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
196
+    # data_files=[('my_data', ['data/data_file'])],  # Optional
197
+
198
+    # To provide executable scripts, use entry points in preference to the
199
+    # "scripts" keyword. Entry points provide cross-platform support and allow
200
+    # `pip` to create the appropriate form of executable for the target
201
+    # platform.
202
+    #
203
+    # For example, the following would provide a command called `sample` which
204
+    # executes the function `main` from this package when invoked:
205
+    entry_points={  # Optional
206
+        'console_scripts': [
207
+            'pyheatpump=pyheatpump.cli:cli',
208
+        ],
209
+    },
210
+
211
+    # List additional URLs that are relevant to your project as a dict.
212
+    #
213
+    # This field corresponds to the "Project-URL" metadata fields:
214
+    # https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use
215
+    #
216
+    # Examples listed include a pattern for specifying where the package tracks
217
+    # issues, where the source is hosted, where to say thanks to the package
218
+    # maintainers, and where to support the project financially. The key is
219
+    # what's used to render the link text on PyPI.
220
+    project_urls={  # Optional
221
+    },
222
+)

+ 36
- 0
tox.ini View File

@@ -0,0 +1,36 @@
1
+# this file is *not* meant to cover or endorse the use of tox or pytest or
2
+# testing in general,
3
+#
4
+#  It's meant to show the use of:
5
+#
6
+#  - check-manifest
7
+#     confirm items checked into vcs are in your sdist
8
+#  - python setup.py check
9
+#     confirm required package meta-data in setup.py
10
+#  - readme_renderer (when using a ReStructuredText README)
11
+#     confirms your long_description will render correctly on PyPI.
12
+#
13
+#  and also to help confirm pull requests to this project.
14
+
15
+[tox]
16
+envlist = py{35,36,37,38}
17
+
18
+# Define the minimal tox version required to run;
19
+# if the host tox is less than this the tool with create an environment and
20
+# provision it with a tox that satisfies it under provision_tox_env.
21
+# At least this version is needed for PEP 517/518 support.
22
+minversion = 3.3.0
23
+
24
+# Activate isolated build environment. tox will use a virtual environment
25
+# to build a source distribution from the source tree. For build tools and
26
+# arguments use the pyproject.toml file as specified in PEP-517 and PEP-518.
27
+isolated_build = true
28
+
29
+[testenv]
30
+deps =
31
+    pytest >= 5.4.3
32
+commands =
33
+
34
+[flake8]
35
+exclude = .tox,*.egg,build,data
36
+select = E,W,F

Loading…
Cancel
Save