Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.0 release #253

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,10 +12,10 @@ New Features

- deprecated ``validate``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these lines should also be changed



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
Expand Down
1 change: 1 addition & 0 deletions bluepysnap/circuit_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 1 addition & 23 deletions bluepysnap/cli.py
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions bluepysnap/query.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to process search queries of nodes/edges."""

import operator
from collections.abc import Mapping
from copy import deepcopy
Expand Down
1 change: 1 addition & 0 deletions bluepysnap/schemas/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Schemas and schema parser."""

from bluepysnap.schemas.schemas import (
validate_circuit_schema,
validate_edges_schema,
Expand Down
1 change: 1 addition & 0 deletions bluepysnap/schemas/schemas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for schema based validation of circuit files."""

from pathlib import Path

import h5py
Expand Down
1 change: 1 addition & 0 deletions bluepysnap/simulation_validation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Standalone module that validates Sonata simulation. See ``validate-simulation`` function."""

import contextlib
import io
import os
Expand Down
1 change: 1 addition & 0 deletions tests/data/reporting/create_reports.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Taken from the libsonata lib."""

import h5py
import numpy as np

Expand Down
31 changes: 11 additions & 20 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,31 @@
@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(
cli, ["validate-simulation", str(TEST_DATA_DIR / "simulation_config.json")]
)
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
4 changes: 2 additions & 2 deletions tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
edasubert marked this conversation as resolved.
Show resolved Hide resolved
([["networks", "nodes"]], "networks: 'nodes' is a required property"),
([["networks", "edges"]], "networks: 'edges' is a required property"),
([["networks"]], "'networks' is a required property"),
Expand Down
Loading