Skip to content

Add pyproject.toml #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__pycache__/
build/
*~
*~
*.egg-info
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ The client can either be installed using `python3 setup.py install
--user` or, as the client is implemented in a single file, by just
copying the file `nest_client/nest_client.py` to your project.

The directory `examples` holds some examples that demostrate the
The directory `examples` holds some examples that demonstrate the
usage of the client.
42 changes: 21 additions & 21 deletions examples/NESTClient_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,46 +19,46 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.

from NESTServerClient import NESTServerClient
from nest_client import NESTClient

print('Running client examples using NEST via NEST Server')
print("Running client examples using NEST via NEST Server")

# Load NEST Server client
nestsc = NESTServerClient()
# Load NEST client
nest = NESTClient()

#
# Use NEST Server API
#
print('\n')
print('Execute script code with NEST Server API')
print('-' * 20)
print("\n")
print("Execute script code with NEST Server API")
print("-" * 20)

# Reset kernel
nestsc.ResetKernel()
nest.ResetKernel()

# Create nodes
pg = nestsc.Create("poisson_generator", params={"rate": 6500.})
neurons = nestsc.Create("iaf_psc_alpha", 100)
sr = nestsc.Create("spike_recorder")
pg = nest.Create("poisson_generator", params={"rate": 6500.0})
neurons = nest.Create("iaf_psc_alpha", 100)
sr = nest.Create("spike_recorder")

# Connect nodes
nestsc.Connect(pg, neurons, syn_spec={'weight': 10.})
nestsc.Connect(neurons[::10], sr)
nest.Connect(pg, neurons, syn_spec={"weight": 10.0})
nest.Connect(neurons[::10], sr)

# Simulate
nestsc.Simulate(1000.0)
nest.Simulate(1000.0)

# Get events
n_events = nestsc.GetStatus(sr, 'n_events')[0]
print('Number of events:', n_events)
n_events = nest.GetStatus(sr, "n_events")[0]
print("Number of events:", n_events)


#
# Use NEST Server exec
#
print('\n')
print('Execute script code from file')
print('-' * 20)
print("\n")
print("Execute script code from file")
print("-" * 20)

n_events = nestsc.from_file('NESTClient_script.py', 'n_events')['data']
print('Number of events:', n_events)
n_events = nest.from_file("NESTClient_script.py", "n_events")["data"]
print("Number of events:", n_events)
3 changes: 0 additions & 3 deletions examples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,3 @@
#
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.


from .NESTServerClient import *
66 changes: 66 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[project]
name = "nest-client"
version = "0.1.1"
description = "NEST Client sends JSON requests to NEST Server."
readme = "README.md"
requires-python = ">=3.9"
license-files = ["LICENSE"]
authors = [
{name = "Dennis Terhorst"},
{name = "Jochen M. Eppler"},
{name = "Sebastian Spreizer"},
]
maintainers = [
{name = "Dennis Terhorst", email = "[email protected]"}
]
# keywords = []
classifiers = [
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 5 - Stable",

# Indicate who your project is intended for
"Intended Audience :: Science/Research",

"Topic :: Scientific/Engineering",

# Specify the Python versions you support here.
"Programming Language :: Python :: 3",
]
dependencies = [
"requests",
"werkzeug",
]

[project.urls]
homepage = "https://nest-simulator.org"
repository = "https://github.com/nest/nest-client"
documentation = "https://nest-simulator.readthedocs.io"

[tool.black]
line-length = 120

[tool.flake8]
# This is ignored
# see discussions around https://github.com/PyCQA/flake8/issues/234

[tool.isort]
atomic = true
line_length = 120
multi_line_output = 3
profile = "black"
skip_gitignore = true

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--mypy --pylint --pydocstyle --cov --ignore=conda --ignore=venv --ignore=.git --ignore=__pycache__"
norecursedirs = ".git _build venv tmp*"

[tool.mypy]
exclude = ".git/, .pytest_cache/, conda/, venv/"

[tool.pydocstyle]
convention = "numpy"
add-ignore = "D300"
34 changes: 0 additions & 34 deletions setup.py

This file was deleted.

10 changes: 9 additions & 1 deletion nest_client/__init__.py → src/nest_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@
# along with NEST. If not, see <http://www.gnu.org/licenses/>.


from .nest_client import *
from importlib import metadata # noqa
from .nest_client import * # noqa

try:
__version__ = metadata.version("nest-client")
except metadata.PackageNotFoundError:
pass

del metadata
4 changes: 2 additions & 2 deletions nest_client/nest_client.py → src/nest_client/nest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.

import requests
from werkzeug.exceptions import BadRequest
import requests # noqa
from werkzeug.exceptions import BadRequest # noqa


__all__ = [
Expand Down