diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bf75d7a7..2bd7b4ae 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,26 +4,15 @@ 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 -- Added a new commandline subcommand: ``validate-simulation`` -- Added an alias ``validate-circuit`` for the old ``validate`` subcommand - - - deprecated ``validate`` - +- Added a new commandline subcommands: ``validate-simulation``, ``validate-circuit`` 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/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 e77da4ad..669e8172 100644 --- a/bluepysnap/cli.py +++ b/bluepysnap/cli.py @@ -1,12 +1,11 @@ """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) @@ -43,27 +42,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): 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 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 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"),