diff --git a/.flake8 b/.flake8 index 151e324b..e96dcb7e 100644 --- a/.flake8 +++ b/.flake8 @@ -12,6 +12,8 @@ ignore = exclude = hypnotoad/gui/hypnotoad_mainWindow.py, hypnotoad/gui/hypnotoad_preferences.py, - hypnotoad/gui/__init__.py - hypnotoad/__version__.py - versioneer.py + hypnotoad/gui/__init__.py, + hypnotoad/__version__.py, + versioneer.py, + build, + .venv diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index fd7e0dc4..fc2163d8 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -18,23 +18,21 @@ jobs: if: always() strategy: matrix: - python-version: [3.8, 3.9, '3.10'] + python-version: ['3.10', '3.11', '3.12'] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install .[tests] - name: Test with pytest - run: | - pip install pytest - pytest + run: pytest integrated-tests: @@ -44,21 +42,21 @@ jobs: if: always() strategy: matrix: - python-version: [3.8, 3.9, '3.10'] + python-version: ['3.10', '3.11', '3.12'] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: lfs: true - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install .[tests] - name: Integrated tests run: | pip install pytest xarray @@ -75,13 +73,13 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: lfs: true - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: "3.x" - name: Install dependencies run: | python -m pip install --upgrade pip @@ -112,13 +110,13 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: lfs: true - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: "3.x" - name: Install dependencies run: | python -m pip install --upgrade pip @@ -153,15 +151,15 @@ jobs: if: always() steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: "3.x" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install . - name: Lint with flake8 run: | pip install flake8 @@ -175,11 +173,11 @@ jobs: if: always() steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: "3.x" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 1381f376..71f79e67 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -15,21 +15,20 @@ jobs: timeout-minutes: 30 strategy: matrix: - python-version: [3.8, 3.9, '3.10'] + python-version: ['3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install .[tests] - name: Test with pytest run: | - pip install pytest pytest @@ -39,15 +38,15 @@ jobs: timeout-minutes: 30 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: "3.x" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install . - name: Lint with flake8 run: | pip install flake8 @@ -60,11 +59,11 @@ jobs: timeout-minutes: 30 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: "3.x" - name: Install dependencies run: | python -m pip install --upgrade pip @@ -82,9 +81,9 @@ jobs: needs: [pytest, flake8, black] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies diff --git a/.gitignore b/.gitignore index d6ddb3c3..6fd24110 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,128 @@ -.*.sw* -*.nc -__pycache__ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# Other +.DS_Store +.idea/ +*.sw[po] diff --git a/doc/conf.py b/doc/conf.py index cc69f4f4..2be2e4e9 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -104,7 +104,7 @@ def create_options_rst(filename, title, options_factory, *, exclude=None): "OptionsFactory constructors in the hypnotoad source code. To change the " "formatting, edit the ``create_options_rst()`` function in ``conf.py``.\n\n" ) - f.write(f"{title}\n{'='*len(title)}\n\n") + f.write(f"{title}\n{'=' * len(title)}\n\n") tt = options_factory.get_help_table(as_Texttable=True) tt.set_cols_width([62, 80, 20]) f.write(".. table::\n :widths: 20 75 5\n\n") diff --git a/hypnotoad/core/equilibrium.py b/hypnotoad/core/equilibrium.py index d4b75f04..81716d6b 100644 --- a/hypnotoad/core/equilibrium.py +++ b/hypnotoad/core/equilibrium.py @@ -4476,12 +4476,12 @@ def getSmoothMonotonicGridFunc( """ if grad_lower is not None and (upper - lower) * grad_lower < 0: raise ValueError( - f"(upper-lower)={(upper-lower)} and grad_lower={grad_lower} have " + f"(upper-lower)={(upper - lower)} and grad_lower={grad_lower} have " f"different signs: should both be increasing or both be decreasing." ) if grad_upper is not None and (upper - lower) * grad_upper < 0: raise ValueError( - f"(upper-lower)={(upper-lower)} and grad_upper={grad_upper} have " + f"(upper-lower)={(upper - lower)} and grad_upper={grad_upper} have " f"different signs: should both be increasing or both be decreasing." ) diff --git a/pyproject.toml b/pyproject.toml index 374e5fbf..8da003e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,17 +24,17 @@ classifiers = [ "Operating System :: OS Independent", ] -requires-python = ">=3.8" +requires-python = ">=3.10" dependencies = [ "boututils~=0.1.7", "dill~=0.3,!=0.3.5,!=0.3.5.1", "func_timeout~=4.3", - "matplotlib~=3.2", + "matplotlib~=3.7", "netCDF4~=1.5", - "numpy~=1.18", + "numpy~=1.24", "optionsfactory~=1.0.11", "PyYAML>=5.1", - "scipy~=1.6", + "scipy~=1.10", "Qt.py~=1.2", ] @@ -50,6 +50,7 @@ docs = [ ] tests = [ "pytest >= 3.3.0", + "xarray >= 2022.9.0", ] [project.scripts]