diff --git a/.gitignore b/.gitignore index 3132557fe7f9a133d20301f968e37e415800acd0..af1c39c221a0d2ccd631f2eaf86a9cc98be36fb9 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,17 @@ ENV/ env.bak/ venv.bak/ .vscode +.cso2 + +config/Copernicus/cso-user-settings.rc + + +.vscode +cso.egg* +src/cso.egg* + +# doc +doc/ + +#packaging +build/ \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1e75fd8db3f36dfeb41a3c770e38dbe7e5351ddf --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.5.5 + hooks: + - id: ruff-format + - id: ruff # linter \ No newline at end of file diff --git a/README.md b/README.md index 1be27c35bc7050fe215dedc4cc242856aaf8dd9b..ea670b2e347e21732745f2c6366060dfab221cf6 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,32 @@ Then use the following command to clone the repository: git clone git@ci.tno.nl:cams/cso.git +Installation from source +------------------------ + +CSO can be installed from source in either conda or virtual environments. + +**Pip** + +The file py_project.toml contains the dependencies needed by CSO. + + python3 -m venv --prompt cso .venv + +This will create a new Python evironment folder called `cso`. To activate it run + + source .venv/bin/activate + +You may need to updated pip with the command + + pip install -U pip + +We can then install CSO and its dependencies simply using pip + + pip install -e . + +The `-e` flag installs CSO in editable mode, meaning that the user can change the source code and run CSO anywhere using these changes. + + Tutorial -------- diff --git a/config/Copernicus/cso-user-settings.rc b/config/Copernicus/cso-user-settings.rc index b07f313fa919320b5b8474c1c36481d3edc5fb1d..ccf052a66aef666e8d261690225c8ec78e8fafb8 100644 --- a/config/Copernicus/cso-user-settings.rc +++ b/config/Copernicus/cso-user-settings.rc @@ -93,19 +93,19 @@ my.timerange.end : 2018-06-01 23:59 !---------------------------------------------------------- !.............................. -#if "${USER}" == "you" +#if "${USER}" == "lewisb" !.............................. ! Attributes written to output files. -my.attr.author : Your Name -my.attr.institution : CSO -my.attr.email : Your.Name@cso.org +my.attr.author : Lewis Blake +my.attr.institution : MET Norway +my.attr.email : lewisb@met.no ! base location for work directories: -my.work : /Scratch/${USER}/CSO-Copernicus +my.work : /lustre/storeB/project/fou/kl/sesam/work/users/${USER}/release-v24r2 ! storage for downloaded observations: -my.observations : /Scratch/${USER}/observations +my.observations : /lustre/storeB/project/fou/kl/sesam/archive/v24r2 !.............................. #elif "${USER}" == "arjos" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..0a2750d5486fd81c903a2285ce9978d73aa90dc8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,61 @@ +[build-system] +requires = [ + "setuptools >= 40.9.0", +] +build-backend = "setuptools.build_meta" + +[project] +name = "cso" +version = "0.1.dev0" +authors = [{name = "Arjo Segers"}] +description = "CAMS Satellite Operator (CSO) tool." +readme = "README.md" +classifiers = [ + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: MIT", + "Operating System :: OS Independent", + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "Intended Audience :: Education", + "Topic :: Scientific/Engineering :: Atmospheric Science", +] +requires-python = ">=3.10" + +dependencies = [ + "cartopy>=0.20", + "shapely", + "numpy", + "matplotlib", + "numba", + "pandas", + "tqdm", + "xarray", + "netcdf4", + "scipy >=1.1.0", + "requests", + "typer", +] + +[project.urls] +Home = "https://ci.tno.nl/gitlab/cams/cso" + +[project.optional-dependencies] +docs = [ + "pre-commit", + "sphinx>=4.2.0", + "sphinxcontrib-napoleon", + "sphinx_rtd_theme", + "sphinx-argparse", + "nbsphinx", +] + +[project.scripts] +cso = "cso.scripts.cli:main" + +[tool.black] +target-version = ['py310'] +extend_skip = ["doc"] +line-length = 99 \ No newline at end of file diff --git a/src/cso/__init__.py b/src/cso/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..90818bbcd90d007b6ffdfe28c00734bf510802d7 --- /dev/null +++ b/src/cso/__init__.py @@ -0,0 +1,19 @@ +from importlib import metadata + +__version__ = metadata.version(__package__) + +from .cso_file import * +from .cso_catalogue import * +from .cso_inquire import * + +# from .cso_scihub import * +from .cso_pal import * +from .cso_s5p import * +from .cso_superobs import * +from .cso_gridded import * +from .cso_colocate import * +from .cso_superobs import * +from .cso_regions import * +from .cso_constants import * +from .cso_mapping import * +from .cso_plot import * diff --git a/py/cso.py b/src/cso/cso.py similarity index 100% rename from py/cso.py rename to src/cso/cso.py diff --git a/py/cso_catalogue.py b/src/cso/cso_catalogue.py similarity index 99% rename from py/cso_catalogue.py rename to src/cso/cso_catalogue.py index 4498b56a177b63b53433f89a6a6f7315f68f2583..aafd8e50ed1f07d3acc562717510b4fc4ed5960d 100644 --- a/py/cso_catalogue.py +++ b/src/cso/cso_catalogue.py @@ -110,7 +110,7 @@ class CSO_CatalogueBase(utopya.UtopyaRc): import numpy # tools: - import cso_constants + from . import cso_constants # no target units defined? if (vunits is None) or (vunits == "None"): @@ -274,8 +274,8 @@ class CSO_Catalogue(CSO_CatalogueBase): import matplotlib.pyplot as plt # tools: - import cso_file - import cso_plot + from . import cso_file + from . import cso_plot # setup graphics back-end: matplotlib.use("Agg") @@ -656,8 +656,8 @@ class CSO_SimCatalogue(CSO_CatalogueBase): import matplotlib.pyplot as plt # tools: - import cso_file - import cso_plot + from . import cso_file + from . import cso_plot # setup graphics back-end: matplotlib.use("Agg") @@ -1004,8 +1004,8 @@ class CSO_GriddedCatalogue(CSO_CatalogueBase): import matplotlib.pyplot as plt # tools: - import cso_file - import cso_plot + from . import cso_file + from . import cso_plot # setup graphics back-end: matplotlib.use("Agg") diff --git a/py/cso_colocate.py b/src/cso/cso_colocate.py similarity index 99% rename from py/cso_colocate.py rename to src/cso/cso_colocate.py index 1e8096155febd8e20b4b83893d6ac8039f032959..129fe8eb5522e37ad4684314496f6317701ab667 100644 --- a/py/cso_colocate.py +++ b/src/cso/cso_colocate.py @@ -56,7 +56,7 @@ import logging # tools: import utopya -import cso_catalogue +from . import cso_catalogue ######################################################################## @@ -191,8 +191,8 @@ class CSO_CoLocate(utopya.UtopyaRc): import xarray # tools: - import cso_file - import cso_mapping + from . import cso_file + from . import cso_mapping # init base object: utopya.UtopyaRc.__init__(self, rcfile, rcbase=rcbase, env=env) diff --git a/py/cso_constants.py b/src/cso/cso_constants.py similarity index 100% rename from py/cso_constants.py rename to src/cso/cso_constants.py diff --git a/py/cso_dataspace.py b/src/cso/cso_dataspace.py similarity index 99% rename from py/cso_dataspace.py rename to src/cso/cso_dataspace.py index 6a87347f94135434e9d7b1f6cdcd02aabcad39b8..fe98e090bd11777f5ea0a6725cc7d790abe1b9da 100644 --- a/py/cso_dataspace.py +++ b/src/cso/cso_dataspace.py @@ -718,7 +718,7 @@ class CSO_DataSpace_Downloader(object): import shutil # tools: - import cso_file + from . import cso_file # no token yet? if self.access_token is None: diff --git a/py/cso_file.py b/src/cso/cso_file.py similarity index 100% rename from py/cso_file.py rename to src/cso/cso_file.py diff --git a/py/cso_gridded.py b/src/cso/cso_gridded.py similarity index 99% rename from py/cso_gridded.py rename to src/cso/cso_gridded.py index b5f01829d6dfb3c9e116cf250cfbd38d58f7488f..ca7b4c9ed9d6b1c7fd345471eb5389fe4c956662 100644 --- a/py/cso_gridded.py +++ b/src/cso/cso_gridded.py @@ -267,8 +267,8 @@ class CSO_GriddedAverage(utopya.UtopyaRc): import pandas # tools: - import cso_file - import cso_mapping + from . import cso_file + from . import cso_mapping # init base object: utopya.UtopyaRc.__init__(self, rcfile, rcbase=rcbase, env=env) @@ -1210,7 +1210,7 @@ class CSO_GriddedAverageMeans(utopya.UtopyaRc): import pandas # tools: - import cso_file + from . import cso_file # init base object: utopya.UtopyaRc.__init__(self, rcfile, rcbase=rcbase, env=env) diff --git a/py/cso_inquire.py b/src/cso/cso_inquire.py similarity index 100% rename from py/cso_inquire.py rename to src/cso/cso_inquire.py diff --git a/py/cso_mapping.py b/src/cso/cso_mapping.py similarity index 100% rename from py/cso_mapping.py rename to src/cso/cso_mapping.py diff --git a/py/cso_pal.py b/src/cso/cso_pal.py similarity index 99% rename from py/cso_pal.py rename to src/cso/cso_pal.py index af0777c46c831dbc126b971286a75e5a21cbcba3..a0d064464566744bab37b2886f1041d943aa94d6 100644 --- a/py/cso_pal.py +++ b/src/cso/cso_pal.py @@ -363,7 +363,7 @@ class CSO_PAL_Downloader(object): import requests # tools: - import cso_file + from . import cso_file # retry loop .. ntry = 1 diff --git a/py/cso_plot.py b/src/cso/cso_plot.py similarity index 100% rename from py/cso_plot.py rename to src/cso/cso_plot.py diff --git a/py/cso_regions.py b/src/cso/cso_regions.py similarity index 99% rename from py/cso_regions.py rename to src/cso/cso_regions.py index d8db155a364f81a187cca6bfd8bee55c2a336e3e..142462064fe607d6f4fe2f5a85979c1902df5251 100644 --- a/py/cso_regions.py +++ b/src/cso/cso_regions.py @@ -74,7 +74,7 @@ import logging # tools: import utopya -import cso_catalogue +from . import cso_catalogue ######################################################################## @@ -1703,9 +1703,9 @@ class CSO_Catalogue_RegionsMaps(cso_catalogue.CSO_CatalogueBase): import matplotlib.pyplot as plt # tools: - import cso_file - import cso_plot - import cso_regions + from . import cso_file + from . import cso_plot + from . import cso_regions # setup graphics back-end: matplotlib.use("Agg") @@ -2063,9 +2063,9 @@ class CSO_Catalogue_RegionsTimeSeries(cso_catalogue.CSO_CatalogueBase): import xarray # tools: - import cso_file - import cso_plot - import cso_regions + from . import cso_file + from . import cso_plot + from . import cso_regions # setup graphics back-end: matplotlib.use("Agg") diff --git a/py/cso_s5p.py b/src/cso/cso_s5p.py similarity index 99% rename from py/cso_s5p.py rename to src/cso/cso_s5p.py index 9d678e751f1714b8f51112f30e38456737609da6..5e0f17b32bf9525aa0c511c754a2e2522a004edf 100644 --- a/py/cso_s5p.py +++ b/src/cso/cso_s5p.py @@ -110,7 +110,7 @@ import logging # tools: import utopya -import cso_file +from . import cso_file ######################################################################## @@ -2670,10 +2670,10 @@ class CSO_S5p_Convert(utopya.UtopyaRc): import pandas # tools: - import cso_file - import cso_dataspace - import cso_pal - import utopya + from . import cso_file + from . import cso_dataspace + from . import cso_pal + from . import utopya # info ... logging.info(f"{indent}") @@ -3240,8 +3240,8 @@ class CSO_S5p_Download(utopya.UtopyaRc): import pandas # tools: - import cso_dataspace - import cso_pal + from . import cso_dataspace + from . import cso_pal # info ... logging.info(f"{indent}") @@ -3563,7 +3563,7 @@ class CSO_S5p_Listing(utopya.UtopyaRc): import glob # tools: - import cso_file + from . import cso_file # info ... logging.info(f"{indent}") @@ -3787,7 +3787,7 @@ class CSO_S5p_Download_Listing(utopya.UtopyaRc): import collections # tools: - import cso_file + from . import cso_file # info ... logging.info(f"{indent}") diff --git a/py/cso_superobs.py b/src/cso/cso_superobs.py similarity index 99% rename from py/cso_superobs.py rename to src/cso/cso_superobs.py index a465ef698f8f64d248d0b93658e996c0d3f48462..9394b3eb02e1d4c9f9ccf788fa9f82ee1fdab17e 100644 --- a/py/cso_superobs.py +++ b/src/cso/cso_superobs.py @@ -187,8 +187,8 @@ class CSO_SuperObs(utopya.UtopyaRc): import pandas # tools: - import cso_file - import cso_mapping + from . import cso_file + from . import cso_mapping # init base object: utopya.UtopyaRc.__init__(self, rcfile, rcbase=rcbase, env=env) diff --git a/py/cso_tools.py b/src/cso/cso_tools.py similarity index 100% rename from py/cso_tools.py rename to src/cso/cso_tools.py diff --git a/src/cso/scripts/__init__.py b/src/cso/scripts/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/cso/scripts/cli.py b/src/cso/scripts/cli.py new file mode 100644 index 0000000000000000000000000000000000000000..9d0c58449aba1dfa6566b19f0762f28dd88f86ef --- /dev/null +++ b/src/cso/scripts/cli.py @@ -0,0 +1,128 @@ +import subprocess +from typing import Optional + +import typer +import sys +import os +import webbrowser + +from cso import __package__, __version__ + +# import utopya + +# prefix of CSO installation: +prefix = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), os.pardir)) +# extend path: +sys.path.insert(0, os.path.join(prefix, "src/cso")) +sys.path.insert(0, os.path.join(prefix, "src/utopya")) + +main = typer.Typer() + + +def version_callback(value: bool): + if not value: + return + typer.echo(f"🛰️ {__package__} {__version__}") + raise typer.Exit() + + +@main.callback() +def callback( + version: Optional[bool] = typer.Option(None, "--version", "-V", callback=version_callback), +): + """🛰️ CAMS Satellite Operator (CSO) Command Line Interface""" + + +@main.command() +def docs(): + """BETA: Build the documentation""" + docs_dir = "doc" # Define your docs directory + make_command = "make html" # command to generate docs + output_link = "docs/build/index.html" + try: + # Change to the docs directory + os.chdir(docs_dir) + typer.echo(f"Changed directory to {docs_dir}") + + # Run the make docs command + typer.echo("Running 'make html'...") + result = subprocess.run(make_command, shell=True, check=True) + + if result.returncode == 0: + typer.echo("'make html' command executed successfully.") + + # Construct the link to the documentation + docs_path = os.path.abspath(output_link) + typer.echo(f"Opening docs at: {docs_path}") + + # Open the generated docs in a browser + webbrowser.open(f"file://{docs_path}") + else: + typer.echo("Failed to generate the documentation.", err=True) + + except Exception as e: + typer.echo(f"Error: {e}", err=True) + + +@main.command() +def run(rc_file: str = typer.Argument(..., help="Provide .rc file")): + """Run cso based on settings provided in .rc file (e.g., cso run config/tutorial/tutorial.rc)""" + raise NotImplementedError + # # set environment: + # os.environ["CSO_PREFIX"] = prefix + # # dummy values to ensure that settings could be read first to setup logging: + # os.environ["CSO_RCFILE"] = "None" + # os.environ["CSO_RCDIR"] = "None" + + # # init script: + # utos = utopya.UtopyaRunScriptRc() + + # # setup standard command line arguments, and also enable rcfile arguments: + # utos.ArgumentsSetup(description="CAMS Satellite Operator", rcbase="cso") + + # # evaluate known arguments, store the other ; + # # might show help text and exit: + # args, xargs = utos.ArgumentsParse() + + # # store full path to settings: + # os.environ["CSO_RCFILE"] = os.path.abspath(args.rcfile) + # # location of settings file: + # os.environ["CSO_RCDIR"] = os.path.dirname(os.path.abspath(args.rcfile)) + + # # start, shout info: + # logging.info(f"") + # logging.info(f"** CSO - CAMS Satellite Operator **") + # logging.info(f"") + # logging.info(f"installation prefix : {prefix}") + # logging.info(f"input rcfile : {args.rcfile}") + # logging.info(f"settings base : {args.rcbase}") + # logging.info(f"") + # logging.info(f"environment:") + # for key in ["CSO_PREFIX", "CSO_RCFILE", "CSO_RCDIR"]: + # logging.info(f" {key} = {os.environ[key]}") + # # endfor + # logging.info(f"") + + # # info ... + # logging.info(f"start job tree ...") + # # import class as defined in settings by 'cso.class' key; + # # should be (derived from) 'utopya.JobStep' : + # jbs_cls = utos.ImportClass("class") + # # init job step object, use the 'rcbase' as name: + # jbs = jbs_cls(args.rcbase, args.rcfile) + # # start first: + # jbs.Start(single=args.single) + + # # info: + # logging.info(f"") + # logging.info(f"** end **") + # logging.info(f"") + + +# ------------------------------------------------- +# end +# ------------------------------------------------- + + +if __name__ == "__main__": + main() diff --git a/py/rc.py b/src/rc.py similarity index 100% rename from py/rc.py rename to src/rc.py diff --git a/src/utopya/__init__.py b/src/utopya/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..dced124d42d985cb503883e148c7ad63d90d8eb8 --- /dev/null +++ b/src/utopya/__init__.py @@ -0,0 +1,10 @@ +from .utopya_base import * +from .utopya_rc import * +from .utopya_jobscript import * +from .utopya_jobtree import * +from .utopya_runscript import * + +# from utopya_install import * +from .utopya_tools import * +from .utopya_index import * +from .utopya_post import * \ No newline at end of file diff --git a/py/utopya.py b/src/utopya/utopya.py similarity index 94% rename from py/utopya.py rename to src/utopya/utopya.py index 277ea0f28e114650f5a0449cdbee30ce4187083b..5fc65dc267e9bba4b4c0c31e3f714d65d024b176 100644 --- a/py/utopya.py +++ b/src/utopya/utopya.py @@ -152,15 +152,15 @@ and are defined according to the following hierchy: # imports from sub modules # ------------------------------------------------- -from utopya_base import * -from utopya_rc import * -from utopya_jobscript import * -from utopya_jobtree import * -from utopya_runscript import * -from utopya_tools import * -from utopya_build import * -from utopya_index import * -from utopya_post import * +from .utopya_base import * +from .utopya_rc import * +from .utopya_jobscript import * +from .utopya_jobtree import * +from .utopya_runscript import * +from .utopya_tools import * +from .utopya_build import * +from .utopya_index import * +from .utopya_post import * # ------------------------------------------------- diff --git a/py/utopya_base.py b/src/utopya/utopya_base.py similarity index 100% rename from py/utopya_base.py rename to src/utopya/utopya_base.py diff --git a/py/utopya_build.py b/src/utopya/utopya_build.py similarity index 99% rename from py/utopya_build.py rename to src/utopya/utopya_build.py index 69f7f081006ec9edbd59c6102b7e545f168e2507..8231fc95258074833e291b2f937b7189e578d37c 100644 --- a/py/utopya_build.py +++ b/src/utopya/utopya_build.py @@ -106,7 +106,7 @@ Classes import logging # tools: -import utopya_rc +from . import utopya_rc # ------------------------------------------------- @@ -303,7 +303,7 @@ class UtopyaCopy(utopya_rc.UtopyaRc): import os # tools: - import utopya_tools + from . import utopya_tools # init base object: utopya_rc.UtopyaRc.__init__(self, rcfile=rcfile, rcbase=rcbase, env=env) @@ -797,7 +797,7 @@ class UtopyaConfigure(utopya_rc.UtopyaRc): import glob # tools: - import utopya_tools + from . import utopya_tools # info ... logging.info("configure source code ...") @@ -1236,7 +1236,7 @@ class UtopyaConfigure(utopya_rc.UtopyaRc): """ # tools: - import utopya_tools + from . import utopya_tools # info... logging.info(" macro definitions ...") @@ -2496,7 +2496,7 @@ class UtopyaDependencies(utopya_rc.UtopyaRc): """ # tools: - import utopya_tools + from . import utopya_tools # external program: prog = "makedepf90" @@ -2689,7 +2689,7 @@ class UtopyaMake(utopya_rc.UtopyaRc): import os # tools: - import utopya_tools + from . import utopya_tools # init base object: utopya_rc.UtopyaRc.__init__(self, rcfile=rcfile, rcbase=rcbase, env=env) diff --git a/py/utopya_index.py b/src/utopya/utopya_index.py similarity index 99% rename from py/utopya_index.py rename to src/utopya/utopya_index.py index cb89cf2630a54590f4087cb9ed399e6006699bed..63aa491c695e4b059eda45e18d983a94534a8db7 100644 --- a/py/utopya_index.py +++ b/src/utopya/utopya_index.py @@ -267,7 +267,7 @@ Classes and methods import logging # tools: -import utopya +from . import utopya # ----------------------------------------------------------------------- @@ -925,7 +925,7 @@ class IndexPart(utopya.UtopyaRc): """ # tools: - import utopya_tools + from . import utopya_tools # read list from settings: line = self.GetSetting(key) diff --git a/py/utopya_jobscript.py b/src/utopya/utopya_jobscript.py similarity index 99% rename from py/utopya_jobscript.py rename to src/utopya/utopya_jobscript.py index dc932019bb95339a0a8ace7465f00e0933ab5cf7..d2afe2d2be1f12ad589cae41945ca1ec33b88e68 100644 --- a/py/utopya_jobscript.py +++ b/src/utopya/utopya_jobscript.py @@ -147,7 +147,7 @@ Classes import logging # tools: -import utopya_base +from . import utopya_base # ====================================================================== diff --git a/py/utopya_jobtree.py b/src/utopya/utopya_jobtree.py similarity index 99% rename from py/utopya_jobtree.py rename to src/utopya/utopya_jobtree.py index 7ae1ff2dd85b66a0df2fe1817b1a6d72311ee7f6..8c6dbb0ace35cc01674ec1d8935335b3b4cfb0ad 100644 --- a/py/utopya_jobtree.py +++ b/src/utopya/utopya_jobtree.py @@ -105,7 +105,7 @@ Classes import logging # tools: -import utopya_rc +from . import utopya_rc # ====================================================================== @@ -470,7 +470,7 @@ class UtopyaJobStep(utopya_rc.UtopyaRc): import datetime # tools: - import utopya_tools + from . import utopya_tools # defined ? if len(self.logfile) > 0: @@ -754,7 +754,7 @@ class UtopyaJobStep(utopya_rc.UtopyaRc): # add lines to import tools: self.Append("") self.Append("# tools:") - self.Append("import utopya") + self.Append("from . import utopya") self.Append("") # enddef AddModules @@ -3345,7 +3345,7 @@ class UtopyaJobTaskSubmit(UtopyaJobTask): import os # tools: - import utopya + from . import utopya # parent init: UtopyaJobTask.__init__(self, msg=msg) @@ -3526,7 +3526,7 @@ class UtopyaRcCommand(utopya_rc.UtopyaRc): """ # tools: - import utopya_tools + from . import utopya_tools # init base object: utopya_rc.UtopyaRc.__init__(self, rcfile=rcfile, rcbase=rcbase, env=env) @@ -3593,8 +3593,8 @@ class UtopyaJobTreeTiming(utopya_rc.UtopyaRc): import os # tools: - import utopya_tools - import utopya_timing + from . import utopya_tools + from . import utopya_timing # init base object: utopya_rc.UtopyaRc.__init__(self, rcfile=rcfile, rcbase=rcbase, env=env) diff --git a/py/utopya_post.py b/src/utopya/utopya_post.py similarity index 99% rename from py/utopya_post.py rename to src/utopya/utopya_post.py index 0be74905794b895761c5aa27ee742b65915e5a43..2c58c625e8d5c7dfe04cbc79cc19666bbf89aba3 100644 --- a/py/utopya_post.py +++ b/src/utopya/utopya_post.py @@ -52,7 +52,7 @@ Classes import logging # tools: -import utopya_base +from . import utopya_base ############################################################ diff --git a/py/utopya_rc.py b/src/utopya/utopya_rc.py similarity index 99% rename from py/utopya_rc.py rename to src/utopya/utopya_rc.py index 697c1ba651eb60cd5506f7bd0f05ea0bf70238cc..61c2eb028f216637c25afaeec40dc454767b2f56 100644 --- a/py/utopya_rc.py +++ b/src/utopya/utopya_rc.py @@ -44,7 +44,7 @@ Classes import logging # tools: -from utopya_base import UtopyaBase +from .utopya_base import UtopyaBase # ------------------------------------------------- @@ -298,7 +298,7 @@ class UtopyaRc(UtopyaBase): import sys # tools: - import utopya_tools + from . import utopya_tools # name of model module and class: moduleclass = self.GetSetting(name) diff --git a/py/utopya_runscript.py b/src/utopya/utopya_runscript.py similarity index 99% rename from py/utopya_runscript.py rename to src/utopya/utopya_runscript.py index 8612e7462ed92e28f28b98371ef4a4f4c7cd04f6..6b3eda568898098ee6e14bc3966ab8b2b0924674 100644 --- a/py/utopya_runscript.py +++ b/src/utopya/utopya_runscript.py @@ -53,8 +53,8 @@ Classes import logging # tools: -from utopya_base import UtopyaBase -from utopya_rc import UtopyaRc +from .utopya_base import UtopyaBase +from .utopya_rc import UtopyaRc # ------------------------------------------------- @@ -63,7 +63,6 @@ from utopya_rc import UtopyaRc class UtopyaRunScript(UtopyaBase): - """ Base class for script object, to be used in user defined scripts to quickly perform some common tasks: @@ -210,7 +209,6 @@ class UtopyaRunScript(UtopyaBase): class UtopyaRunScriptRc(UtopyaRc): - """ Base class for script object, to be used in user defined scripts that need a rcfile argument. diff --git a/py/utopya_tools.py b/src/utopya/utopya_tools.py similarity index 100% rename from py/utopya_tools.py rename to src/utopya/utopya_tools.py