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
2 changes: 1 addition & 1 deletion opmrun/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pre-installed with Python.

**How to install and run:**
1. Install Python 3.11, ensure it is in your system's PATH.
2. Run "python setup.py build" and "python setup.py install" in the folder
2. Run "python -m pip install -e ." in the folder
"opmrun" of this repository.
3. Start opmrun by running "opmrun" in the "opmrun/opmrun" folder of this
repository.
Expand Down
57 changes: 30 additions & 27 deletions opmrun/opmrun/opmrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,10 @@
details.

Copyright (C) 2018-2021 Equinox International Petroleum Consultants Pte Ltd.
Copyright (C) 2022-2026 OPM-OP AS

Author : David Baxendale
david.baxendale@eipc.co
Author : David Baxendale et al
info@opm-op.com
Date : 30-July-2021
"""
# ----------------------------------------------------------------------------------------------------------------------
Expand All @@ -247,14 +248,15 @@
#
# Set OPMRUN Version Number
#
__version__ = '2021.04.1'
__version__ = '2025.04.1'

# ----------------------------------------------------------------------------------------------------------------------
# Import Modules and Start Up Section - All Modules Used by the OPMRUN Modules are Imported Upfront for Verification.
# ----------------------------------------------------------------------------------------------------------------------
#
# Check if tkinter Has Been Installed on the System
#
from opmrun.opm_common import run_command
try:
print('OPMRUN Startup: Importing Standard Module (tkinter)')
import tkinter as tk
Expand All @@ -279,11 +281,13 @@
import getpass, importlib, numpy, os
import pandas as pd
from pathlib import Path, PurePath, PurePosixPath, PureWindowsPath
import pkg_resources, platform, psutil
import platform, psutil
import subprocess, sys
from packaging.version import Version as parse_version
from importlib.metadata import version as get_version
print('OPMRUN Startup: Importing Standard Modules Complete')
except ImportError as error:
packages = ['getpass', 'importlib', 'numpy', 'os', 'pandas', 'pathlib', 'pkg_resources', 'platform', 'psutil',
packages = ['getpass', 'importlib', 'numpy', 'os', 'pandas', 'pathlib', 'platform', 'psutil',
'subprocess', 'sys']
print(' Importing Standard Modules Failed\n' +
' ' + str(error) + ': ' + str(type(error)) + '\n' +
Expand Down Expand Up @@ -319,14 +323,13 @@
starterr = True
# Import for Other Non-Standard Modules
for package in {'airspeed', 'pyDOE3', 'FreeSimpleGUI'}:
try:
dist = pkg_resources.get_distribution(package)
if package in sys.modules or (spec := importlib.util.find_spec(package)) is not None:
if package == 'FreeSimpleGUI':
sg = importlib.import_module(package)
else:
importlib.import_module(package)
print(' Require Module - ' + dist.key + '(' + dist.version + ') Imported')
except pkg_resources.DistributionNotFound:
print(' Require Module - ' + package + '(' + get_version(package) + ') Imported')
else:
print(' Import Require Package - ' + package + ' Failed')
starterr = True

Expand Down Expand Up @@ -379,13 +382,13 @@
# Check for Suitable Version of FreeSimpleGUI
#
try:
version = sg.__version__
_version = sg.__version__
except Exception:
text = ('FreeSimpleGUI Version Not Found and is therefore invalid, OPMRUN requires version 4.44.0 or higher.' +
'To upgrade use:\n\n"pip install --user --upgrade FreeSimpleGUI"\n\nProgram Will Exit')
sg.popup_error(text, title='FreeSimpleGUI Version Check', no_titlebar=False, grab_anywhere=False, keep_on_top=True)
raise SystemExit(text)
if pkg_resources.parse_version(sg.__version__) < pkg_resources.parse_version('4.44.0'):
if parse_version(sg.__version__) < parse_version('4.44.0'):
text = ('FreeSimpleGUI Version ' + str(sg.version) + ' is invalid, OPMRUN requires version 4.44 or higher.' +
'To upgrade use:\n\n"pip install --user --upgrade FreeSimpleGUI"\n\nProgram Will Exit')
sg.popup_error(text, title='FreeSimpleGUI Version Check', no_titlebar=False, grab_anywhere=False, keep_on_top=True)
Expand Down Expand Up @@ -438,7 +441,7 @@ def add_job(joblist, jobparam, jobsys):
sg.Text('Overwrite Parameter\nFile Options'),
sg.Listbox(values=['Ask', 'Keep', 'Overwrite'], size=(10, 3), key='_jobopt_', default_values=['Ask'])],
[sg.Submit(), sg.Exit()]]
window1 = sg.Window('Select OPM Flow Input File', layout=layout1)
window1 = sg.Window('Select OPM Flow Input File', layout=layout1, resizable=True)

while True:
(event, values) = window1.read()
Expand Down Expand Up @@ -558,7 +561,7 @@ def add_jobs_recursively(joblist, jobparam, jobsys):
[sg.Text('\nNote, if the parameter file does not exist for a given data file, then the current ' +
'default parameter set will be used\n')],
[sg.Submit(), sg.Exit()]]
window1 = sg.Window('Select OPM Flow Input File', layout=layout1)
window1 = sg.Window('Select OPM Flow Input File', layout=layout1, resizable=True)

while True:
(event, values) = window1.read()
Expand Down Expand Up @@ -695,7 +698,7 @@ def default_parameters(jobparam, opmsys1):
[sg.Radio('Load Parameters from OPM Flow Print File' , 'bRadio' )],
[sg.Text('Only cases added after the parameters are loaded will use the selected parameter set')],
[sg.Submit(), sg.Cancel()]]
window1 = sg.Window('Define OPM Flow Default Run Time Parameters', layout=layout1)
window1 = sg.Window('Define OPM Flow Default Run Time Parameters', layout=layout1, resizable=True)

while True:
(event, values) = window1.read()
Expand Down Expand Up @@ -877,7 +880,7 @@ def edit_job(job, jobsys, **jobhelp):
[sg.Radio('Edit Data File' , 'bRadio', default=True)],
[sg.Radio('Edit Parameter File', 'bRadio' )],
[sg.Submit(), sg.Cancel()]]
window1 = sg.Window('Edit Job Options', layout=layout1)
window1 = sg.Window('Edit Job Options', layout=layout1, resizable=True)
(event, values) = window1.read()
window1.Close()
#
Expand Down Expand Up @@ -1096,7 +1099,7 @@ def edit_options(opmsys1, opmoptn1):
layout1 = [[sg.Column(column1) ],
[sg.Submit(), sg.Cancel()]]

window1 = sg.Window('Edit Options', layout=layout1)
window1 = sg.Window('Edit Options', layout=layout1, resizable=True)

(event, values) = window1.read()
window1.Close()
Expand Down Expand Up @@ -1173,7 +1176,7 @@ def edit_parameters(fileparam, jobparam, **jobhelp):
[sg.Multiline('', size=(80, 4), key='_texthelp_',
font=(opmoptn['output-font'], opmoptn['output-font-size']))],
[sg.Button('Edit'), sg.Button('Save'), sg.Button('Cancel'), sg.Button('Exit')]]
window1 = sg.Window('Edit Parameters', layout=layout1)
window1 = sg.Window('Edit Parameters', layout=layout1, resizable=True)

while True:
(event, values) = window1.read()
Expand Down Expand Up @@ -1281,7 +1284,7 @@ def edit_projects(opmoptn1, opmsys1):
layout1 = [[sg.Column(column1) ],
[sg.Submit(), sg.Cancel()]]

window1 = sg.Window('Edit Projects', layout=layout1)
window1 = sg.Window('Edit Projects', layout=layout1, resizable=True)

(event, values) = window1.read()
window1.Close()
Expand Down Expand Up @@ -1692,24 +1695,23 @@ def opm_startup(opmvers, opmsys1, opmlog1):
opmsys1['pythondir' ] = Path(python)
opmsys1['pythonvers' ] = platform.python_version()
opmsys1['opmgui' ] = 'FreeSimpleGUI - ' + str(sg.version)
opmsys1['airspeed' ] = 'airspeed - ' + str(pkg_resources.get_distribution('airspeed').version)
opmsys1['airspeed' ] = 'airspeed - ' + get_version('airspeed')
opmsys1['datetime' ] = 'datetime - ' + opmsys1['pythonvers']
opmsys1['getpass' ] = 'getpass - ' + str(pd.__version__)
opmsys1['importlib' ] = 'importlib - ' + opmsys1['pythonvers']
opmsys1['os' ] = 'os - ' + opmsys1['pythonvers']
opmsys1['pandas' ] = 'pandas - ' + str(pd.__version__)
opmsys1['pathlib' ] = 'pathlib - ' + opmsys1['pythonvers']
opmsys1['pkg_resources'] = 'pkg_resources - ' + opmsys1['pythonvers']
opmsys1['platform' ] = 'platform - ' + opmsys1['pythonvers']
opmsys1['psutil' ] = 'psutil - ' + str(psutil.__version__)
opmsys1['pyDOE3' ] = 'pyDOE3 - ' + str(pkg_resources.get_distribution('pyDOE3').version)
opmsys1['pyDOE3' ] = 'pyDOE3 - ' + get_version('pyDOE3')
opmsys1['re' ] = 're - ' + opmsys1['pythonvers']
opmsys1['subprocess' ] = 'subprocess - ' + opmsys1['pythonvers']
opmsys1['sys' ] = 'sys - ' + opmsys1['pythonvers']
#
# Check for Windows 10 for Windows Based Operating Systems
#
if opmsys1['system'] == 'Windows' and opmsys1['release'] != '10':
if opmsys1['system'] == 'Windows' and not (opmsys1['release'] == '10' or opmsys1['release'] == '11'):
sg.popup_error('Windows ' + str(opmsys1['release']) + 'Detected\n' +
'OPMRUN Requires Windows 10 and WSL to Run OPM Flow on Windows Operating Systems\n' +
'Program Will Exit', no_titlebar=False, grab_anywhere=False, keep_on_top=True)
Expand Down Expand Up @@ -1867,7 +1869,7 @@ def reset_queue(joblist, jobparam, jobsys):
sg.Text('Overwrite Parameter\nFile Options'),
sg.Listbox(values=['Ask', 'Keep', 'Overwrite'], size=(10, 3), key='_jobopt_', default_values=['Keep'])],
[sg.Submit(), sg.Exit()]]
window1 = sg.Window('OPMRUN Reset Job Queue Parameters', layout=layout1)
window1 = sg.Window('OPMRUN Reset Job Queue Parameters', layout=layout1, resizable=True)

while True:
(event, values) = window1.read()
Expand Down Expand Up @@ -2127,7 +2129,7 @@ def run_jobs(joblist, jobsys, outlog):
[sg.Radio('Background Processing' , 'bRadio2', key='_back_' )],
[sg.Text('' )],
[sg.Submit(), sg.Cancel()]]
window1 = sg.Window('Select Run Option', layout=layout1)
window1 = sg.Window('Select Run Option', layout=layout1, resizable=True)
(event, values) = window1.read()
window1.Close()

Expand Down Expand Up @@ -2908,9 +2910,10 @@ def main():
'OPMRUN Version: ' + str(opmsys['opmvers']) + '\n'
'OPMRUN GUI Module: ' + str(opmsys['opmgui']) + '\n'
'\n' +
'Copyright (C) 2018-2021 Equinox International Petroleum Consultants Pte Ltd. \n'
'Copyright (C) 2018-2021 Equinox International Petroleum Consultants Pte Ltd. \n'+
'Copyright (C) 2022-2026 OPM-OP AS \n'
'\n' +
'Author : David Baxendale (david.baxendale@eipc.co)')
'Author : David Baxendale at al (info@opm-op.com)')

helptext = (
'OPMRun is a Graphical User Interface ("GUI") program for the Open Porous Media ("OPM") Flow ' +
Expand Down Expand Up @@ -3003,7 +3006,7 @@ def main():
key='_status_bar_', relief='flat', justification='left', visible=True)]]

window0 = sg.Window('OPMRUN - Flow Job Scheduler ',
layout=mainwind, disable_close=False, finalize=True, location=(300, 100))
layout=mainwind, disable_close=False, finalize=True, location=(300, 100), resizable=True)
#
# Set Output Multiline Window for CPRINT
#
Expand Down
50 changes: 50 additions & 0 deletions opmrun/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[project]
name = "opmrun"
version = "2026.03.0"
authors = [{name="David Baxendale et al", email="info@opm-op.com"}]
maintainers = [{name="OPM-OP AS", email="info@opm-op.com" }]
description="OPMRUN a GUI for OPM Flow"
requires-python = ">= 3.8"
#dynamic = ["long_description"]
readme = "DESCRIPTION.md"
license = "GPL-3.0-only"
#license.files = ["LICENSE.txt"]
keywords = ["OPM", "OPM flow", "reservoir", "simulation", "blackoil", "CCS"]
classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Private :: Do Not Upload",
"Operating System :: OS Independent",
]
dependencies = [
"airspeed~=0.5.16",
"datetime>=3.7.0",
"notify-py>=0.3.3",
"numpy>=1.19.1",
"pandas>=1.1.5",
"psutil>=5.5.1",
"pyDOE3>=1.0.0",
"FreeSimpleGUI>=4.44.0",
"packaging",
]
[project.urls]
Repository = "https://github.com/OPM/opm-utilities/tree/master/opmrun"
Issues = "https://github.com/OPM/opm-utilities/issues"

[project.gui-scripts]
opmrun = "opmrun.opmrun:main"

[build-system]
requires = [
"setuptools >= 77.0.3",
]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["."]

[tool.setuptools.package-data]
"opmrun" = ["*.png", "*.ico"]
2 changes: 2 additions & 0 deletions opmrun/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ psutil>=5.5.1
pyDOE3>=1.0.0
FreeSimpleGUI>=4.44.0
numpy>=1.19.1
packaging
setuptools
45 changes: 1 addition & 44 deletions opmrun/setup.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
import setuptools
from opmrun import __version__

with open("DESCRIPTION.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

setuptools.setup(
#
# Project Information
#
name='opmrun',
version=__version__,
author='David Baxendale',
author_email='david.baxendale@eipc.co',
maintainer='David Baxendale',
maintainer_email='david.baxendale@eipc.co',
description='OPMRUN a GUI for OPM Flow',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/OPM/opm-utilities/tree/master/opmrun',
license='GNU General Public License Version 3, 29 June 2007',
license_files='LICENSE.txt',
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License, version 3 or later (GPLv3+)",
"Operating System :: OS Independent",
],
#
# Package Data and Requirements
#
python_requires='>=3.6',
install_requires=['airspeed', 'numpy', 'pandas', 'psutil', 'pyDOE3', 'FreeSimpleGUI'],
entry_points={
'gui_scripts': [
'opmrun=opmrun.opmrun:main'
],
},
packages=setuptools.find_packages(),
package_data={
# Specify non-Python files to include in the package
'opmrun': [
'*.png', # Include all PNG files
'*.ico', # Include all ICO files
],
},
)
setuptools.setup()