diff --git a/pygenn/__init__.py b/pygenn/__init__.py index b070eb8834..fb15bba3e3 100644 --- a/pygenn/__init__.py +++ b/pygenn/__init__.py @@ -1,3 +1,13 @@ -# Import pygenn interface +# python imports +import sys + +# pygenn interface from .genn_groups import SynapseGroup, NeuronGroup, CurrentSource, CustomUpdate from .genn_model import GeNNModel + +if sys.version_info >= (3, 8): + from importlib import metadata +else: + import importlib_metadata as metadata + +__version__ = metadata.version("pygenn") \ No newline at end of file diff --git a/setup.py b/setup.py index 8086d48ef7..ac971b0cfa 100644 --- a/setup.py +++ b/setup.py @@ -177,8 +177,12 @@ ext_modules.append(Extension("_" + namespace + "Backend", ["pygenn/genn_wrapper/generated/" + namespace + "Backend.i"], **backend_extension_kwargs)) +# Read version from txt file +with open(os.path.join(genn_path, "version.txt")) as version_file: + version = version_file.read().strip() + setup(name = "pygenn", - version = "0.4.6", + version = version, packages = find_packages(), package_data={"pygenn": package_data}, @@ -189,6 +193,7 @@ ext_modules=ext_modules, # Requirements - install_requires=["numpy>=1.17", "six", "deprecated", "psutil"], + install_requires=["numpy>=1.17", "six", "deprecated", "psutil", + "importlib-metadata>=1.0;python_version<'3.8'"], zip_safe=False, # Partly for performance reasons ) diff --git a/userproject/MBody1_project/generate_run.cc b/userproject/MBody1_project/generate_run.cc index 55f6451cb9..acf2a74cc0 100644 --- a/userproject/MBody1_project/generate_run.cc +++ b/userproject/MBody1_project/generate_run.cc @@ -50,8 +50,10 @@ class GenerateRun : public GenerateRunBase #else std::string cmd = "../tools/gen_input_structured "; #endif + // <# classes> <# pattern/ input class> + // <'on' rate> cmd += std::to_string(m_NumAL); - cmd += " 10 10 0.1 0.05 1000.0 0.2 "; + cmd += " 10 10 0.1 0.1 1000.0 0.2 "; // p_perturb only sensible if >= 1/n_act (where n_act=p_act*nAL); this assumes nAL >= 100 cmd += getOutDir() + "/" + getExperimentName() + ".inpat 2>&1 "; #ifndef _WIN32 cmd += "|tee " + getOutDir() + "/" + getExperimentName() + ".inpat.msg";