diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6258ac4 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,24 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 + +[*.py] +indent_size = 4 + +[*.txt] +indent_style = tab +indent_size = 4 + +[*.{diff}] +trim_trailing_whitespace = false diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..e21e768 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,54 @@ +--- +name: Bug report +about: Create a report to help us improve +title: +labels: bug +assignees: + +--- + + + + + +Your bug may already be reported! +Please search on the [Issue tracker](https://github.com/NOAA-EMC/wxflow/issues) before creating one. + + +**Expected behavior** + + +**Current behavior** + + +**Machines affected** + + +**To Reproduce** + + + + + + +**Context** + + +**Detailed Description** + + +**Additional Information** + + +**Possible Implementation** + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..cbe40c0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,41 @@ +--- +name: Feature Request +about: Use this template for requesting new features +title: +labels: feature +assignees: + +--- + + + + + + +**Description** + + + + +**Requirements** + + +**Acceptance Criteria (Definition of Done)** + + +**(Optional): Suggest A Solution** + diff --git a/.github/ISSUE_TEMPLATE/general_issue.md b/.github/ISSUE_TEMPLATE/general_issue.md new file mode 100644 index 0000000..fe3fc72 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/general_issue.md @@ -0,0 +1,41 @@ +--- +name: General Issue +about: Use this template for general issues +title: +labels: +assignees: + +--- + + +If this is a bug, please consider using the [Bug Report](./bug_report.md) template. +Your issue may already have been created! +Please search on the [Issue tracker](https://github.com/NOAA-EMC/wxflow/issues) before creating one. + + + + +**Description** + + + + +**Requirements** + + + + +**Acceptance Criteria (Definition of Done)** + + +**Dependencies** + + + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..4afe44d --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,48 @@ + + + +**Description** + + + + + + + + +**Type of change** + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +**How Has This Been Tested?** + + + + + + + + +**Checklist** + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] My changes need updates to the documentation. I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] New and existing tests pass with my changes +- [ ] Any dependent changes have been merged and published diff --git a/.github/workflows/pynorms.yaml b/.github/workflows/pynorms.yaml new file mode 100644 index 0000000..c05075f --- /dev/null +++ b/.github/workflows/pynorms.yaml @@ -0,0 +1,22 @@ +name: pynorms +on: [push, pull_request] + +jobs: + check_norms: + runs-on: ubuntu-latest + name: Check Python coding norms with pycodestyle + + steps: + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install pycodestyle + + - name: Checkout + uses: actions/checkout@v3 + + - name: Run pycodestyle + run: | + cd $GITHUB_WORKSPACE + pycodestyle --verbose --config ./.pycodestyle ./ diff --git a/.github/workflows/pytests.yaml b/.github/workflows/pytests.yaml new file mode 100644 index 0000000..b2e8722 --- /dev/null +++ b/.github/workflows/pytests.yaml @@ -0,0 +1,33 @@ +name: pytests +on: [push, pull_request] + +jobs: + run_pytests: + runs-on: ubuntu-latest + name: Install wxflow and run tests with pytests + strategy: + matrix: + python: ["3.7", "3.8", "3.9", "3.10"] + + steps: + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Install (upgrade) python dependencies + run: | + pip install --upgrade pip + + - name: Checkout + uses: actions/checkout@v3 + + - name: Install wxflow + run: | + cd $GITHUB_WORKSPACE + pip install .[dev] + + - name: Run pytests + run: | + cd $GITHUB_WORKSPACE + pytest -v src/tests diff --git a/ush/python/pygw/.gitignore b/.gitignore similarity index 100% rename from ush/python/pygw/.gitignore rename to .gitignore diff --git a/.pycodestyle b/.pycodestyle new file mode 100644 index 0000000..f5a2f03 --- /dev/null +++ b/.pycodestyle @@ -0,0 +1,5 @@ +[pycodestyle] +count = False +max-line-length = 160 +statistics = True +exclude = .git,.github diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..0927556 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,157 @@ +### GNU LESSER GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the +terms and conditions of version 3 of the GNU General Public License, +supplemented by the additional permissions listed below. + +#### 0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the +GNU General Public License. + +"The Library" refers to a covered work governed by this License, other +than an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + +The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + +#### 1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + +#### 2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + +- a) under this License, provided that you make a good faith effort + to ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or +- b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + +#### 3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from a +header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + +- a) Give prominent notice with each copy of the object code that + the Library is used in it and that the Library and its use are + covered by this License. +- b) Accompany the object code with a copy of the GNU GPL and this + license document. + +#### 4. Combined Works. + +You may convey a Combined Work under terms of your choice that, taken +together, effectively do not restrict modification of the portions of +the Library contained in the Combined Work and reverse engineering for +debugging such modifications, if you also do each of the following: + +- a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. +- b) Accompany the Combined Work with a copy of the GNU GPL and this + license document. +- c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. +- d) Do one of the following: + - 0) Convey the Minimal Corresponding Source under the terms of + this License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + - 1) Use a suitable shared library mechanism for linking with + the Library. A suitable mechanism is one that (a) uses at run + time a copy of the Library already present on the user's + computer system, and (b) will operate properly with a modified + version of the Library that is interface-compatible with the + Linked Version. +- e) Provide Installation Information, but only if you would + otherwise be required to provide such information under section 6 + of the GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the Application + with a modified version of the Linked Version. (If you use option + 4d0, the Installation Information must accompany the Minimal + Corresponding Source and Corresponding Application Code. If you + use option 4d1, you must provide the Installation Information in + the manner specified by section 6 of the GNU GPL for conveying + Corresponding Source.) + +#### 5. Combined Libraries. + +You may place library facilities that are a work based on the Library +side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + +- a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities, conveyed under the terms of this License. +- b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + +#### 6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +as you received it specifies that a certain numbered version of the +GNU Lesser General Public License "or any later version" applies to +it, you have the option of following the terms and conditions either +of that published version or of any later version published by the +Free Software Foundation. If the Library as you received it does not +specify a version number of the GNU Lesser General Public License, you +may choose any version of the GNU Lesser General Public License ever +published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/README.md b/README.md new file mode 100644 index 0000000..bbc7f85 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +[![pynorms](https://github.com/NOAA-EMC/wxflow/actions/workflows/pynorms.yaml/badge.svg)](https://github.com/NOAA-EMC/wxflow/actions/workflows/pynorms.yaml) +[![pytests](https://github.com/NOAA-EMC/wxflow/actions/workflows/pytests.yaml/badge.svg)](https://github.com/NOAA-EMC/wxflow/actions/workflows/pytests.yaml) + +# Tools for Weather Workflows + +Common set of tools used in weather workflows + +## Installation +Simple installation instructions +```sh +$> git clone https://github.com/noaa-emc/wxflow +$> cd wxflow +$> pip install . +``` + +It is not required to install this package. Instead, +```sh +$> cd wxflow +$> export PYTHONPATH=${PWD}/src/wxflow +``` +would put this package in the `PYTHONPATH` + +### Note: +These instructions will be updated and the tools are under development. + +### Running python tests: +Simple instructions to enable executing pytests manually +```sh +# Create a python virtual environment and step into it +$> cd wxflow +$> python3 -m venv venv +$> source venv/bin/activate + +# Install `wxflow` with the developer requirements +(venv) $> pip install .[dev] +# NOTE: on a macOS, may need to specify ."[dev]" if using zsh + +# Run pytests +(venv) $> pytest -v +``` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3b46d9b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,49 @@ +[project] +name = "wxflow" +version = "0.1.0" +description = "Tools for Weather Workflows" +readme = "README.md" +requires-python = ">=3.6" +license = {file = "LICENSE.md"} +keywords = ["NWP", "Workflow"] +authors = [ + {name = "NOAA/NWS/NCEP/EMC", email = "First.Last@noaa.gov" } +] +maintainers = [ + {name = "NOAA/NWS/NCEP/EMC", email = "First.Last@noaa.gov" } +] + +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU Lesser General Public License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3 :: Only", +] + +dependencies = [ + "numpy>=1.21.6", + "PyYAML>=6.0", + "Jinja2>=3.1.2" +] + +[project.optional-dependencies] +dev = ["check-manifest", "pytest>=7", "pytest-cov[all]"] +test = ["pytest>=7", "pytest-cov[all]"] +lint = ["pycodestyle"] + +[project.urls] +"Homepage" = "https://github.com/NOAA-EMC/wxflow" +"Bug Reports" = "https://github.com/NOAA-EMC/wxflow/issues" +"Source" = "https://github.com/NOAA-EMC/wxflow/" + +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/ush/python/pygw/src/tests/__init__.py b/src/tests/__init__.py similarity index 100% rename from ush/python/pygw/src/tests/__init__.py rename to src/tests/__init__.py diff --git a/ush/python/pygw/src/tests/test-files/test_schema.yaml b/src/tests/test-files/test_schema.yaml similarity index 100% rename from ush/python/pygw/src/tests/test-files/test_schema.yaml rename to src/tests/test-files/test_schema.yaml diff --git a/ush/python/pygw/src/tests/test_configuration.py b/src/tests/test_configuration.py similarity index 98% rename from ush/python/pygw/src/tests/test_configuration.py rename to src/tests/test_configuration.py index e83c275..8f13251 100644 --- a/ush/python/pygw/src/tests/test_configuration.py +++ b/src/tests/test_configuration.py @@ -2,7 +2,7 @@ import pytest from datetime import datetime -from pygw.configuration import Configuration, cast_as_dtype +from wxflow.configuration import Configuration, cast_as_dtype file0 = """#!/bin/bash export SOME_ENVVAR1="${USER}" diff --git a/ush/python/pygw/src/tests/test_exceptions.py b/src/tests/test_exceptions.py similarity index 81% rename from ush/python/pygw/src/tests/test_exceptions.py rename to src/tests/test_exceptions.py index 79f3e4f..6352a5f 100644 --- a/ush/python/pygw/src/tests/test_exceptions.py +++ b/src/tests/test_exceptions.py @@ -1,6 +1,6 @@ import pytest -from pygw.exceptions import WorkflowException +from wxflow.exceptions import WorkflowException # ---- @@ -11,7 +11,7 @@ class TestError(WorkflowException): ----------- This is the base-class for exceptions encountered within the - pygw/errors unit-tests module; it is a sub-class of Error. + wxflow/errors unit-tests module; it is a sub-class of Error. """ diff --git a/ush/python/pygw/src/tests/test_executable.py b/src/tests/test_executable.py similarity index 95% rename from ush/python/pygw/src/tests/test_executable.py rename to src/tests/test_executable.py index 4c0e584..7fd3c08 100644 --- a/ush/python/pygw/src/tests/test_executable.py +++ b/src/tests/test_executable.py @@ -1,7 +1,7 @@ import os from pathlib import Path import pytest -from pygw.executable import Executable, which, CommandNotFoundError +from wxflow.executable import Executable, which, CommandNotFoundError script = """#!/bin/bash diff --git a/ush/python/pygw/src/tests/test_factory.py b/src/tests/test_factory.py similarity index 94% rename from ush/python/pygw/src/tests/test_factory.py rename to src/tests/test_factory.py index 2165eca..b533fe1 100644 --- a/ush/python/pygw/src/tests/test_factory.py +++ b/src/tests/test_factory.py @@ -1,4 +1,4 @@ -from pygw.factory import Factory +from wxflow.factory import Factory class Class1: @@ -14,10 +14,10 @@ def __init__(self): def test_factory(): _ = Factory('Test0') try: - from pygw.factory import Test0Factory + from wxflow.factory import Test0Factory # linter will likely throw an error here since 'Test0Factory' is not a valid module until runtime except ModuleNotFoundError: - raise AssertionError("'Test0Factory' was not found in the 'pygw.factory' module") + raise AssertionError("'Test0Factory' was not found in the 'wxflow.factory' module") def test_register(): diff --git a/ush/python/pygw/src/tests/test_file_utils.py b/src/tests/test_file_utils.py similarity index 97% rename from ush/python/pygw/src/tests/test_file_utils.py rename to src/tests/test_file_utils.py index 684c76b..f01b4c2 100644 --- a/ush/python/pygw/src/tests/test_file_utils.py +++ b/src/tests/test_file_utils.py @@ -1,5 +1,5 @@ import os -from pygw.file_utils import FileHandler +from wxflow.file_utils import FileHandler def test_mkdir(tmp_path): diff --git a/ush/python/pygw/src/tests/test_jinja.py b/src/tests/test_jinja.py similarity index 94% rename from ush/python/pygw/src/tests/test_jinja.py rename to src/tests/test_jinja.py index 1074951..b2c5bd0 100644 --- a/ush/python/pygw/src/tests/test_jinja.py +++ b/src/tests/test_jinja.py @@ -1,8 +1,8 @@ import pytest from datetime import datetime -from pygw.jinja import Jinja -from pygw.timetools import to_isotime +from wxflow.jinja import Jinja +from wxflow.timetools import to_isotime current_date = datetime.now() j2tmpl = """Hello {{ name }}! {{ greeting }} It is: {{ current_date | to_isotime }}""" diff --git a/ush/python/pygw/src/tests/test_logger.py b/src/tests/test_logger.py similarity index 96% rename from ush/python/pygw/src/tests/test_logger.py rename to src/tests/test_logger.py index a9b4504..86bbfe5 100644 --- a/ush/python/pygw/src/tests/test_logger.py +++ b/src/tests/test_logger.py @@ -1,5 +1,5 @@ -from pygw.logger import Logger -from pygw.logger import logit +from wxflow.logger import Logger +from wxflow.logger import logit level = 'debug' number_of_log_msgs = 5 diff --git a/ush/python/pygw/src/tests/test_schema.py b/src/tests/test_schema.py similarity index 88% rename from ush/python/pygw/src/tests/test_schema.py rename to src/tests/test_schema.py index 220b986..32612c7 100644 --- a/ush/python/pygw/src/tests/test_schema.py +++ b/src/tests/test_schema.py @@ -2,15 +2,15 @@ Description ----------- -Unit-tests for `pygw.schema`. +Unit-tests for `wxflow.schema`. """ import os import pytest -from pygw import schema -from pygw.yaml_file import parse_yaml -from pygw.schema import SchemaError -from pygw.configuration import cast_strdict_as_dtypedict +from wxflow import schema +from wxflow.yaml_file import parse_yaml +from wxflow.schema import SchemaError +from wxflow.configuration import cast_strdict_as_dtypedict # Define the path to the YAML-formatted file containing the schema @@ -24,7 +24,7 @@ def test_build_schema(): Description ----------- - This function tests the `pygw.schema.build_schema` function. + This function tests the `wxflow.schema.build_schema` function. """ diff --git a/ush/python/pygw/src/tests/test_template.py b/src/tests/test_template.py similarity index 98% rename from ush/python/pygw/src/tests/test_template.py rename to src/tests/test_template.py index f6d594b..c582c23 100644 --- a/ush/python/pygw/src/tests/test_template.py +++ b/src/tests/test_template.py @@ -1,5 +1,5 @@ import os -from pygw.template import TemplateConstants, Template +from wxflow.template import TemplateConstants, Template def test_substitute_string_from_dict(): diff --git a/ush/python/pygw/src/tests/test_timetools.py b/src/tests/test_timetools.py similarity index 98% rename from ush/python/pygw/src/tests/test_timetools.py rename to src/tests/test_timetools.py index f7e2cfd..185d7e4 100644 --- a/ush/python/pygw/src/tests/test_timetools.py +++ b/src/tests/test_timetools.py @@ -1,5 +1,5 @@ from datetime import datetime, timedelta -from pygw.timetools import * +from wxflow.timetools import * current_date = datetime.now() diff --git a/ush/python/pygw/src/tests/test_yaml_file.py b/src/tests/test_yaml_file.py similarity index 96% rename from ush/python/pygw/src/tests/test_yaml_file.py rename to src/tests/test_yaml_file.py index d01eb15..5d0a3fd 100644 --- a/ush/python/pygw/src/tests/test_yaml_file.py +++ b/src/tests/test_yaml_file.py @@ -1,7 +1,7 @@ import os import pytest from datetime import datetime -from pygw.yaml_file import YAMLFile, parse_yamltmpl, parse_j2yaml, save_as_yaml, dump_as_yaml +from wxflow.yaml_file import YAMLFile, parse_yamltmpl, parse_j2yaml, save_as_yaml, dump_as_yaml host_yaml = """ host: diff --git a/ush/python/pygw/src/pygw/__init__.py b/src/wxflow/__init__.py similarity index 72% rename from ush/python/pygw/src/pygw/__init__.py rename to src/wxflow/__init__.py index d441580..13f56fe 100644 --- a/ush/python/pygw/src/pygw/__init__.py +++ b/src/wxflow/__init__.py @@ -5,4 +5,4 @@ import os -pygw_directory = os.path.dirname(__file__) +wxflow_directory = os.path.dirname(__file__) diff --git a/ush/python/pygw/src/pygw/attrdict.py b/src/wxflow/attrdict.py similarity index 100% rename from ush/python/pygw/src/pygw/attrdict.py rename to src/wxflow/attrdict.py diff --git a/ush/python/pygw/src/pygw/configuration.py b/src/wxflow/configuration.py similarity index 98% rename from ush/python/pygw/src/pygw/configuration.py rename to src/wxflow/configuration.py index da39a21..9b460ab 100644 --- a/ush/python/pygw/src/pygw/configuration.py +++ b/src/wxflow/configuration.py @@ -6,8 +6,8 @@ from pprint import pprint from typing import Union, List, Dict, Any -from pygw.attrdict import AttrDict -from pygw.timetools import to_datetime +from .attrdict import AttrDict +from .timetools import to_datetime __all__ = ['Configuration', 'cast_as_dtype', 'cast_strdict_as_dtypedict'] diff --git a/ush/python/pygw/src/pygw/exceptions.py b/src/wxflow/exceptions.py similarity index 97% rename from ush/python/pygw/src/pygw/exceptions.py rename to src/wxflow/exceptions.py index a97cba6..74e4e29 100644 --- a/ush/python/pygw/src/pygw/exceptions.py +++ b/src/wxflow/exceptions.py @@ -4,7 +4,7 @@ from collections.abc import Callable -from pygw.logger import Logger, logit +from .logger import Logger, logit logger = Logger(level="error", colored_log=True) diff --git a/ush/python/pygw/src/pygw/executable.py b/src/wxflow/executable.py similarity index 99% rename from ush/python/pygw/src/pygw/executable.py rename to src/wxflow/executable.py index e9868b0..0e6e51e 100644 --- a/ush/python/pygw/src/pygw/executable.py +++ b/src/wxflow/executable.py @@ -14,7 +14,7 @@ class Executable: Example: -------- - >>> from pygw.executable import Executable + >>> from wxflow.executable import Executable >>> cmd = Executable('srun') # Lets say we need to run command e.g. "srun" >>> cmd.add_default_arg('my_exec.x') # Lets say we need to run the executable "my_exec.x" >>> cmd.add_default_arg('my_arg.yaml') # Lets say we need to pass an argument to this executable e.g. "my_arg.yaml" diff --git a/ush/python/pygw/src/pygw/factory.py b/src/wxflow/factory.py similarity index 98% rename from ush/python/pygw/src/pygw/factory.py rename to src/wxflow/factory.py index 58b9392..bde5246 100644 --- a/ush/python/pygw/src/pygw/factory.py +++ b/src/wxflow/factory.py @@ -25,7 +25,7 @@ def __init__(self, name: str): self._name = f'{name}Factory' self._builders = {} - # Register {name}Factory as importable from pygw.factory + # Register {name}Factory as importable from wxflow.factory me = sys.modules[__name__] if not hasattr(me, self._name): setattr(me, self._name, self) diff --git a/ush/python/pygw/src/pygw/file_utils.py b/src/wxflow/file_utils.py similarity index 100% rename from ush/python/pygw/src/pygw/file_utils.py rename to src/wxflow/file_utils.py diff --git a/ush/python/pygw/src/pygw/fsutils.py b/src/wxflow/fsutils.py similarity index 100% rename from ush/python/pygw/src/pygw/fsutils.py rename to src/wxflow/fsutils.py diff --git a/ush/python/pygw/src/pygw/jinja.py b/src/wxflow/jinja.py similarity index 100% rename from ush/python/pygw/src/pygw/jinja.py rename to src/wxflow/jinja.py diff --git a/ush/python/pygw/src/pygw/logger.py b/src/wxflow/logger.py similarity index 100% rename from ush/python/pygw/src/pygw/logger.py rename to src/wxflow/logger.py diff --git a/ush/python/pygw/src/pygw/schema.py b/src/wxflow/schema.py similarity index 100% rename from ush/python/pygw/src/pygw/schema.py rename to src/wxflow/schema.py diff --git a/ush/python/pygw/src/pygw/task.py b/src/wxflow/task.py similarity index 96% rename from ush/python/pygw/src/pygw/task.py rename to src/wxflow/task.py index 22ce462..ee8712b 100644 --- a/ush/python/pygw/src/pygw/task.py +++ b/src/wxflow/task.py @@ -1,8 +1,8 @@ import logging from typing import Dict -from pygw.attrdict import AttrDict -from pygw.timetools import add_to_datetime, to_timedelta +from .attrdict import AttrDict +from .timetools import add_to_datetime, to_timedelta logger = logging.getLogger(__name__.split('.')[-1]) diff --git a/ush/python/pygw/src/pygw/template.py b/src/wxflow/template.py similarity index 100% rename from ush/python/pygw/src/pygw/template.py rename to src/wxflow/template.py diff --git a/ush/python/pygw/src/pygw/timetools.py b/src/wxflow/timetools.py similarity index 100% rename from ush/python/pygw/src/pygw/timetools.py rename to src/wxflow/timetools.py diff --git a/ush/python/pygw/src/pygw/yaml_file.py b/src/wxflow/yaml_file.py similarity index 99% rename from ush/python/pygw/src/pygw/yaml_file.py rename to src/wxflow/yaml_file.py index 89cd1e2..521a3c0 100644 --- a/ush/python/pygw/src/pygw/yaml_file.py +++ b/src/wxflow/yaml_file.py @@ -195,7 +195,7 @@ def parse_yamltmpl(path: str, data: Dict = None) -> Dict[str, Any]: path : str the path to the yaml file data : Dict[str, Any], optional - the context for pygw.Template templating + the context for wxflow.Template templating Returns ------- Dict[str, Any] diff --git a/ush/python/pygw/README.md b/ush/python/pygw/README.md deleted file mode 100644 index 13db344..0000000 --- a/ush/python/pygw/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# global workflow specific tools - -Python tools specifically for global applications - -## Installation -Simple installation instructions -```sh -$> git clone https://github.com/noaa-emc/global-workflow -$> cd global-workflow/ush/python/pygw -$> pip install . -``` - -It is not required to install this package. Instead, -```sh -$> cd global-workflow/ush/python/pygw -$> export PYTHONPATH=$PWD/src/pygw -``` -would put this package in the `PYTHONPATH` - -### Note: -These instructions will be updated and the tools are under development. - -### Running python tests: -Simple instructions to enable executing pytests manually -```sh -# Create a python virtual environment and step into it -$> cd global-workflow/ush/python/pygw -$> python3 -m venv venv -$> source venv/bin/activate - -# Install pygw with the developer requirements -(venv) $> pip install .[dev] - -# Run pytests -(venv) $> pytest -v -``` diff --git a/ush/python/pygw/setup.cfg b/ush/python/pygw/setup.cfg deleted file mode 100644 index 1d45df0..0000000 --- a/ush/python/pygw/setup.cfg +++ /dev/null @@ -1,62 +0,0 @@ -[metadata] -name = pygw -version = 0.0.1 -description = Global applications specific workflow related tools -long_description = file: README.md -long_description_content_type = text/markdown -author = "NOAA/NWS/NCEP/EMC" -#author_email = first.last@domain.tld -keywords = NOAA, NWS, NCEP, EMC, GFS, GEFS -home_page = https://github.com/noaa-emc/global-workflow -license = GNU Lesser General Public License -classifiers = - Development Status :: 1 - Beta - Intended Audience :: Developers - Intended Audience :: Science/Research - License :: OSI Approved :: GNU Lesser General Public License - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Topic :: Software Development :: Libraries :: Python Modules - Operating System :: OS Independent - Typing :: Typed -project_urls = - Bug Tracker = https://github.com/noaa-emc/global-workflow/issues - CI = https://github.com/noaa-emc/global-workflow/actions - -[options] -zip_safe = False -include_package_data = True -package_dir = - =src -packages = find_namespace: -python_requires = >= 3.6 -setup_requires = - setuptools -install_requires = - numpy==1.21.6 - PyYAML==6.0 - Jinja2==3.1.2 -tests_require = - pytest - -[options.packages.find] -where=src - -[options.package_data] -* = *.txt, *.md - -[options.extras_require] -dev = pytest>=7; pytest-cov>=3 - -[green] -file-pattern = test_*.py -verbose = 2 -no-skip-report = true -quiet-stdout = true -run-coverage = true diff --git a/ush/python/pygw/setup.py b/ush/python/pygw/setup.py deleted file mode 100644 index e748ce0..0000000 --- a/ush/python/pygw/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -''' Standard file for building the package with Distutils. ''' - -import setuptools -setuptools.setup()