-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathsetup.py
More file actions
133 lines (99 loc) · 5.13 KB
/
setup.py
File metadata and controls
133 lines (99 loc) · 5.13 KB
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
# -*- coding: utf-8 -*-
# Author: Timur Gilmullin
# Build with GitHub Actions.
from setuptools import setup, find_packages
import os
verPath = os.path.join(os.path.dirname(__file__), "tksbrokerapi", "_version.py")
ver = {}
exec(open(verPath).read(), ver)
moduleVer = ver["__version__"]
devStatus = "4 - Beta" # Default development status.
VERSION_OFFSET = 200 # Offset for the build number.
# Determine if the build is running inside a CI environment (GitHub Actions):
if "GITHUB_RUN_NUMBER" in os.environ and "GITHUB_REF" in os.environ:
print("This is GitHub Actions build")
print("GITHUB_RUN_NUMBER = {}".format(os.environ["GITHUB_RUN_NUMBER"]))
print("GITHUB_REF = {}".format(os.environ["GITHUB_REF"]))
# Extract the branch/tag name from GITHUB_REF (e.g., refs/heads/branch-name):
branchName = os.environ["GITHUB_REF"].split("/")[-1]
# Generate the version based on the branch name and build number:
moduleVer += ".{}{}".format(
"" if "release" in branchName or branchName == "master" else "dev",
int(os.environ["GITHUB_RUN_NUMBER"]) + VERSION_OFFSET,
)
# Update the development status for release branches:
devStatus = "5 - Production/Stable" if "release" in branchName or branchName == "master" else devStatus
else:
print("This is a local build")
moduleVer += ".dev0" # For local builds, use the dev0 suffix.
# Print the determined version for the build
print("TKSBrokerAPI build version = {}".format(moduleVer))
# Save current build version to file for Docker step:
with open(".version", "w") as fH:
fH.write(moduleVer.strip() + "\n")
# Read dependencies from `requirements.txt`:
with open("requirements.txt", "r", encoding="utf-8") as f:
installRequires = [line.strip() for line in f if line.strip() and not line.startswith("#")]
# Configure setuptools for the TKSBrokerAPI project:
setup(
python_requires=">=3.9", # Minimum supported Python version.
name="tksbrokerapi",
version=moduleVer, # Include the dynamically generated version.
description="TKSBrokerAPI is a trading platform designed to automate and simplify trading scenarios. It integrates with the Tinkoff Invest API server using the REST protocol. The platform can be used in two flexible ways: Command-Line Interface (CLI) and Python Library. This feature-rich API is perfect for trading enthusiasts and professional developers creating advanced automation solutions.",
long_description=(
"![TKSBrokerAPI Logo]"
"(https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/docs/media/TKSBrokerAPI-Logo.png?raw=true)\n\n"
"*By [Fuzzy Technologies](https://fuzzy-technologies.github.io/)*\n\n\n"
"🇺🇸 📚 **English Documentation:**\n\n"
"• Full README with examples: [README_EN.md](https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/README_EN.md)\n\n"
"• API Reference: [TKSBrokerAPI module docs](https://tim55667757.github.io/TKSBrokerAPI/docs/tksbrokerapi/TKSBrokerAPI.html)\n\n"
"• Cumulative Release Notes: [CHANGELOG_EN.md](https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/CHANGELOG_EN.md)\n\n\n"
"🇷🇺 📚 **Документация на русском:**\n\n"
"• Подробное описание и примеры: [README.md](https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/README.md)\n\n"
"• Документация на модуль: [TKSBrokerAPI module docs](https://tim55667757.github.io/TKSBrokerAPI/docs/tksbrokerapi/TKSBrokerAPI.html)\n\n\n"
"• Накопительные релиз-ноты: [CHANGELOG.md](https://github.com/Tim55667757/TKSBrokerAPI/blob/develop/CHANGELOG.md)\n"
),
long_description_content_type="text/markdown",
license="Apache-2.0",
license_files=["LICENSE"],
author="Timur Gilmullin",
author_email="tim55667757@gmail.com",
url="https://github.com/Tim55667757/TKSBrokerAPI/",
download_url="https://github.com/Tim55667757/TKSBrokerAPI.git",
entry_points={"console_scripts": ["tksbrokerapi=tksbrokerapi.TKSBrokerAPI:Main"]},
classifiers=[
"Development Status :: {}".format(devStatus),
"Environment :: Console",
"Intended Audience :: Financial and Insurance Industry",
"Topic :: Utilities",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
], # Classifiers are based on PyPI specifications: https://pypi.org/classifiers/
keywords=[
"history",
"csv",
"stock",
"prices",
"candlesticks",
"statistics",
"cli",
"client",
"rest",
"rest-api",
"api-client",
"trading-api",
"trading",
"trading-platform",
"trade",
"tinkoff",
"tinkoff-api",
"python-api",
"openapi",
"platform",
],
install_requires=installRequires, # Load dependencies from `requirements.txt`.
packages=find_packages(), # Automatically find packages in the project.
include_package_data=True, # Automatically include files from `MANIFEST.in`.
zip_safe=True,
)