Skip to content

Commit 5fc02df

Browse files
committed
Teak setup.py
* Pass markdown directly to `long_description` and specify `long_description_content_type`. Don't use pandoc. * Load version from `julia/release.py`. This number can be accessed via `julia.__version__` at runtime now. * Bump version number to 0.2.0.dev. * Pass `zip_safe=False`.
1 parent 90aec01 commit 5fc02df

File tree

3 files changed

+42
-13
lines changed

3 files changed

+42
-13
lines changed

julia/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
from .release import __version__
12
from .core import JuliaError, LegacyJulia as Julia

julia/release.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is executed via setup.py and imported via __init__.py
2+
3+
__version__ = "0.2.0.dev"
4+
# For Python versioning scheme, see:
5+
# https://www.python.org/dev/peps/pep-0440/#version-scheme

setup.py

+36-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,41 @@
11
#!/usr/bin/env python
2-
"""Julia/Python bridge with IPython support.
3-
"""
42

53
from setuptools import setup
6-
import sys
4+
import os
75

8-
doc = __doc__
6+
7+
def pyload(name):
8+
ns = {}
9+
with open(name) as f:
10+
exec(compile(f.read(), name, "exec"), ns)
11+
return ns
12+
13+
# In case it's Python 2:
914
try:
10-
import pypandoc
11-
with open('README.md') as f:
12-
desc = f.read()
13-
print('will convert description from markdown to rst.')
14-
doc = pypandoc.convert(desc, 'rst', format='markdown')
15-
except Exception:
16-
print('Unable to convert markdown to rst. Please install `pypandoc` and `pandoc` to use markdown long description.')
15+
execfile
16+
except NameError:
17+
pass
18+
else:
19+
def pyload(path):
20+
ns = {}
21+
execfile(path, ns)
22+
return ns
23+
24+
25+
repo_root = os.path.abspath(os.path.dirname(__file__))
26+
27+
with open(os.path.join(repo_root, "README.md")) as f:
28+
long_description = f.read()
29+
# https://packaging.python.org/guides/making-a-pypi-friendly-readme/
30+
31+
ns = pyload(os.path.join(repo_root, "julia", "release.py"))
32+
version = ns["__version__"]
1733

1834
setup(name='julia',
19-
version='0.1.5',
20-
description=doc,
35+
version=version,
36+
description="Julia/Python bridge with IPython support.",
37+
long_description=long_description,
38+
long_description_content_type="text/markdown",
2139
author='The Julia and IPython development teams.',
2240
author_email='[email protected]',
2341
license='MIT',
@@ -42,6 +60,7 @@
4260
'Programming Language :: Python :: 3.4',
4361
'Programming Language :: Python :: 3.5',
4462
'Programming Language :: Python :: 3.6',
63+
'Programming Language :: Python :: 3.7',
4564
],
4665
url='http://julialang.org',
4766
packages=['julia'],
@@ -51,4 +70,8 @@
5170
"python-jl = julia.python_jl:main",
5271
],
5372
},
73+
# We bundle Julia scripts etc. inside `julia` directory. Thus,
74+
# this directory must exist in the file system (not in a zip
75+
# file):
76+
zip_safe=False,
5477
)

0 commit comments

Comments
 (0)