Skip to content

Commit

Permalink
MAINT: Auto-detect version from version.py in setup.py (#606)
Browse files Browse the repository at this point in the history
* MAINT: Auto-detect version from `version.py`

* MAINT: define __version__ in __init__

* MAINT: Delete version.py

* CI: Activate conda env
  • Loading branch information
Smit-create committed Feb 24, 2022
1 parent 417cf38 commit 84e0738
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/conda_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ jobs:
conda list
- name: Setup QuantEcon
shell: bash -l {0}
run: |
conda activate test
python setup.py build
- name: Run Tests
Expand Down
5 changes: 2 additions & 3 deletions quantecon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"Cannot import numba from current anaconda distribution. \
Please run `conda install numba` to install the latest version.")

__version__ = '0.5.2'

#-Modules-#
from . import distributions
from . import game_theory
Expand Down Expand Up @@ -47,6 +49,3 @@
from .rank_nullspace import rank_est, nullspace
from .robustlq import RBLQ
from .util import searchsorted, fetch_nb_dependencies, tic, tac, toc

#-Add Version Attribute-#
from .version import version as __version__
4 changes: 0 additions & 4 deletions quantecon/version.py

This file was deleted.

22 changes: 1 addition & 21 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
# Use setuptools in preference to distutils
from setuptools import setup, find_packages
import os
from quantecon import __version__ as VERSION

#-Write Versions File-#

VERSION = '0.5.2'

def write_version_py(filename=None):
"""
This constructs a version file for the project
"""
doc = "\"\"\"\nThis is a VERSION file and should NOT be manually altered\n\"\"\""
doc += "\nversion = '%s'\n" % VERSION

if not filename:
filename = os.path.join(os.path.dirname(__file__), 'quantecon', 'version.py')

fl = open(filename, 'w')
try:
fl.write(doc)
finally:
fl.close()

write_version_py() # This is a file used to control the qe.__version__ attribute

#-Meta Information-#
#~~~~~~~~~~~~~~~~~~#
Expand Down

0 comments on commit 84e0738

Please sign in to comment.