Skip to content

Commit

Permalink
Merge branch 'dev' into axon_parent_validation_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewMallory committed Apr 29, 2024
2 parents 1942939 + 67e436a commit adfa09c
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[bumpversion]
current_version = 1.1.7
current_version = 1.2.1
commit = True
tag = True

[bumpversion:file:neuron_morphology/VERSION.txt]

53 changes: 53 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U twine setuptools wheel
- name: build release distributions
run: |
python setup.py sdist
python setup.py bdist_wheel
- name: upload windows dists
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
permissions:
id-token: write

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
84 changes: 84 additions & 0 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Python Package using Conda

on: [push]

jobs:
build-windows:
runs-on: windows-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
C:\Miniconda\condabin\conda.bat install tqdm openjpeg ruamel.yaml
python -m pip install --upgrade pip
pip install -r test_requirements.txt -U
pip install -r requirements.txt -U
pip install -e .
- name: Test with pytest
run: |
python -m pytest tests/
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
conda install tqdm openjpeg ruamel.yaml
python -m pip install --upgrade pip
pip install -r test_requirements.txt -U
pip install -r requirements.txt -U
pip install -e .
- name: Lint with flake8
run: |
# flake8 already installed via test_requirements.txt
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python -m pytest tests/
build-mac:
runs-on: macos-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
- name: Install dependencies
run: |
conda install tqdm openjpeg ruamel.yaml
brew install hdf5
export HDF5_DIR="$(brew --prefix hdf5)"
python -m pip install --upgrade pip
pip install -r test_requirements.txt -U --disable-pip-version-check
pip install -r requirements.txt -U --disable-pip-version-check
pip install -e . --disable-pip-version-check
- name: Test with pytest
run: |
python -m pytest tests/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Documentation Status](https://readthedocs.org/projects/neuron-morphology/badge/?version=latest)](https://neuron-morphology.readthedocs.io/en/latest/?badge=latest) [![Allen Institute](https://circleci.com/gh/AllenInstitute/neuron_morphology.svg?style=svg)](https://app.circleci.com/pipelines/github/AllenInstitute/neuron_morphology) [![Build status](https://ci.appveyor.com/api/projects/status/7fekclwnq58p61ax?svg=true)](https://ci.appveyor.com/project/fcollman/neuron-morphology)

[![Documentation Status](https://readthedocs.org/projects/neuron-morphology/badge/?version=latest)](https://neuron-morphology.readthedocs.io/en/latest/?badge=latest)
![build workflow](https://github.com/alleninstitute/neuron_morphology/actions/workflows/python-package-conda.yml/badge.svg)

neuron_morphology
=================
Expand Down
2 changes: 1 addition & 1 deletion neuron_morphology/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.1.7
1.2.1

2 changes: 1 addition & 1 deletion neuron_morphology/feature_extractor/mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class RequiresRelativeSomaDepth(Mark):

@classmethod
def validate(cls, data: Data) -> bool:
return data.morphology.has_type(RELATIVE_SOMA_DEPTH)
return data.morphology.has_type(SOMA)

class RequiresSoma(Mark):
"""Indicates that these features require a soma."""
Expand Down
2 changes: 1 addition & 1 deletion neuron_morphology/features/layer/layer_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def ensure_tuple(
raise ValueError("if_none must be a tuple or \"raise\"")

if inputs is None:
if if_none is "raise":
if if_none == "raise":
raise ValueError("inputs were None")
else:
return if_none # type: ignore[]
Expand Down
11 changes: 7 additions & 4 deletions neuron_morphology/transforms/streamline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import ufl
import numpy as np
import dolfinx.fem as fem
from dolfinx.fem.petsc import LinearProblem
from dolfinx.io import gmshio
from typing import List, Tuple
from mpi4py import MPI
Expand All @@ -14,7 +15,7 @@

def solve_laplace_2d(V: fem.FunctionSpace,
domain,
bcs: List[fem.bcs.DirichletBCMetaClass]):
bcs: List[fem.bcs.DirichletBC]):
"""
Solves the laplace equation with boundary conditions bcs on V
Expand All @@ -30,7 +31,7 @@ def solve_laplace_2d(V: fem.FunctionSpace,
a = ufl.dot(ufl.grad(u), ufl.grad(v)) * ufl.dx
L = f * v * ufl.dx

problem = fem.petsc.LinearProblem(a, L, bcs=bcs, petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
problem = LinearProblem(a, L, bcs=bcs, petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
uh = problem.solve()

return uh
Expand All @@ -47,7 +48,7 @@ def compute_gradient(uh, W, bcs=[]):
a = ufl.inner(u, v) * dx
L = ufl.inner(f, v) * dx

problem = fem.petsc.LinearProblem(a, L, bcs=bcs, petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
problem = LinearProblem(a, L, bcs=bcs, petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
grad_uh = problem.solve()

return grad_uh
Expand Down Expand Up @@ -98,6 +99,7 @@ def generate_laplace_field(top_line: List[Tuple],

# Create mesh with gmsh
gmsh.initialize()
gmsh.clear()

# Set up the points
point_tags = [gmsh.model.geo.addPoint(x, y, 0, meshSize=mesh_res)
Expand All @@ -123,7 +125,8 @@ def generate_laplace_field(top_line: List[Tuple],
# import mesh into dolfinx
gmsh_model_rank = 0
mesh_comm = MPI.COMM_WORLD
domain, cell_markers, facet_markers = gmshio.model_to_mesh(gmsh.model, mesh_comm, gmsh_model_rank, gdim=gdim)
domain, cell_markers, facet_markers = gmshio.model_to_mesh(
gmsh.model, mesh_comm, gmsh_model_rank, gdim=gdim)

# Create variational space
V = fem.FunctionSpace(domain, ("CG", 1))
Expand Down
4 changes: 2 additions & 2 deletions tests/pipeline/test_post_data_to_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import boto3
import zipfile
from moto import mock_s3
from moto import mock_aws
import unittest

from neuron_morphology.pipeline.post_data_to_s3 import post_object_to_s3, zip_files
Expand Down Expand Up @@ -35,7 +35,7 @@ def test_zip_files(self):

self.assertListEqual(self.mock_listing, file_list)

@mock_s3
@mock_aws
def test_post_data_to_s3(tmpdir_factory):

temp_output_dir = str(tmpdir_factory.mktemp("test"))
Expand Down

0 comments on commit adfa09c

Please sign in to comment.