Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Use standard pre-commit config #77

Merged
merged 4 commits into from
Feb 21, 2023
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
22 changes: 7 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
types: [text]
types_or: [python, cython]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-docstring-first
- id: check-executables-have-shebangs
Expand All @@ -17,20 +11,18 @@ repos:
args: [--fix=lf]
- id: requirements-txt-fixer
- id: trailing-whitespace
# bump2version produces whitespace in setup.cfg, so exclude to
# not inferfere with versioning
exclude: setup.cfg
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.240
hooks:
- id: flake8
- id: ruff
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.990
rev: v0.991
hooks:
- id: mypy
additional_dependencies:
- types-setuptools
- types-requests
33 changes: 10 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,19 @@
requires = ['setuptools', 'wheel', 'cython']
build-backend = 'setuptools.build_meta'

[tool.cibuildwheel]
build = "cp38-* cp39-* cp310-*"

[tool.black]
target-version = ['py38', 'py39', 'py310']
skip-string-normalization = false
line-length = 79
exclude = '''
(
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| examples
)/
)
'''

[tool.isort]
profile = "black"
line_length = 79

[tool.ruff]
line-length = 79
exclude = ["__init__.py","build",".eggs"]
select = ["I", "E", "F"]
fix = true

[tool.cibuildwheel]
build = "cp38-* cp39-* cp310-*"
[tool.ruff.isort]
known-first-party = ["cellfinder_core"]
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ commit = True
tag = True
tag_name = {new_version}
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<rc>\d+))?
serialize =
serialize =
{major}.{minor}.{patch}-{release}{rc}
{major}.{minor}.{patch}

[options]
package_dir =
package_dir =
=src
packages = find:

Expand All @@ -19,7 +19,7 @@ where = src
[bumpversion:part:release]
optional_value = prod
first_value = rc
values =
values =
rc
prod

Expand Down
1 change: 0 additions & 1 deletion src/cellfinder_core/classify/augment.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def augment(augmentation_parameters, image, scale_back=True):


def rescale_to_isotropic(image, relative_pixel_sizes, interpolation_order):

if not all_elements_equal(relative_pixel_sizes):
min_pixel_size = min(relative_pixel_sizes)
normalised_pixel_sizes = []
Expand Down
2 changes: 0 additions & 2 deletions src/cellfinder_core/classify/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def residual_block(
bn_epsilon=1e-5,
axis=3,
):

"""
Residual unit from He et al. (2015)

Expand Down Expand Up @@ -314,7 +313,6 @@ def get_shortcut(
bn_epsilon=1e-5,
axis=3,
):

"""
Create shortcut. For none-bottleneck residual units, this is just the
identity. Otherwise, the input is reshaped to match the output of the
Expand Down
1 change: 0 additions & 1 deletion src/cellfinder_core/classify/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def get_model(


def make_lists(tiff_files, train=True):

signal_list = []
background_list = []
if train:
Expand Down
1 change: 0 additions & 1 deletion src/cellfinder_core/detect/filters/setup_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def setup(


def setup_tile_filtering(plane):

max_value = get_max_value(plane)
clipping_value = max_value - 2
thrsh_val = max_value - 1
Expand Down
1 change: 0 additions & 1 deletion src/cellfinder_core/train/train_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ def run(
save_progress=False,
epochs=100,
):

from cellfinder_core.main import suppress_tf_logging

suppress_tf_logging(tf_suppress_log_messages)
Expand Down
1 change: 0 additions & 1 deletion tests/tests/test_integration/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def background_array():
# FIXME: This isn't a very good example
@pytest.mark.slow
def test_detection_full(signal_array, background_array):

cells_test = main(
signal_array,
background_array,
Expand Down
8 changes: 4 additions & 4 deletions tests/tests/test_unit/test_tools/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_make_sphere():


def test_four_connected_kernel():
assert (
(np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]], dtype=np.bool))
== geometry.four_connected_kernel()
).all()
np.testing.assert_array_equal(
geometry.four_connected_kernel(),
np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]], dtype=bool),
)