Skip to content

Commit 84e0738

Browse files
authored
MAINT: Auto-detect version from version.py in setup.py (#606)
* MAINT: Auto-detect version from `version.py` * MAINT: define __version__ in __init__ * MAINT: Delete version.py * CI: Activate conda env
1 parent 417cf38 commit 84e0738

File tree

4 files changed

+5
-28
lines changed

4 files changed

+5
-28
lines changed

.github/workflows/conda_ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ jobs:
3838
conda list
3939
4040
- name: Setup QuantEcon
41+
shell: bash -l {0}
4142
run: |
43+
conda activate test
4244
python setup.py build
4345
4446
- name: Run Tests

quantecon/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"Cannot import numba from current anaconda distribution. \
1111
Please run `conda install numba` to install the latest version.")
1212

13+
__version__ = '0.5.2'
14+
1315
#-Modules-#
1416
from . import distributions
1517
from . import game_theory
@@ -47,6 +49,3 @@
4749
from .rank_nullspace import rank_est, nullspace
4850
from .robustlq import RBLQ
4951
from .util import searchsorted, fetch_nb_dependencies, tic, tac, toc
50-
51-
#-Add Version Attribute-#
52-
from .version import version as __version__

quantecon/version.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,8 @@
11
# Use setuptools in preference to distutils
22
from setuptools import setup, find_packages
33
import os
4+
from quantecon import __version__ as VERSION
45

5-
#-Write Versions File-#
6-
7-
VERSION = '0.5.2'
8-
9-
def write_version_py(filename=None):
10-
"""
11-
This constructs a version file for the project
12-
"""
13-
doc = "\"\"\"\nThis is a VERSION file and should NOT be manually altered\n\"\"\""
14-
doc += "\nversion = '%s'\n" % VERSION
15-
16-
if not filename:
17-
filename = os.path.join(os.path.dirname(__file__), 'quantecon', 'version.py')
18-
19-
fl = open(filename, 'w')
20-
try:
21-
fl.write(doc)
22-
finally:
23-
fl.close()
24-
25-
write_version_py() # This is a file used to control the qe.__version__ attribute
266

277
#-Meta Information-#
288
#~~~~~~~~~~~~~~~~~~#

0 commit comments

Comments
 (0)