forked from tensorforce/tensorforce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
171 lines (148 loc) · 5.54 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Copyright 2020 Tensorforce Team. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
import os
from setuptools import find_packages, setup
import sys
"""
cd docs; make html; cd ..;
pip install --upgrade -r requirements-all.txt
# ... update requirements.txt and setup.py ...
# Check "before update" notes
# Update __version__ in tensorforce/__init__.py, and UPDATE_NOTES.md
rm -r build
rm -r dist
rm -r docs/_*
pip install --upgrade pip setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/Tensorforce-0.6.X*
deactivate
cd ..
source [XYZ]
pip install --upgrade -r tensorforce/requirements.txt
pip install --upgrade --index-url https://test.pypi.org/simple/ tensorforce
python
> import tensorforce
> print(tensorforce.__version__)
> quit()
python tensorforce/examples/quickstart.py
deactivate
source [XYZ]
cd tensorforce
git status
git add -u
git commit -m "Fix PyPI version 0.6.X"
git push origin master
# Wait for a while to check Travis is not failing right away (installation, first tests)
twine upload dist/Tensorforce-0.6.X*
# Fix Github release
"""
if sys.version_info.major != 3:
raise NotImplementedError("Tensorforce is only compatible with Python 3.")
tensorforce_directory = os.path.abspath(os.path.dirname(__file__))
# Extract version from tensorforce/__init__.py
version = None
with open(os.path.join(tensorforce_directory, 'tensorforce', '__init__.py'), 'r') as filehandle:
for line in filehandle:
if line.startswith('__version__ = \'') and line.endswith('\'\n'):
version = line[15:-2]
assert version is not None
# Extract long_description from README.md introduction
long_description = list()
with open(os.path.join(tensorforce_directory, 'README.md'), 'r') as filehandle:
lines = iter(filehandle)
line = next(lines)
if not line.startswith('# Tensorforce:'):
raise NotImplementedError
long_description.append(line)
for line in lines:
if line == '#### Introduction\n':
break
if next(lines) != '\n':
raise NotImplementedError
while True:
line = next(lines)
if line == '\n':
line = next(lines)
if line == '\n':
break
else:
long_description.append('\n')
long_description.append(line)
else:
long_description.append(line)
while line == '\n':
line = next(lines)
if not line.startswith('#### '):
raise NotImplementedError
assert len(long_description) > 0
long_description.append('\n')
long_description.append('For more information, see the [GitHub project page](https://github.com/ten'
'sorforce/tensorforce) and [ReadTheDocs documentation](https://tensorforce.'
'readthedocs.io/en/latest/).\n')
long_description = ''.join(long_description)
# Find packages
packages = find_packages(exclude=('test',))
assert all(package.startswith('tensorforce') for package in packages)
# Extract install_requires from requirements.txt
install_requires = list()
with open(os.path.join(tensorforce_directory, 'requirements.txt'), 'r') as filehandle:
for line in filehandle:
line = line.strip()
if line:
install_requires.append(line)
assert len(install_requires) > 0
# Readthedocs requires Sphinx extensions to be specified as part of install_requires.
if os.environ.get('READTHEDOCS', None) == 'True':
install_requires.append('recommonmark')
setup(
name='Tensorforce',
version=version,
description='Tensorforce: a TensorFlow library for applied reinforcement learning',
long_description=long_description,
long_description_content_type='text/markdown',
author='Alexander Kuhnle',
author_email='[email protected]',
url='http://github.com/tensorforce/tensorforce',
packages=packages,
download_url='https://github.com/tensorforce/tensorforce/archive/{}.tar.gz'.format(version),
license='Apache 2.0',
python_requires='>=3.7',
classifiers=[
'Natural Language :: English',
'Topic :: Scientific/Engineering',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
install_requires=install_requires,
extras_require=dict(
tfa=['tensorflow-addons >= 0.15.0'],
tune=['hpbandster >= 0.7.4'],
envs=[
'ale-py >= 0.7.3', 'gym[atari,box2d,classic_control] >= 0.21.0', 'box2d >= 2.3.10',
'gym-retro >= 0.8.0', 'vizdoom == 1.1.11'
],
ale=['ale-py >= 0.7.3'],
gym=['gym[box2d,classic_control] >= 0.21.0', 'box2d >= 2.3.10'],
retro=['gym-retro >= 0.8.0'],
vizdoom=['vizdoom >= 1.1.11'],
carla=['pygame', 'opencv-python'],
docs=[
'm2r >= 0.2.1', 'recommonmark >= 0.7.1', 'sphinx >= 4.3.2', 'sphinx-rtd-theme >= 1.0.0'
],
tests=['pytest >= 6.2.5']
),
zip_safe=False
)