Skip to content

Commit 9b5f88f

Browse files
committed
new setup.py
1 parent 99d0c80 commit 9b5f88f

File tree

2 files changed

+113
-19
lines changed

2 files changed

+113
-19
lines changed

gpgraph/__version__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.1.0'

setup.py

Lines changed: 112 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,112 @@
1-
# Try using setuptools first, if it's installed
2-
from setuptools import setup
3-
4-
# define all packages for distribution
5-
packages = [
6-
'gpgraph',
7-
]
8-
9-
setup(name='gpgraph',
10-
version='0.1.0',
11-
description='Genotype-phenotype maps in NetworkX.',
12-
author='Zach Sailer',
13-
author_email='zachsailer@gmail.com',
14-
url='https://github.com/harmslab/gpgraph',
15-
packages=packages,
16-
classifiers=[
17-
'Development Status :: 3 - Alpha',
18-
],
19-
zip_safe=False)
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
# Note: To use the 'upload' functionality of this file, you must:
5+
# $ pip install twine
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 = 'gpgraph'
16+
DESCRIPTION = 'NetworkX for genotype-phenotype maps.'
17+
URL = 'https://github.com/Zsailer/gpgraph'
18+
EMAIL = 'zachsailer@gmail.com'
19+
AUTHOR = 'Zach Sailer'
20+
21+
# What packages are required for this module to be executed?
22+
REQUIRED = []
23+
24+
# The rest you shouldn't have to touch too much :)
25+
# ------------------------------------------------
26+
# Except, perhaps the License and Trove Classifiers!
27+
# If you do change the License, remember to change the Trove Classifier for
28+
# that!
29+
30+
here = os.path.abspath(os.path.dirname(__file__))
31+
32+
# Import the README and use it as the long-description.
33+
# Note: this will only work if 'README.rst' is present in your MANIFEST.in
34+
# file!
35+
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
36+
long_description = '\n' + f.read()
37+
38+
# Load the package's __version__.py module as a dictionary.
39+
about = {}
40+
with open(os.path.join(here, NAME, '__version__.py')) as f:
41+
exec(f.read(), about)
42+
43+
44+
class UploadCommand(Command):
45+
"""Support setup.py upload."""
46+
47+
description = 'Build and publish the package.'
48+
user_options = []
49+
50+
@staticmethod
51+
def status(s):
52+
"""Prints things in bold."""
53+
print('\033[1m{0}\033[0m'.format(s))
54+
55+
def initialize_options(self):
56+
pass
57+
58+
def finalize_options(self):
59+
pass
60+
61+
def run(self):
62+
try:
63+
self.status('Removing previous builds…')
64+
rmtree(os.path.join(here, 'dist'))
65+
except OSError:
66+
pass
67+
68+
self.status('Building Source and Wheel (universal) distribution…')
69+
os.system('{0} setup.py sdist bdist_wheel --universal'.format(
70+
sys.executable))
71+
72+
self.status('Uploading the package to PyPi via Twine…')
73+
os.system('twine upload dist/*')
74+
75+
sys.exit()
76+
77+
78+
# Where the magic happens:
79+
setup(
80+
name=NAME,
81+
version=about['__version__'],
82+
description=DESCRIPTION,
83+
long_description=long_description,
84+
author=AUTHOR,
85+
author_email=EMAIL,
86+
url=URL,
87+
packages=find_packages(exclude=('tests',)),
88+
# If your package is a single module, use this instead of 'packages':
89+
# py_modules=['mypackage'],
90+
91+
# entry_points={
92+
# 'console_scripts': ['mycli=mymodule:cli'],
93+
# },
94+
install_requires=REQUIRED,
95+
include_package_data=True,
96+
license='MIT',
97+
classifiers=[
98+
# Trove classifiers
99+
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
100+
'Programming Language :: Python :: 3',
101+
'Programming Language :: Python :: 3.3',
102+
'Programming Language :: Python :: 3.4',
103+
'Programming Language :: Python :: 3.5',
104+
'Programming Language :: Python :: 3.6',
105+
'Programming Language :: Python :: Implementation :: CPython',
106+
'Programming Language :: Python :: Implementation :: PyPy'
107+
],
108+
# $ setup.py publish support.
109+
cmdclass={
110+
'upload': UploadCommand,
111+
},
112+
)

0 commit comments

Comments
 (0)