diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29b..00000000 diff --git a/.style.yapf b/.style.yapf deleted file mode 100644 index fdd07237..00000000 --- a/.style.yapf +++ /dev/null @@ -1,2 +0,0 @@ -[style] -based_on_style = yapf diff --git a/MANIFEST.in b/MANIFEST.in index 2e363a26..6a4e3692 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,10 +2,8 @@ graft s2fft graft tests graft docs -include README.rst -include pytest.ini +include README.md include LICENCE.txt -include s2fft/default-logging-config.yaml exclude .coveragerc exclude *.log diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..112c1632 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +coverage: + status: + project: + default: + target: auto + threshold: 0.1% diff --git a/docs/api/utility/index.rst b/docs/api/utility/index.rst index f5ca6065..ae76052c 100644 --- a/docs/api/utility/index.rst +++ b/docs/api/utility/index.rst @@ -141,5 +141,4 @@ Utility Functions healpix_ffts utils rotation - logs \ No newline at end of file diff --git a/docs/api/utility/logs.rst b/docs/api/utility/logs.rst deleted file mode 100644 index 1c56cf1b..00000000 --- a/docs/api/utility/logs.rst +++ /dev/null @@ -1,7 +0,0 @@ -:html_theme.sidebar_secondary.remove: - -************************** -logs -************************** -.. automodule:: s2fft.logs - :members: diff --git a/pyproject.toml b/pyproject.toml index fa0432bf..4af3e929 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,6 @@ classifiers = [ description = "Differentiable and accelerated spherical transforms with JAX" dependencies = [ "numpy>=1.20", - "colorlog", - "pyyaml", "jax>=0.3.13", "jaxlib", "torch", @@ -152,9 +150,6 @@ lint.pep8-naming.classmethod-decorators = [ [tool.setuptools] packages = ["s2fft"] -[tool.setuptools.package-data] -s2fft = ["default-logging-config.yaml"] - [tool.setuptools_scm] local_scheme = "no-local-version" write_to = "s2fft/_version.py" diff --git a/s2fft/__init__.py b/s2fft/__init__.py index c7606c7d..445f5719 100644 --- a/s2fft/__init__.py +++ b/s2fft/__init__.py @@ -2,7 +2,6 @@ import jax -from . import logs from .recursions.price_mcewen import ( generate_precomputes, generate_precomputes_jax, diff --git a/s2fft/default-logging-config.yaml b/s2fft/default-logging-config.yaml deleted file mode 100644 index 30a45ce4..00000000 --- a/s2fft/default-logging-config.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# ============================================================= -# Logging setup for S2fft Software package (2023) -# ============================================================= - -version: 1 -disable_existing_loggers: False -formatters: - simple: - format: "[%(asctime)s] [%(name)s] [%(levelname)s]: %(message)s" - colored: - (): "colorlog.ColoredFormatter" - datefmt: "%Y-%m-%d %H:%M:%S" - format: "%(log_color)s[%(asctime)s] [%(name)s] [%(levelname)s]: %(message)s%(reset)s" - log_colors: - DEBUG: blue - INFO: cyan - WARNING: purple - ERROR: orange - CRITICAL: red - -handlers: - console: - class: logging.StreamHandler - level: INFO - formatter: colored - stream: ext://sys.stdout - - info_file_handler: - class: logging.FileHandler - level: INFO - formatter: simple - filename: info.log - encoding: utf8 - - debug_file_handler: - class: logging.FileHandler - level: DEBUG - formatter: simple - filename: debug.log - encoding: utf8 - - critical_file_handler: - class: logging.FileHandler - level: CRITICAL - formatter: simple - filename: critical.log - encoding: utf8 - -loggers: - s2fft: - level: DEBUG - handlers: [console, critical_file_handler, info_file_handler, debug_file_handler] - propagate: no - -root: - level: INFO - handlers: [console, info_file_handler, debug_file_handler] -... \ No newline at end of file diff --git a/s2fft/logs.py b/s2fft/logs.py deleted file mode 100644 index a4124dfb..00000000 --- a/s2fft/logs.py +++ /dev/null @@ -1,91 +0,0 @@ -import logging -import logging.config -import os -from pathlib import Path - -import yaml - -import s2fft - - -def setup_logging(custom_yaml_path: str = None): - """ - Initialise and configure logging. - - Should be called at the beginning of code to initialise and configure the - desired logging level. Logging levels can be ints in [0,50] where 10 is - debug logging and 50 is critical logging. - - Args: - custom_yaml_path (string): Complete pathname of desired yaml logging - configuration. If empty will provide default logging config. - - Raises: - ValueError: Raised if logging.yaml is not in ./logs/ directory. - - """ - if "LOG_CFG" in os.environ: - path = Path(os.environ["LOG_CFG"]) - elif custom_yaml_path is None: - path = Path(s2fft.__file__).parent / "default-logging-config.yaml" - else: - path = Path(custom_yaml_path) - if not path.exists(): - raise ValueError(f"Logging config path {path} does not exist.") - with open(path) as f: - config = yaml.safe_load(f.read()) - if custom_yaml_path is None: - config["handlers"]["info_file_handler"]["filename"] = "info.log" - config["handlers"]["debug_file_handler"]["filename"] = "debug.log" - config["handlers"]["critical_file_handler"]["filename"] = "critical.log" - logging.config.dictConfig(config) - - -def debug_log(message: str): - """ - Log a debug message (e.g. for background logs to assist debugging). - - Args: - message (str): Message to log. - - """ - logger = logging.getLogger("s2fft") - logger.debug(message) - - -def warning_log(message: str): - """ - Log a warning (e.g. for internal code warnings such as large dynamic - ranges). - - Args: - message (str): Warning to log. - - """ - logger = logging.getLogger("s2fft") - logger.warning(message) - - -def critical_log(message: str): - """ - Log a critical message (e.g. core code failures etc). - - Args: - message (str): Message to log. - - """ - logger = logging.getLogger("s2fft") - logger.critical(message) - - -def info_log(message: str): - """ - Log an information message (e.g. evidence value printing, run completion - etc). - - Args: - message (str): Message to log. - - """ - logger = logging.getLogger("s2fft") - logger.info(message) diff --git a/tests/test_logs.py b/tests/test_logs.py deleted file mode 100644 index a44baec9..00000000 --- a/tests/test_logs.py +++ /dev/null @@ -1,19 +0,0 @@ -import pytest - -import s2fft.logs as lg - - -def test_incorrect_log_yaml_path(): - dir_name = "random/incorrect/filepath/" - - # Check cannot add samples with different ndim. - with pytest.raises(ValueError): - lg.setup_logging(custom_yaml_path=dir_name) - - -def test_general_logging(): - lg.setup_logging() - lg.critical_log("A random critical message") - lg.debug_log("A random debug message") - lg.warning_log("A random warning message") - lg.info_log("A random warning message")