Skip to content

Commit 1a78433

Browse files
Add files via upload
1 parent 619940d commit 1a78433

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
matplotlib==3.3.1
2+
numpy==1.19.2
3+
pandas==1.1.2
4+
scipy==1.5.2
5+
pyswarms==1.2.0

setup.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
4+
# In[14]:
5+
6+
7+
import io
8+
import os
9+
import sys
10+
from shutil import rmtree
11+
12+
from setuptools import find_packages, setup, Command
13+
14+
# Package meta-data.
15+
NAME = 'pyPortfolioAnalysis'
16+
DESCRIPTION = 'Portfolio Analysis, methods for portfolio optimization'
17+
URL = 'https://github.com/anuragagrawaal/pyPortfolioAnalysis'
18+
EMAIL = 'agrawalanurag1999@gmail.com'
19+
AUTHOR = 'Anurag Agrawal'
20+
REQUIRES_PYTHON = '>=3.6.0'
21+
VERSION = '1.0.2'
22+
23+
# What packages are required for this module to be executed?
24+
REQUIRED = ['numpy', 'pandas', 'scipy', 'pyswarms', 'matplotlib', 'pyyaml']
25+
26+
27+
here = os.path.abspath(os.path.dirname(__file__))
28+
29+
# Import the README and use it as the long-description.
30+
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
31+
try:
32+
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
33+
long_description = '\n' + f.read()
34+
except:
35+
long_description = DESCRIPTION
36+
37+
# Load the package's __version__.py module as a dictionary.
38+
about = {}
39+
if not VERSION:
40+
project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
41+
with open(os.path.join(here, project_slug, '__version__.py')) as f:
42+
exec(f.read(), about)
43+
else:
44+
about['__version__'] = VERSION
45+
46+
47+
class UploadCommand(Command):
48+
"""Support setup.py upload."""
49+
50+
description = 'Portfolio Analysis, methods for portfolio optimization'
51+
user_options = []
52+
53+
@staticmethod
54+
def status(s):
55+
"""Prints things in bold."""
56+
print('\033[1m{0}\033[0m'.format(s))
57+
58+
def initialize_options(self):
59+
pass
60+
61+
def finalize_options(self):
62+
pass
63+
64+
def run(self):
65+
try:
66+
self.status('Removing previous builds…')
67+
rmtree(os.path.join(here, 'dist'))
68+
except OSError:
69+
pass
70+
71+
self.status('Building Source and Wheel (universal) distribution…')
72+
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
73+
74+
self.status('Uploading the package to PyPI via Twine…')
75+
os.system('twine upload dist/*')
76+
77+
self.status('Pushing git tags…')
78+
os.system('git tag v{0}'.format(about['__version__']))
79+
os.system('git push --tags')
80+
81+
sys.exit()
82+
83+
84+
# Where the magic happens:
85+
setup(
86+
name=NAME,
87+
version=about['__version__'],
88+
description=DESCRIPTION,
89+
long_description=long_description,
90+
long_description_content_type='text/markdown',
91+
author=AUTHOR,
92+
author_email=EMAIL,
93+
python_requires=REQUIRES_PYTHON,
94+
url=URL,
95+
packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
96+
install_requires=REQUIRED,
97+
include_package_data=True,
98+
license='GPL3',
99+
cmdclass={
100+
'upload': UploadCommand,
101+
},
102+
)
103+

0 commit comments

Comments
 (0)