This package provides Python libNeuroML, for working with neuronal models specified in NeuroML

NeuralEnsemble, updated 🕥 2023-03-21 10:52:29


GH Build Documentation Status PyPI PyPI - Python Version GitHub GitHub pull requests GitHub issues GitHub Org's stars Twitter Follow Gitter

This package provides Python libNeuroML, for working with neuronal models specified in NeuroML 2.

For more about libNeuroML see:

Michael Vella, Robert C. Cannon, Sharon Crook, Andrew P. Davison, Gautham Ganapathy, Hugh P. C. Robinson, R. Angus Silver and Padraig Gleeson, libNeuroML and PyLEMS: using Python to combine procedural and declarative modeling approaches in computational neuroscience Frontiers in Neuroinformatics 2014, doi: 10.3389/fninf.2014.00038


Documentation is available at

For installation instructions, see

For an overview of all NeuroML related libraries/documentation/publications see


A related package, pyNeuroML builds on this and provides functionality, scripts and modules for reading, writing, simulating and analysing NeuroML2/LEMS models.

pyNeuroML builds on: libNeuroML & PyLEMS and wraps functionality from jNeuroML.

Development process for libNeuroML

Most of the work happens in the development branch. That branch is kept up to date with the development branches for NeuroML 2 and related libraries. See for an overview of the various NeuroML libraries.


version 0.2.57 (dev)

  • Enable Python 3.10 support
  • Regenerate with generateDS using Python 3
  • Add generic add method to all NeuroML ComponentType classes that allows users to easily construct their NeuroML documents.
  • Improve unit tests
  • DEPRECATION notice: append_to_element will be deprecated in future releases, please use the add method instead

version 0.2.56

  • Documentation updates for RTD and other minor fixes.

version 0.2.55

  • Patch release with minor changes under the hood.
  • Use PyTest for testing.
  • Enable CI on GitHub Actions

version 0.2.54

  • Using Schema for NeuroML v2.1. Better compatibility with Python 3

version 0.2.50

  • Updated to use the final stable Schema for NeuroML v2.0

version 0.2.47

  • Updated to use the final stable Schema for NeuroML v2beta5

version 0.2.18

  • Updated to use the final stable Schema for NeuroML v2beta4
  • Tested with Python 3

version 0.2.4

  • Updated to use the Schema for NeuroML v2beta4

version 0.2.2

  • Updated to use the Schema for NeuroML v2beta3
  • Ensures numpy & pytables are only required when using non-XML loaders/writers

version 0.2.0

  • Updated to use the Schema for NeuroML v2beta2

version 0.1.9

  • Minor release: Update to latest schema

version 0.1.8

  • Several Bug fixes and small enhamcements
  • Support for latest NeuroML schema (see change outline)
  • JSON serialization
  • MongoDB backend
  • HDF5 serialization
  • Improved installation process
  • All usage examples are now run on the Travis-CI continuous integration server to confirm that that they do not error.
  • Schema validation utility
  • Improved documentation and documentation new look

:copyright: Copyright 2021 by the libNeuroML team, see AUTHORS. Modified BSD License, see LICENSE for details.

Build Status


Add graph representation for morphology, and some methods to fetch shortest lengths between segments

opened on 2023-03-02 18:50:36 by sanjayankur31 None

As a user, I want to globally toggle create time validation tests (while using `component_factory` and related methods)

opened on 2023-01-24 17:18:37 by sanjayankur31

A global method: neuroml.disable_create_time_validation or something perhaps? This will set a module level variable somewhere and the validate methods can check its state.

OR: would this just mean that folks will disable create time validation completely and defeat its whole purpose? :thinking:

feat( add level 2 validation for SegmentGroup

opened on 2022-12-02 12:49:01 by sanjayankur31

This also sets up a general framework for us to add more tests in libNeuroML.

cell util improvements

opened on 2022-11-14 17:13:45 by sanjayankur31
  • call setup_nml_cell for all related helper functions: when we're adding a conductance density, for example, if morphology does not exist, create it
  • add option to segment etc. addition functions to check membership
  • add option to setup_nml_cell to disable setting up of individual default groups

@pgleeson : anything else?

Add human readable text to validation errors produced by generateds

opened on 2022-10-20 11:49:24 by sanjayankur31

Is your feature request related to a problem? Please describe. Currently, validation (using generateds), gives errors, but these aren't human readable. For example:

- Value "100ms" does not match xsd pattern restrictions: [['^(-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(A|uA|nA|pA))$']]

What this is saying is that the user should check their value---the units or the quantity---but it's cryptic because it talks about "pattern restrictions".

Describe the solution you'd like Maybe we can "translate" these into human readable form. So, for example, if the error has "does not match xsd pattern restrictions", we can perhaps say "the value provided does not fit the specification---please check both the quantity and the units, and refer to the schema documentation for valid values"? If we can make the regular expression human readable here, that'll be good too, but I'm not sure how straightforward that is. There are libs like this, but randomly generated strings may not really help either.

We may be able to parse regexs and say "possible units: A/uA/.. maybe.

Describe alternatives you've considered NA

Additional context NA

NEURON compatible morphologies from ArrayMorphology.

opened on 2022-10-14 18:39:29 by christian-oreilly

Allows to do something like

fname = 'Morphologies/pyr/MouseLight_Final/CNG version/AA0995.CNG.swc' SWCLoader.load_swc_single(fname).to_neuroml_morphology("pyr_morph")

and use successfully this morphology in NEURON simulations. Tested with . If you like it you can merge it; if you'd prefer not to merge right away, you can wait. I'll continue to use this code with other morphologies for a project of mine so I'll push fixes if this does not work with other morphologies.

I attached the generated morphology, for reference. The biophys is rubbish (they are the same as for the tutorial on the OLM cell), but the morphology seems reasonable to me.


v0.4.1 2022-10-17 14:54:48

What's Changed

  • To v0.4.0 using NeuroML schema for v2.3 by @pgleeson in
  • Feat/sync schema neuroml 189 by @sanjayankur31 in
  • Feat/add info improvements by @pgleeson in
  • Feat/sync no neurolexid in basewithoutid by @sanjayankur31 in
  • Feat/add info improvements by @pgleeson in
  • Feat/add info improvements by @sanjayankur31 in
  • To v0.4.1 by @pgleeson in
  • Fix/handle classes without docstring by @sanjayankur31 in
  • Make info return list/dict if required, move common functions to generatedssupersuper by @sanjayankur31 in
  • Fix/info get all members by @sanjayankur31 in
  • Fix/137 mutable default args by @sanjayankur31 in
  • Feat: Add a validate() method to each component type class definition by @sanjayankur31 in
  • Feat: get information on possible parents by @sanjayankur31 in
  • Migrates the component_factory etc. utilities to libNeuroML by @sanjayankur31 in
  • Feat/migrate cell builder by @sanjayankur31 in
  • Add add_unbranched_segments to Cell by @sanjayankur31 in
  • Feat/doc tweaks by @sanjayankur31 in
  • Feat/improve nml constructors: adds type hints to constructors to help users by @sanjayankur31 in
  • Feat/add sectionise method by @sanjayankur31 in

Full Changelog:

v0.4.0 2022-06-22 11:29:50

What's Changed

  • Feat/remove unused deps by @sanjayankur31 in
  • BREAKING CHANGE: drop py2 support by @sanjayankur31 in

Full Changelog:

Release v0.3.1 2021-12-16 14:09:58

libNeuroML v0.3.1 for NeuroML 2.2 release

0.2.55 for NeuroML v2.1 2021-03-22 15:43:11

This is primarily a bugfix release to updates libNeuroML for NeuroML version 2.1.

As always, the simplest way to install libNeuroML is using pip:

pip install --upgrade libneuroml

More information on libNeuroML can be found in the documentation. More information on NeuroML can be found in the NeuroML docs.

0.2.50 for NeuroML v2.0 2020-04-08 18:17:06


NMLv2beta4 2016-07-11 15:44:51

Version for NeuroML v2 beta 4 release

neuroml python neuronal-models