From eda94edca31a70ba5106bab071eac9c6de3d6aac Mon Sep 17 00:00:00 2001 From: "eduard.subert" Date: Tue, 30 Jan 2024 15:43:39 +0100 Subject: [PATCH 1/6] remove validate --- CHANGELOG.rst | 12 ++---------- bluepysnap/cli.py | 21 --------------------- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bf75d7a7..54244b06 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,14 +4,6 @@ Changelog Version v3.0.0 -------------- -Breaking Changes -~~~~~~~~~~~~~~~~ -- Edge populations' ``iter_connections`` returns ``CircuitNodeId`` instead of ``int`` - - -Version v2.1.0 --------------- - New Features ~~~~~~~~~~~~ - Added simulation config validation @@ -20,10 +12,10 @@ New Features - deprecated ``validate`` - Breaking Changes ~~~~~~~~~~~~~~~~ -- Deprecated the commandline subcommand ``validate`` in favor of new ``validate-circuit`` command +- Edge populations' ``iter_connections`` returns ``CircuitNodeId`` instead of ``int`` +- Removed the commandline subcommand ``validate`` in favor of new ``validate-circuit`` command Version v2.0.2 diff --git a/bluepysnap/cli.py b/bluepysnap/cli.py index e77da4ad..a63bc9dd 100644 --- a/bluepysnap/cli.py +++ b/bluepysnap/cli.py @@ -43,27 +43,6 @@ def wrapper(*args, **kwargs): return wrapper -@cli.command() -@circuit_validation_params -def validate(config_file, skip_slow, only_errors): - """[DEPRECATED] Validate Sonata circuit based on config file. - - Args: - config_file (str): path to Sonata circuit config file - skip_slow (bool): skip slow tests - only_errors (bool): only print fatal errors - """ - with warnings.catch_warnings(): - # Making sure the warning is shown - warnings.simplefilter("always", DeprecationWarning) - Deprecate.warn( - "Calling circuit validation with 'validate' is deprecated. " - "Please use 'validate-circuit' instead." - ) - - circuit_validation.validate(config_file, skip_slow, only_errors) - - @cli.command() @circuit_validation_params def validate_circuit(config_file, skip_slow, only_errors): From cf793253c7fa5e622c9ddf9280e76f6e7d8d8cd3 Mon Sep 17 00:00:00 2001 From: "eduard.subert" Date: Tue, 30 Jan 2024 16:00:43 +0100 Subject: [PATCH 2/6] test + lint --- bluepysnap/cli.py | 2 -- tests/test_cli.py | 31 +++++++++++-------------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/bluepysnap/cli.py b/bluepysnap/cli.py index a63bc9dd..be6d1307 100644 --- a/bluepysnap/cli.py +++ b/bluepysnap/cli.py @@ -1,12 +1,10 @@ """The project's command line launcher.""" import functools import logging -import warnings import click from bluepysnap import circuit_validation, simulation_validation -from bluepysnap.utils import Deprecate CLICK_EXISTING_FILE = click.Path(exists=True, file_okay=True, dir_okay=False) diff --git a/tests/test_cli.py b/tests/test_cli.py index dc939351..5e363262 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -14,36 +14,20 @@ @patch("bluepysnap.schemas.validate_nodes_schema", Mock(return_value=[])) @patch("bluepysnap.schemas.validate_edges_schema", Mock(return_value=[])) @patch("bluepysnap.schemas.validate_circuit_schema", Mock(return_value=[])) -def test_cli_correct(): +def test_cli_validate_circuit_correct(): runner = CliRunner() - - with pytest.warns( - BluepySnapDeprecationWarning, - match="Calling circuit validation with 'validate' is deprecated", - ): - result = runner.invoke(cli, ["validate", str(TEST_DATA_DIR / "circuit_config.json")]) - + result = runner.invoke(cli, ["validate-circuit", str(TEST_DATA_DIR / "circuit_config.json")]) assert result.exit_code == 0 assert click.style("No Error: Success.", fg="green") in result.stdout -def test_cli_no_config(): +def test_cli_validate_circuit_no_config(): runner = CliRunner() - result = runner.invoke(cli, ["validate"]) + result = runner.invoke(cli, ["validate-circuit"]) assert result.exit_code == 2 assert "Missing argument 'CONFIG_FILE'" in result.stdout -@patch("bluepysnap.schemas.validate_nodes_schema", Mock(return_value=[])) -@patch("bluepysnap.schemas.validate_edges_schema", Mock(return_value=[])) -@patch("bluepysnap.schemas.validate_circuit_schema", Mock(return_value=[])) -def test_cli_validate_circuit_correct(): - runner = CliRunner() - result = runner.invoke(cli, ["validate-circuit", str(TEST_DATA_DIR / "circuit_config.json")]) - assert result.exit_code == 0 - assert click.style("No Error: Success.", fg="green") in result.stdout - - def test_cli_validate_simulation_correct(): runner = CliRunner() result = runner.invoke( @@ -51,3 +35,10 @@ def test_cli_validate_simulation_correct(): ) assert result.exit_code == 0 assert click.style("No Error: Success.", fg="green") in result.stdout + + +def test_cli_validate_simulation_no_config(): + runner = CliRunner() + result = runner.invoke(cli, ["validate-simulation"]) + assert result.exit_code == 2 + assert "Missing argument 'CONFIG_FILE'" in result.stdout From b2ea9a37b315d64317f8c796524e82537946768a Mon Sep 17 00:00:00 2001 From: "eduard.subert" Date: Tue, 30 Jan 2024 16:18:08 +0100 Subject: [PATCH 3/6] schema error --- tests/test_schemas.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 0bbc393b..47e7c7bd 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -187,8 +187,8 @@ def test_validate_config_ok_missing_optional_fields(to_remove): [["networks", "edges", 0, "populations"]], "networks.edges[0]: 'populations' is a required property", ), - ([["networks", "nodes", 0]], "networks.nodes: [] is too short"), - ([["networks", "edges", 0]], "networks.edges: [] is too short"), + ([["networks", "nodes", 0]], "networks.nodes: [] should be non-empty"), + ([["networks", "edges", 0]], "networks.edges: [] should be non-empty"), ([["networks", "nodes"]], "networks: 'nodes' is a required property"), ([["networks", "edges"]], "networks: 'edges' is a required property"), ([["networks"]], "'networks' is a required property"), From e27347c3ffff5ee3e96f1c58369ba051e84d8a55 Mon Sep 17 00:00:00 2001 From: "eduard.subert" Date: Tue, 30 Jan 2024 17:20:50 +0100 Subject: [PATCH 4/6] black --- bluepysnap/circuit_validation.py | 1 + bluepysnap/cli.py | 1 + bluepysnap/query.py | 1 + bluepysnap/schemas/__init__.py | 1 + bluepysnap/schemas/schemas.py | 1 + bluepysnap/simulation_validation.py | 1 + tests/data/reporting/create_reports.py | 1 + 7 files changed, 7 insertions(+) diff --git a/bluepysnap/circuit_validation.py b/bluepysnap/circuit_validation.py index f7af2b07..0040e412 100644 --- a/bluepysnap/circuit_validation.py +++ b/bluepysnap/circuit_validation.py @@ -2,6 +2,7 @@ The idea here is to not depend on libsonata if possible, so we can use this in all situations """ + import logging from pathlib import Path diff --git a/bluepysnap/cli.py b/bluepysnap/cli.py index be6d1307..669e8172 100644 --- a/bluepysnap/cli.py +++ b/bluepysnap/cli.py @@ -1,4 +1,5 @@ """The project's command line launcher.""" + import functools import logging diff --git a/bluepysnap/query.py b/bluepysnap/query.py index 079b62c5..eed9a3c3 100644 --- a/bluepysnap/query.py +++ b/bluepysnap/query.py @@ -1,4 +1,5 @@ """Module to process search queries of nodes/edges.""" + import operator from collections.abc import Mapping from copy import deepcopy diff --git a/bluepysnap/schemas/__init__.py b/bluepysnap/schemas/__init__.py index 62cb5d4c..0df785bd 100644 --- a/bluepysnap/schemas/__init__.py +++ b/bluepysnap/schemas/__init__.py @@ -1,4 +1,5 @@ """Schemas and schema parser.""" + from bluepysnap.schemas.schemas import ( validate_circuit_schema, validate_edges_schema, diff --git a/bluepysnap/schemas/schemas.py b/bluepysnap/schemas/schemas.py index 222ee90b..1531b6aa 100644 --- a/bluepysnap/schemas/schemas.py +++ b/bluepysnap/schemas/schemas.py @@ -1,4 +1,5 @@ """Functions for schema based validation of circuit files.""" + from pathlib import Path import h5py diff --git a/bluepysnap/simulation_validation.py b/bluepysnap/simulation_validation.py index 6f8b217f..63a23aa8 100644 --- a/bluepysnap/simulation_validation.py +++ b/bluepysnap/simulation_validation.py @@ -1,4 +1,5 @@ """Standalone module that validates Sonata simulation. See ``validate-simulation`` function.""" + import contextlib import io import os diff --git a/tests/data/reporting/create_reports.py b/tests/data/reporting/create_reports.py index 401ec433..761da564 100644 --- a/tests/data/reporting/create_reports.py +++ b/tests/data/reporting/create_reports.py @@ -1,4 +1,5 @@ """Taken from the libsonata lib.""" + import h5py import numpy as np From ed884419d9e9d0016a778dd1dd4acee1c45f1dbc Mon Sep 17 00:00:00 2001 From: "eduard.subert" Date: Tue, 30 Jan 2024 18:41:27 +0100 Subject: [PATCH 5/6] changelog --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 54244b06..4af15663 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,7 +10,7 @@ New Features - Added a new commandline subcommand: ``validate-simulation`` - Added an alias ``validate-circuit`` for the old ``validate`` subcommand - - deprecated ``validate`` + - removed ``validate`` Breaking Changes ~~~~~~~~~~~~~~~~ From 63faf5411449ffb8ff53df3850e65943181f4200 Mon Sep 17 00:00:00 2001 From: "eduard.subert" Date: Wed, 31 Jan 2024 10:49:14 +0100 Subject: [PATCH 6/6] changelog tuning --- CHANGELOG.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4af15663..2bd7b4ae 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,10 +7,7 @@ Version v3.0.0 New Features ~~~~~~~~~~~~ - Added simulation config validation -- Added a new commandline subcommand: ``validate-simulation`` -- Added an alias ``validate-circuit`` for the old ``validate`` subcommand - - - removed ``validate`` +- Added a new commandline subcommands: ``validate-simulation``, ``validate-circuit`` Breaking Changes ~~~~~~~~~~~~~~~~