diff --git a/CHANGES.rst b/CHANGES.rst index ba5717360..96d6a14e7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,6 +19,18 @@ Release History - Removed - Fixed +2.0.2 (May 30, 2025) +==================== + +**Added** + +- Support for python 3.13 was added. +- pyproject.toml was added + +**Removed** + +- setup.py was removed + 2.0.1 (unreleased) ================== diff --git a/nengo_spa/algebras/tests/__init__.py b/nengo_spa/algebras/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/nengo_spa/ast/symbolic.py b/nengo_spa/ast/symbolic.py index 5d97d9e75..7a5160af5 100644 --- a/nengo_spa/ast/symbolic.py +++ b/nengo_spa/ast/symbolic.py @@ -50,7 +50,7 @@ def evaluate(self): @property def expr(self): - return repr(self.value) + return str(self.value) @property def _expr_tree(self): diff --git a/nengo_spa/examine.py b/nengo_spa/examine.py index 5f1693ab8..df09b70d3 100644 --- a/nengo_spa/examine.py +++ b/nengo_spa/examine.py @@ -38,7 +38,7 @@ def similarity(data, vocab, normalize=False): elif is_iterable(vocab): if isinstance(next(iter(vocab)), SemanticPointer): vocab = [p.v for p in vocab] - vectors = np.array(vocab, copy=False, ndmin=2) + vectors = np.atleast_2d(np.asarray(vocab)) else: raise ValidationError( f"{type(vocab).__name__:r} object is not a valid vocabulary", attr="vocab" diff --git a/nengo_spa/modules/tests/test_cortical.py b/nengo_spa/modules/tests/test_cortical.py index c1c58fb8b..f16d78e23 100644 --- a/nengo_spa/modules/tests/test_cortical.py +++ b/nengo_spa/modules/tests/test_cortical.py @@ -29,8 +29,8 @@ def test_connect(Simulator, seed): def test_transform(Simulator, seed): with spa.Network(seed=seed) as model: - model.buffer1 = spa.State(vocab=32) - model.buffer2 = spa.State(vocab=32) + model.buffer1 = spa.State(vocab=64) + model.buffer2 = spa.State(vocab=64) spa.sym.A >> model.buffer1 model.buffer1 * spa.sym.B >> model.buffer2 diff --git a/nengo_spa/modules/tests/test_thalamus.py b/nengo_spa/modules/tests/test_thalamus.py index e5e834a0f..89396a5cc 100644 --- a/nengo_spa/modules/tests/test_thalamus.py +++ b/nengo_spa/modules/tests/test_thalamus.py @@ -215,7 +215,7 @@ def test_errors(): with pytest.raises(AttributeError): with spa.Network() as model: model.vision = spa.State(vocab=16) - with spa.ActionSelection: + with spa.ActionSelection(): spa.ifmax(0.5, spa.sym.A >> model.motor) diff --git a/nengo_spa/networks/tests/test_tvtb.py b/nengo_spa/networks/tests/test_tvtb.py index 125e9bb29..7ca4c6efe 100644 --- a/nengo_spa/networks/tests/test_tvtb.py +++ b/nengo_spa/networks/tests/test_tvtb.py @@ -25,12 +25,13 @@ def test_bind(Simulator, seed, rng): @pytest.mark.parametrize("side", ("left", "right")) def test_unbind(Simulator, side, seed, rng): - vocab = spa.Vocabulary(36, pointer_gen=rng, algebra=TvtbAlgebra()) + vector_dim = 49 + vocab = spa.Vocabulary(vector_dim, pointer_gen=rng, algebra=TvtbAlgebra()) vocab.populate("A; B") with spa.Network(seed=seed) as model: vtb = TVTB( - 100, 36, unbind_left=(side == "left"), unbind_right=(side == "right") + 100, vector_dim, unbind_left=(side == "left"), unbind_right=(side == "right") ) if side == "left": diff --git a/pyproject.toml b/pyproject.toml index b663dab7d..c90d5c454 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,81 @@ -# Automatically generated by nengo-bones, do not edit this file directly - [build-system] -requires = ["setuptools<64", "wheel"] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "nengo-spa" +dynamic = ["version"] +description = "An implementation of the Semantic Pointer Architecture for Nengo" +readme = "README.rst" +license = { text = "GNU General Public License, version 2" } +authors = [{ name = "Applied Brain Research", email = "info@appliedbrainresearch.com" }] +requires-python = ">=3.5" +dependencies = [ + #"nengo @ git+https://github.com/nengo/nengo.git@fix-numpy", + "nengo", + "numpy>=1.13,<=2.2.5", +] + +[project.urls] +Homepage = "https://www.nengo.ai/nengo-spa" + +[project.optional-dependencies] +all = [ + "jupyter<=1.1.1", + "matplotlib>=2.0,<=3.9.4", + "nbsphinx>=0.8.11,<=0.9.7", + "nengo_sphinx_theme<=20.9", + "numpydoc>=1.4.0", + "scipy>=1.4.1,<=1.14.1", + "scikit-learn<=1.6.1", + "jupyter>=1.0.0,<=1.1.1", + "matplotlib>=2.0,<=3.9.4", + "nbformat>=5.0.7,<=5.10.4", + "pytest>=3.6,<=8.3.5", + "pytest-allclose~=1.0.0", + "pytest-plt<=1.1.1", + "pytest-rng<=1.0.0", +] + +docs = [ + "jupyter<=1.1.1", + "matplotlib>=2.0,<=3.9.4", + "nbsphinx>=0.8.11,<=0.9.7", + "nengo_sphinx_theme<=20.9", + "numpydoc>=1.4.0", +] +optional = [ + "scipy>=1.4.1,<=1.13.1", + "scikit-learn<=1.6.1", +] +tests = [ + "jupyter>=1.0.0,<=1.1.1", + "matplotlib>=2.0,<=3.9.4", + "nbformat>=5.0.7,<=5.10.4", + "pytest>=3.6,<=8.3.5", + "pytest-allclose~=1.0.0", + "pytest-plt<=1.1.1", + "pytest-rng<=1.0.0", +] + + +#[project.entry-points."nengo.backends"] +#reference = "nengo:Simulator" +# +#[project.entry-points."pytest11"] +#nengo_spa = "pytest_nengo_spa" + +[tool.setuptools.packages.find] +where = ["."] +exclude = ["nengo_spa._vendor"] -[tool.black] -target-version = ['py38'] +[tool.setuptools] +zip-safe = false +include-package-data = false +#py-modules = ["pytest_nengo"] -[tool.isort] -profile = "black" -src_paths = ["nengo_spa"] +#[tool.setuptools.package-data] +#nengo = ["nengo-data/nengorc"] -[tool.docformatter] -wrap-summaries = 88 -wrap-descriptions = 81 -pre-summary-newline = true +[tool.setuptools.dynamic] +version = { attr = "nengo_spa.version.version" } diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 701d1361f..000000000 --- a/setup.cfg +++ /dev/null @@ -1,156 +0,0 @@ -# Automatically generated by nengo-bones, do not edit this file directly - -[build_sphinx] -source-dir = docs -build-dir = docs/_build -all_files = 1 - -[coverage:run] -source = ./ -relative_files = True - -[coverage:report] -# Regexes for lines to exclude from consideration -exclude_lines = - # Have to re-enable the standard pragma - # place ``# pragma: no cover`` at the end of a line to ignore it - pragma: no cover - - # Don't complain if tests don't hit defensive assertion code: - raise NotImplementedError - - # `pass` is just a placeholder, fine if it's not covered - ^[ \t]*pass$ - - # Don't complain if non-runnable code isn't run: - if __name__ == .__main__.: - -# Patterns for files to exclude from reporting -omit = - */tests/test* - nengo_spa/conftest.py - -[flake8] -exclude = - __init__.py -ignore = - E123 - E133 - E203 - E226 - E241 - E242 - E501 - E731 - F401 - W503 -max-complexity = 10 -max-line-length = 88 - -[tool:pytest] -norecursedirs = - .* - *.egg - build - dist - docs -filterwarnings = - ignore::ImportWarning - ignore:(Buffer|Memory):DeprecationWarning - ignore:IPython.core.inputsplitter is deprecated:DeprecationWarning - ignore:Skipping some optimization steps - ignore:SciPy is not installed - ignore:numpy.(dtype|ufunc) size changed -xfail_strict = False - -[pylint] -ignore = - compat.py, - -[pylint.messages] -disable = - arguments-differ, - assignment-from-no-return, - attribute-defined-outside-init, - blacklisted-name, - comparison-with-callable, - duplicate-code, - fixme, - import-error, - invalid-name, - invalid-sequence-index, - len-as-condition, - literal-comparison, - no-else-raise, - no-else-return, - no-member, - no-name-in-module, - not-an-iterable, - not-context-manager, - protected-access, - redefined-builtin, - stop-iteration-return, - too-few-public-methods, - too-many-arguments, - too-many-branches, - too-many-instance-attributes, - too-many-lines, - too-many-locals, - too-many-return-statements, - too-many-statements, - unexpected-keyword-arg, - unidiomatic-typecheck, - unsubscriptable-object, - unsupported-assignment-operation, - unused-argument, - abstract-method, - broad-except, - chained-comparison, - consider-using-f-string, - consider-using-in, - eval-used, - expression-not-assigned, - import-error, - import-outside-toplevel, - inconsistent-return-statements, - keyword-arg-before-vararg, - missing-class-docstring, - missing-function-docstring, - missing-module-docstring, - no-else-break, - no-self-argument, - not-callable, - pointless-statement, - raise-missing-from, - reimported, - super-with-arguments, - superfluous-parens, - too-many-public-methods, - undefined-variable, - unnecessary-dunder-call, - unnecessary-lambda-assignment, - unneeded-not, - unspecified-encoding, - unused-variable, - use-implicit-booleaness-not-comparison, - -[pylint.imports] -known-third-party = - matplotlib, - nengo, - numpy, - pytest, - -[pylint.format] -max-line-length = 88 - -[pylint.classes] -valid-metaclass-classmethod-first-arg = metacls - -[pylint.reports] -reports = no -score = no - -[codespell] -skip = ./build,*/_build,*-checkpoint.ipynb,./.eggs,./*.egg-info,./.git,*/_vendor,./.mypy_cache, -ignore-words-list = ba diff --git a/setup.py b/setup.py deleted file mode 100755 index 427becce6..000000000 --- a/setup.py +++ /dev/null @@ -1,87 +0,0 @@ -# Automatically generated by nengo-bones, do not edit this file directly - -import io -import pathlib -import runpy - -try: - from setuptools import find_packages, setup -except ImportError: - raise ImportError( - "'setuptools' is required but not installed. To install it, " - "follow the instructions at " - "https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py" - ) - - -def read(*filenames, **kwargs): - encoding = kwargs.get("encoding", "utf-8") - sep = kwargs.get("sep", "\n") - buf = [] - for filename in filenames: - with io.open(filename, encoding=encoding) as f: - buf.append(f.read()) - return sep.join(buf) - - -root = pathlib.Path(__file__).parent -version = runpy.run_path(str(root / "nengo_spa" / "version.py"))["version"] - -install_req = [ - "nengo>=2.7", - "numpy>=1.8", -] -docs_req = [ - "jupyter", - "matplotlib>=2.0", - "nbsphinx>=0.8.11", - "nengo_sphinx_theme", - "numpydoc>=1.4.0", -] -optional_req = [ - "scipy>=1.4.1", - "scikit-learn", -] -tests_req = [ - "jupyter>=1.0.0", - "matplotlib>=2.0", - "nbformat>=5.0.7", - "pytest>=3.6", - "pytest-plt", - "pytest-rng", -] - -setup( - name="nengo-spa", - version=version, - author="Applied Brain Research", - author_email="info@appliedbrainresearch.com", - packages=find_packages(), - url="https://www.nengo.ai/nengo-spa", - include_package_data=True, - license="GNU General Public License, version 2", - description="An implementation of the Semantic Pointer Architecture for Nengo", - long_description=read("README.rst", "CHANGES.rst"), - zip_safe=False, - install_requires=install_req, - extras_require={ - "all": docs_req + optional_req + tests_req, - "docs": docs_req, - "optional": optional_req, - "tests": tests_req, - }, - python_requires=">=3.8", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Framework :: Nengo", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Topic :: Scientific/Engineering :: Artificial Intelligence", - ], -)