Skip to content

Commit

Permalink
Merge pull request #242 from snek5000/remove-deprecated
Browse files Browse the repository at this point in the history
Remove deprecated functions and packages
  • Loading branch information
paugier committed Dec 13, 2022
2 parents d319417 + 18ffad5 commit 5461996
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 250 deletions.
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ Security in case of vulnerabilities.

(changelog/unreleased)=

<!-- ## [Unreleased] -->
## [Unreleased]

### Removed

- Functions deprecated in 0.8.0 (`source_root`, `get_asset`, `get_root`,
`get_configfile`, `_complete_params_from_par_file`).
- Subpackage `snek5000.assets`.

## [0.8.0] - 2022-12-06

Expand Down Expand Up @@ -344,8 +350,6 @@ lists are a very incomplete lists of the additions, changes and deprecations.
- Python packaging
- Sphinx + Doxygen + Breathe documentation

<!-- [unreleased]: https://github.com/snek5000/snek5000/compare/0.8.0...HEAD -->

[0.0.1]: https://github.com/snek5000/snek5000/releases/tag/0.0.1
[0.1.0]: https://github.com/snek5000/snek5000/compare/0.0.1...0.1.0
[0.1.1]: https://github.com/snek5000/snek5000/compare/0.1.0...0.1.1
Expand All @@ -363,3 +367,4 @@ lists are a very incomplete lists of the additions, changes and deprecations.
[0.7.0b0]: https://github.com/snek5000/snek5000/compare/0.6.1b0...0.7.0b0
[0.8.0]: https://github.com/snek5000/snek5000/compare/0.7.0b0...0.8.0
[@paugier]: https://github.com/paugier
[unreleased]: https://github.com/snek5000/snek5000/compare/0.8.0...HEAD
2 changes: 1 addition & 1 deletion docs/examples/snek5000-tgv/src/snek5000_tgv/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def create_default_params(cls):
# Read defaults for `params.nek` from `tgv.par.cfg` (original code)
info_solver = cls.info_solver # cls.InfoSolver()
output_cls = info_solver.import_classes()["Output"]
root = output_cls.get_root()
root = output_cls.get_path_solver_package()
complete_params_from_par_file(
params, root / f"{info_solver.short_name}.par.cfg"
)
Expand Down
36 changes: 0 additions & 36 deletions src/snek5000/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

from importlib import resources as _resources
import os
from warnings import warn
import weakref
from pathlib import Path

Expand Down Expand Up @@ -68,41 +67,6 @@ def get_nek_source_root():
return nek5000


def source_root():

warn(
(
"Function source_root will be removed on a later release. "
"Use get_nek_source_root instead."
),
DeprecationWarning,
)

return get_nek_source_root()


def get_asset(asset_name):
"""Fetches path of an asset from subpackage ``snek5000.assets``.
.. deprecated:: 0.8.0
Use :func:`get_snek_resource` instead
"""

warn(
(
"Function get_asset will be removed on a later release. "
"Use get_snek_resource instead. Also replace "
'`jinja2.PackageLoader("snek5000", "assets")` '
'by `jinja2.PackageLoader("snek5000", "resources")` '
"in the source of your snek5000 solver."
),
DeprecationWarning,
)

return get_snek_resource(asset_name)


def get_snek_resource(resource_name):
"""Fetches path of a file from subpackage ``snek5000.resources``.
Expand Down
63 changes: 0 additions & 63 deletions src/snek5000/assets/SIZE.j2

This file was deleted.

14 changes: 0 additions & 14 deletions src/snek5000/assets/__init__.py

This file was deleted.

22 changes: 0 additions & 22 deletions src/snek5000/assets/box.j2

This file was deleted.

25 changes: 0 additions & 25 deletions src/snek5000/assets/makefile_usr.inc.j2

This file was deleted.

29 changes: 0 additions & 29 deletions src/snek5000/output/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,35 +201,6 @@ def get_path_solver_package(cls):
"""Get the path towards the solver package."""
return Path(inspect.getmodule(cls).__file__).parent

@classmethod
def get_root(cls):

warnings.warn(
(
"Method get_root will be removed on a later release. "
"Use get_path_solver_package instead."
),
DeprecationWarning,
)

return cls.get_path_solver_package()

@classmethod
def get_configfile(cls):

warnings.warn(
(
"Method get_configfile will be removed on a later release. "
"You can replace in the Snakefile the line\n"
"configfile: Output.get_configfile()\n"
"by:\n"
f'configfile: "{cls._config_filename}"'
),
DeprecationWarning,
)

return Path(cls._config_filename).resolve()

@classmethod
def find_configfile(cls, host=None):
"""Get path of the Snakemake configuration file for the current machine.
Expand Down
19 changes: 0 additions & 19 deletions src/snek5000/output/print_stdout.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
import re
from pathlib import Path
from warnings import warn

import matplotlib.pyplot as plt
import pandas as pd
Expand All @@ -26,15 +25,6 @@ def __init__(self, output=None, path_file=None):
self.data = None
self._data_modif_time = None

@property
def file(self):
warn(
"The property `file` is deprecated. Use `path_file` instead.",
DeprecationWarning,
stacklevel=2,
)
return self.path_file

@property
def path_file(self):
output = self.output
Expand Down Expand Up @@ -137,15 +127,6 @@ def make_df(keys):
self._data_modif_time = path_file_time
return self.data

@property
def dt(self):
"""Extract time step dt over the course of a simulation."""
warn(
"The property `dt` is deprecated. Use `load()` instead.",
DeprecationWarning,
)
return self.data.dt

def __call__(self, *args):
"""Print to stdout and log file simultaneously."""
mpi.printby0(*args)
Expand Down
10 changes: 0 additions & 10 deletions src/snek5000/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os
import sys
import textwrap
import warnings
from ast import literal_eval
from configparser import ConfigParser
from io import StringIO
Expand Down Expand Up @@ -459,15 +458,6 @@ def _str_par_file(params):
return output.getvalue()


def _complete_params_from_par_file(params, path):
warnings.warn(
"complete_params_from_par_file has been deprecated and will be "
"removed in the next major release. Use complete_params_from_par_file",
DeprecationWarning,
)
return complete_params_from_par_file(params, path)


def complete_params_from_par_file(params, path):
"""Populate the ``params.nek`` object by reading a `.par` file and
:attr:`filename_map_user_params`.
Expand Down
12 changes: 4 additions & 8 deletions src/snek5000/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@

from fluiddyn import util

from .. import ( # noqa: kept for backwards compatlibility
get_nek_source_root,
source_root,
)
from .restart import ( # noqa: kept for backwards compatibility
get_status,
prepare_for_restart,
)
from .. import get_nek_source_root
from .restart import get_status

__all__ = ["get_nek_source_root", "get_status"]

repeat = partial(itertools.repeat, None)
repeat.__doc__ = """\
Expand Down
20 changes: 0 additions & 20 deletions src/snek5000/util/restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from enum import Enum
from pathlib import Path
from textwrap import dedent
from warnings import warn

from fluidsim_core.scripts.restart import RestarterABC

Expand Down Expand Up @@ -125,25 +124,6 @@ def get_status(path_dir, session_id=None, verbose=False):
return SimStatus.OK


def prepare_for_restart(path, chkp_fnumber=1, verify_contents=True):
"""Load only params for a restart. Use :func:`load_for_restart()` instead.
.. deprecated: 0.8.0b0
"""
warn(
(
"Function prepare_for_restart is deprecated."
"Kept for compatibility and would disappear in version 0.9.0b0"
),
DeprecationWarning,
)
params, _ = load_for_restart(
path, use_checkpoint=chkp_fnumber, verify_contents=verify_contents
)
return params


def load_for_restart(
path_dir=".",
use_start_from=None,
Expand Down

0 comments on commit 5461996

Please sign in to comment.