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

Upgrade pre-commit. Closes #81 #86

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all 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: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-json
- id: end-of-file-fixer
- id: requirements-txt-fixer
- repo: https://github.com/psf/black
rev: 24.8.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.3
hooks:
- id: black
additional_dependencies: ["click==8.0.4"]
- id: ruff
args: [--fix]
- id: ruff-format
10 changes: 4 additions & 6 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ submodules:
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools: {python: "3.10"}
tools: { python: "3.10" }
apt_packages:
- mpich
- cmake
- libhdf5-mpi-dev
jobs:
post_create_environment:
- pip install poetry
- poetry config virtualenvs.create false
- pip install uv
post_install:
- pip install --upgrade pip
- pip install neuron
- poetry install --with docs
- uv sync --extra docs
- source .venv/bin/activate

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ install:

.PHONY: pre-commit-install
pre-commit-install:
poetry run pre-commit install
uv run pre-commit install

#* Formatters
.PHONY: codestyle
Expand All @@ -23,7 +23,7 @@ formatting: codestyle
#* Linting
.PHONY: test
test:
PYTHONPATH=$(PYTHONPATH) poetry run pytest -c pyproject.toml --cov-report=html --cov=src tests/
PYTHONPATH=$(PYTHONPATH) uv run pytest -c pyproject.toml --cov-report=html --cov=src tests/

.PHONY: check-codestyle
check-codestyle:
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ build-backend = "hatchling.build"

[tool.uv]
dev-dependencies = [
"pre-commit>=4.1.0",
"pytest>=8.3.2",
"ruff>=0.6.9",
"ruff==0.9.3",
]

[tool.uv.sources]
Expand Down
2 changes: 1 addition & 1 deletion src/miv_simulator/clamps/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def generate_weights(env, weight_source_rules, this_syn_attrs):
else:
raise RuntimeError(
"network_clamp.generate_weights: unknown weight generator rule class "
f'{weight_rule["class"]}'
f"{weight_rule['class']}"
)

return weights_dict
Expand Down
12 changes: 6 additions & 6 deletions src/miv_simulator/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@ def generate_synaptic_connections(
f"{ranstream_syn=}"
)
log_flag = False
assert (
projection is not None
), f"generate_synaptic_connections: {gid=}: {syn_id=} {syn_type=} {swc_type=} {syn_layer=} {projection=} {ranstream_syn=} {population_dict=} {projection_synapse_dict=}\n {synapse_dict['syn_types']=}"
assert projection is not None, (
f"generate_synaptic_connections: {gid=}: {syn_id=} {syn_type=} {swc_type=} {syn_layer=} {projection=} {ranstream_syn=} {population_dict=} {projection_synapse_dict=}\n {synapse_dict['syn_types']=}"
)
synapse_prj_counts[prj_pop_index[projection]] += 1
synapse_prj_partition[projection][syn_layer].append(syn_id)
it += 1
Expand Down Expand Up @@ -506,9 +506,9 @@ def generate_synaptic_connections(
logger.warning(
f"Rank {rank}: source gid list is empty for gid: {destination_gid} source: {projection}"
)
assert (
len(prj_source_vertices_array) > 0
), f"Rank {rank}: source gid list is empty. The cell density might be too small."
assert len(prj_source_vertices_array) > 0, (
f"Rank {rank}: source gid list is empty. The cell density might be too small."
)
count += len(prj_source_vertices_array)
gid_dict[destination_gid] = (
prj_source_vertices_array,
Expand Down
4 changes: 1 addition & 3 deletions src/miv_simulator/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ def ld_bal(env):
max_sum_cx = env.pc.allreduce(sum_cx, 2)
sum_cx = env.pc.allreduce(sum_cx, 1)
if rank == 0:
logger.info(
f"*** expected load balance {(((sum_cx / nhosts) / max_sum_cx)):.2f}"
)
logger.info(f"*** expected load balance {((sum_cx / nhosts) / max_sum_cx):.2f}")


def lpt_bal(env):
Expand Down
2 changes: 1 addition & 1 deletion src/miv_simulator/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2298,7 +2298,7 @@ def plot_intracellular_state(
)
else:
legend_labels.append(
f"{pop_name} {gid} " f"{cell_state_mat[2][i]}"
f"{pop_name} {gid} {cell_state_mat[2][i]}"
)

if lowpass_plot is not None and not distance:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def rho(x):
)
elif len(valid_idxs) != len(in_nodes):
logger.info(
f"Removing {len(in_nodes)-len(valid_idxs)} out of {len(in_nodes)} nodes due to constraint {constraint}"
f"Removing {len(in_nodes) - len(valid_idxs)} out of {len(in_nodes)} nodes due to constraint {constraint}"
)
in_nodes = in_nodes[valid_idxs]
node_count = len(in_nodes)
Expand Down
Loading
Loading