Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pyschism/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
# from pyschism.param.param import Param
from pyschism.stations import Stations
from pyschism.driver import ModelDriver, ModelConfig

from ._version import __version__
__all__ = ['ModelConfig', 'ModelDriver', 'Stations']


if util.find_spec("colored_traceback") is not None:
import colored_traceback # type: ignore[import]
colored_traceback.add_hook(always=True)
1 change: 1 addition & 0 deletions pyschism/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.15.1"
43 changes: 18 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,6 @@
import subprocess
import sys

# subprocess.check_call(
# [sys.executable, '-m', 'pip', 'install', '--upgrade', 'pip'])
#
# subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'wheel'])

try:
from dunamai import Version
except ImportError:
subprocess.check_call(
[sys.executable, '-m', 'pip', 'install', 'dunamai']
)
from dunamai import Version # type: ignore[import]

try:
version = Version.from_any_vcs().serialize()
except RuntimeError:
version = '0.0.0'
except ValueError as e:
if "time data '%cI' does not match format '%Y-%m-%dT%H:%M:%S%z'" in str(e):
version = '0.0.0'
else:
raise

class BuildSchism(setuptools.Command):

description = "build external SCHISM dependencies"
Expand Down Expand Up @@ -80,12 +57,28 @@ def run(self):
# subprocess.check_call(
# ["git", "submodule", "deinit", "-f", "submodules/jigsaw-python"])


# Source - https://stackoverflow.com/a/7071358
# Posted by Zooko, modified by community. See post 'Timeline' for change history
# Retrieved 2026-05-08, License - CC BY-SA 4.0

import re
VERSIONFILE="pyschism/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr = mo.group(1)
else:
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))


parent = pathlib.Path(__file__).parent.absolute()
conf = setuptools.config.read_configuration(parent / 'setup.cfg')
meta = conf['metadata']
setuptools.setup(
name=meta['name'],
version=version,
version=verstr,
author=meta['author'],
author_email=meta['author_email'],
description=meta['description'],
Expand Down Expand Up @@ -115,7 +108,7 @@ def run(self):
'numba',
'ordered-set',
'psutil',
'pygeos',
'pyproj',
'pyugrid',
'rtree',
'scipy',
Expand Down