From 870cab1fbb27c09cf38a7ed36d003c9306ff659c Mon Sep 17 00:00:00 2001 From: candle Date: Tue, 1 Oct 2024 13:52:19 +0200 Subject: [PATCH 01/15] attempt updating setup.py to toml --- python-libraries/nanover-ase/pyproject.toml | 25 +++++++++++++++++++++ python-libraries/nanover-ase/setup.py | 22 ++---------------- 2 files changed, 27 insertions(+), 20 deletions(-) create mode 100644 python-libraries/nanover-ase/pyproject.toml diff --git a/python-libraries/nanover-ase/pyproject.toml b/python-libraries/nanover-ase/pyproject.toml new file mode 100644 index 000000000..7891258c5 --- /dev/null +++ b/python-libraries/nanover-ase/pyproject.toml @@ -0,0 +1,25 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nanover-ase" +authors = [ + {name = "Intangible Realities Lab"}, +] +description = "ASE integration for NanoVer" +readme = "README.md" +requires-python = ">=3.12" +dependencies = [ + "nanover", + "ase >= 3.21", +] +dynamic = ["version"] + +[project.scripts] +nanover-omm-ase = "nanover.ase.openmm.cli:main" + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-ase/setup.py b/python-libraries/nanover-ase/setup.py index 38135eba1..beda28e82 100644 --- a/python-libraries/nanover-ase/setup.py +++ b/python-libraries/nanover-ase/setup.py @@ -1,23 +1,5 @@ #!/usr/bin/env python -from distutils.core import setup -from setuptools import find_namespace_packages +from setuptools import setup -setup( - name="nanover-ase", - version="0.1.0", - description="ASE integration for NanoVer", - author="Intangible Realities Lab", - author_email="m.oconnor@bristol.ac.uk", - url="https://gitlab.com/intangiblerealities/", - packages=find_namespace_packages("src", include="nanover.*"), - package_dir={"": "src"}, - package_data={"": ["py.typed"]}, - install_requires=( - "nanover", - "ase>=3.21", - ), - entry_points={ - "console_scripts": ["nanover-omm-ase=nanover.ase.openmm.cli:main"], - }, -) +setup() From 3fa4a9ce03659449f051db239cb7f4f25168dfbe Mon Sep 17 00:00:00 2001 From: candle Date: Tue, 1 Oct 2024 15:25:26 +0200 Subject: [PATCH 02/15] update most packages --- python-libraries/nanover-ase/setup.py | 5 ---- python-libraries/nanover-essd/pyproject.toml | 23 ++++++++++++++++++ python-libraries/nanover-essd/setup.py | 20 ---------------- .../nanover-jupyter/pyproject.toml | 23 ++++++++++++++++++ python-libraries/nanover-jupyter/setup.py | 23 ------------------ .../nanover-lammps/pyproject.toml | 22 +++++++++++++++++ python-libraries/nanover-lammps/setup.py | 21 ---------------- .../nanover-mdanalysis/pyproject.toml | 21 ++++++++++++++++ python-libraries/nanover-mdanalysis/setup.py | 21 ---------------- python-libraries/nanover-omni/pyproject.toml | 24 +++++++++++++++++++ python-libraries/nanover-omni/setup.py | 23 ------------------ .../nanover-openmm/pyproject.toml | 24 +++++++++++++++++++ python-libraries/nanover-openmm/setup.py | 23 ------------------ 13 files changed, 137 insertions(+), 136 deletions(-) delete mode 100644 python-libraries/nanover-ase/setup.py create mode 100644 python-libraries/nanover-essd/pyproject.toml delete mode 100644 python-libraries/nanover-essd/setup.py create mode 100644 python-libraries/nanover-jupyter/pyproject.toml delete mode 100644 python-libraries/nanover-jupyter/setup.py create mode 100644 python-libraries/nanover-lammps/pyproject.toml delete mode 100644 python-libraries/nanover-lammps/setup.py create mode 100644 python-libraries/nanover-mdanalysis/pyproject.toml delete mode 100644 python-libraries/nanover-mdanalysis/setup.py create mode 100644 python-libraries/nanover-omni/pyproject.toml delete mode 100644 python-libraries/nanover-omni/setup.py create mode 100644 python-libraries/nanover-openmm/pyproject.toml delete mode 100644 python-libraries/nanover-openmm/setup.py diff --git a/python-libraries/nanover-ase/setup.py b/python-libraries/nanover-ase/setup.py deleted file mode 100644 index beda28e82..000000000 --- a/python-libraries/nanover-ase/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup - -setup() diff --git a/python-libraries/nanover-essd/pyproject.toml b/python-libraries/nanover-essd/pyproject.toml new file mode 100644 index 000000000..4aa224190 --- /dev/null +++ b/python-libraries/nanover-essd/pyproject.toml @@ -0,0 +1,23 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nanover-essd" +authors = [ + {name = "Intangible Realities Lab"}, +] +description = "Extremely Simple Server Discovery, for use with NanoVer" +requires-python = ">=3.12" +dependencies = [ + "netifaces", +] +dynamic = ["version"] + +[project.scripts] +nanover-essd-list = "nanover.essd.list_cli:main" + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-essd/setup.py b/python-libraries/nanover-essd/setup.py deleted file mode 100644 index ea31fb80a..000000000 --- a/python-libraries/nanover-essd/setup.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python - -from distutils.core import setup -from setuptools import find_namespace_packages - -setup( - name="nanover-essd", - version="1.0.0", - description="Extremely Simple Server Discovery, for use with NanoVer", - author="Intangible Realities Lab", - author_email="m.oconnor@bristol.ac.uk", - url="https://gitlab.com/intangiblerealities/", - packages=find_namespace_packages("src", include="nanover.*"), - package_data={"": ["py.typed"]}, - install_requires=("netifaces",), - entry_points={ - "console_scripts": ["nanover-essd-list=nanover.essd.list_cli:main"], - }, - package_dir={"": "src"}, -) diff --git a/python-libraries/nanover-jupyter/pyproject.toml b/python-libraries/nanover-jupyter/pyproject.toml new file mode 100644 index 000000000..8a20e3e5d --- /dev/null +++ b/python-libraries/nanover-jupyter/pyproject.toml @@ -0,0 +1,23 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nanover-jupyter" +authors = [ + {name = "Intangible Realities Lab"}, +] +description = "Utilities for using Jupyter with NanoVer" +requires-python = ">=3.12" +dependencies = [ + "nanover", + "MDAnalysis", + "numpy", + "nglview", +] +dynamic = ["version"] + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-jupyter/setup.py b/python-libraries/nanover-jupyter/setup.py deleted file mode 100644 index 5ec51ac13..000000000 --- a/python-libraries/nanover-jupyter/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - - -from distutils.core import setup -from setuptools import find_namespace_packages - -setup( - name="nanover-jupyter", - version="0.1.0", - description="NGLView python client for NanoVer", - author="Intangible Realities Lab", - author_email="harry.stroud@usc.es", - url="https://github.com/IRL2/", - packages=find_namespace_packages("src", include="nanover.*"), - package_dir={"": "src"}, - package_data={"": ["py.typed"]}, - install_requires=( - "nanover", - "MDAnalysis", - "numpy", - "nglview", - ), -) diff --git a/python-libraries/nanover-lammps/pyproject.toml b/python-libraries/nanover-lammps/pyproject.toml new file mode 100644 index 000000000..179608060 --- /dev/null +++ b/python-libraries/nanover-lammps/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nanover-lammps" +authors = [ + {name = "Intangible Realities Lab"}, +] +description = "LAMMPS integration for NanoVer" +requires-python = ">=3.12" +dependencies = [ + "nanover", + "mpi4py", + "numpy", +] +dynamic = ["version"] + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-lammps/setup.py b/python-libraries/nanover-lammps/setup.py deleted file mode 100644 index cbaf8b4e9..000000000 --- a/python-libraries/nanover-lammps/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - -from distutils.core import setup -from setuptools import find_namespace_packages - -setup( - name="nanover-lammps", - version="0.1.0", - description="LAMMPS integration for NanoVer", - author="Intangible Realities Lab", - author_email="simonbennie@gmail.com", - url="https://gitlab.com/intangiblerealities/", - packages=find_namespace_packages("src", include="nanover.*"), - package_dir={"": "src"}, - package_data={"": ["py.typed"]}, - install_requires=( - "nanover", - "mpi4py", - "numpy", - ), -) diff --git a/python-libraries/nanover-mdanalysis/pyproject.toml b/python-libraries/nanover-mdanalysis/pyproject.toml new file mode 100644 index 000000000..f33847bb3 --- /dev/null +++ b/python-libraries/nanover-mdanalysis/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nanover-mdanalysis" +authors = [ + {name = "Intangible Realities Lab"}, +] +description = "MDAnalysis integration for NanoVer" +requires-python = ">=3.12" +dependencies = [ + "nanover", + "MDAnalysis", +] +dynamic = ["version"] + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-mdanalysis/setup.py b/python-libraries/nanover-mdanalysis/setup.py deleted file mode 100644 index 3f9c26aa4..000000000 --- a/python-libraries/nanover-mdanalysis/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - - -from distutils.core import setup -from setuptools import find_namespace_packages - -setup( - name="nanover-mdanalysis", - version="0.1.0", - description="MDAnalysis integration for NanoVer", - author="Intangible Realities Lab", - author_email="m.oconnor@bristol.ac.uk", - url="https://gitlab.com/intangiblerealities/", - packages=find_namespace_packages("src", include="nanover.*"), - package_dir={"": "src"}, - package_data={"": ["py.typed"]}, - install_requires=( - "nanover", - "MDAnalysis", - ), -) diff --git a/python-libraries/nanover-omni/pyproject.toml b/python-libraries/nanover-omni/pyproject.toml new file mode 100644 index 000000000..1a7ff2233 --- /dev/null +++ b/python-libraries/nanover-omni/pyproject.toml @@ -0,0 +1,24 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nanover-omni" +authors = [ + {name = "Intangible Realities Lab"}, +] +description = "Multi-simulation server for NanoVer" +requires-python = ">=3.12" +dependencies = [ + "nanover", + "openmm", +] +dynamic = ["version"] + +[project.scripts] +nanover-omni = "nanover.omni.cli:main" + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-omni/setup.py b/python-libraries/nanover-omni/setup.py deleted file mode 100644 index 096bffa49..000000000 --- a/python-libraries/nanover-omni/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -from distutils.core import setup -from setuptools import find_namespace_packages - -setup( - name="nanover-omni", - version="0.1.0", - description="Omni server for NanoVer", - author="Intangible Realities Lab", - author_email="m.oconnor@bristol.ac.uk", - url="https://gitlab.com/intangiblerealities/", - packages=find_namespace_packages("src", include="nanover.*"), - package_dir={"": "src"}, - package_data={"": ["py.typed"]}, - install_requires=( - "nanover", - "openmm", - ), - entry_points={ - "console_scripts": ["nanover-omni=nanover.omni.cli:main"], - }, -) diff --git a/python-libraries/nanover-openmm/pyproject.toml b/python-libraries/nanover-openmm/pyproject.toml new file mode 100644 index 000000000..5dde3d718 --- /dev/null +++ b/python-libraries/nanover-openmm/pyproject.toml @@ -0,0 +1,24 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nanover-openmm" +authors = [ + {name = "Intangible Realities Lab"}, +] +description = "Multi-simulation server for NanoVer" +requires-python = ">=3.12" +dependencies = [ + "nanover", + "openmm", +] +dynamic = ["version"] + +[project.scripts] +nanover-omm-server = "nanover.openmm.cli:main" + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-openmm/setup.py b/python-libraries/nanover-openmm/setup.py deleted file mode 100644 index ff19c138c..000000000 --- a/python-libraries/nanover-openmm/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -from distutils.core import setup -from setuptools import find_namespace_packages - -setup( - name="nanover-openmm", - version="0.1.0", - description="OpenMM server for NanoVer", - author="Intangible Realities Lab", - author_email="m.oconnor@bristol.ac.uk", - url="https://gitlab.com/intangiblerealities/", - packages=find_namespace_packages("src", include="nanover.*"), - package_dir={"": "src"}, - package_data={"": ["py.typed"]}, - install_requires=( - "nanover", - "openmm", - ), - entry_points={ - "console_scripts": ["nanover-omm-server=nanover.openmm.cli:main"], - }, -) From 2e6b28f83723fa19e65502956bd82cf6f44545d8 Mon Sep 17 00:00:00 2001 From: candle Date: Tue, 1 Oct 2024 15:33:40 +0200 Subject: [PATCH 03/15] nanover-core toml --- python-libraries/nanover-core/pyproject.toml | 30 ++++++++++++++++++++ python-libraries/nanover-core/setup.py | 14 --------- 2 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 python-libraries/nanover-core/pyproject.toml diff --git a/python-libraries/nanover-core/pyproject.toml b/python-libraries/nanover-core/pyproject.toml new file mode 100644 index 000000000..f2d1e3d69 --- /dev/null +++ b/python-libraries/nanover-core/pyproject.toml @@ -0,0 +1,30 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nanover-core" +authors = [ + {name = "Intangible Realities Lab"}, +] +description = "NanoVer python framework" +requires-python = ">=3.12" +dependencies = [ + "setuptools>=40.1.1", + "grpcio>=1.63.0", + "grpcio-tools>=1.63.0", + "pytest", + "aiogrpc", + "numpy", + "hypothesis", + "typing_extensions", +] +dynamic = ["version"] + +[project.scripts] +nanover-multiplayer = "nanover.multiplayer.cli:main" + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-core/setup.py b/python-libraries/nanover-core/setup.py index 89c41cd65..b4e77be14 100644 --- a/python-libraries/nanover-core/setup.py +++ b/python-libraries/nanover-core/setup.py @@ -7,7 +7,6 @@ import distutils.cmd import distutils.log from distutils.core import setup -from setuptools import find_namespace_packages from importlib import resources @@ -142,20 +141,7 @@ def move_in_directory(destination): requirements = f.readlines() setup( - name="nanover", - version="1.0", - description="NanoVer python framework", - author="Intangible Realities Lab", - author_email="m.oconnor@bristol.ac.uk", - url="https://gitlab.com/intangiblerealities/", - packages=find_namespace_packages("src", include="nanover.*") + ["nanover.protocol"], - package_dir={"": "src"}, - package_data={"": ["py.typed"]}, - install_requires=requirements, cmdclass={ "compile_proto": CompileProtoCommand, }, - entry_points={ - "console_scripts": ["nanover-multiplayer=nanover.multiplayer.cli:main"], - }, ) From 71b39353623c6a50e93191d8e5094dc44c808978 Mon Sep 17 00:00:00 2001 From: candle Date: Tue, 1 Oct 2024 16:31:32 +0200 Subject: [PATCH 04/15] fix proto compiling --- .github/workflows/conda.yml | 2 +- compile.sh | 2 +- .../setup.py => compile_proto.py} | 125 ++++++++---------- win_compile.ps1 | 2 +- 4 files changed, 57 insertions(+), 74 deletions(-) rename python-libraries/{nanover-core/setup.py => compile_proto.py} (50%) diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index 094d40f58..67e3e4dce 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -32,7 +32,7 @@ jobs: - name: Install dependencies run: conda install -y python conda-build "grpcio-tools<1.62" conda-verify - name: Compiling the prototypes - run: python python-libraries/nanover-core/setup.py compile_proto --proto-dir=protocol + run: python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src/nanover/protoco - name: Building the Conda packages run: | $build_command \ diff --git a/compile.sh b/compile.sh index 7ffce599e..c839480e4 100755 --- a/compile.sh +++ b/compile.sh @@ -63,7 +63,7 @@ if [[ $with_python == true ]]; then python -m pip install -r ./python-libraries/requirements.test ${user_option} announce "Compiling proto files to python" - python ./python-libraries/nanover-core/setup.py compile_proto + python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src/nanover/protocol announce "Installing the python packages" python -m pip install ${edit_option} ${nanover_user_option} ./python-libraries/nanover-core/ diff --git a/python-libraries/nanover-core/setup.py b/python-libraries/compile_proto.py similarity index 50% rename from python-libraries/nanover-core/setup.py rename to python-libraries/compile_proto.py index b4e77be14..41a449a09 100644 --- a/python-libraries/nanover-core/setup.py +++ b/python-libraries/compile_proto.py @@ -1,74 +1,58 @@ -# !/usr/bin/env python - - +import argparse import os +import textwrap from contextlib import contextmanager -from pathlib import Path -import distutils.cmd -import distutils.log -from distutils.core import setup from importlib import resources +from pathlib import Path -class CompileProtoCommand(distutils.cmd.Command): +def handle_user_arguments(args=None) -> argparse.Namespace: """ - Custom command to compile the protocol files. + Parse the arguments from the command line. - To run the command, call:: + :return: The namespace of arguments read from the command line. + """ + description = textwrap.dedent( + """\ + Compile the gRPC protocol files to python. + """ + ) + parser = argparse.ArgumentParser(description=description) + + parser.add_argument( + "--proto-dir", + required=True, + dest="proto_dir", + metavar="PATH", + help="The path to the directory containing the proto files", + ) - python setup.py compile_proto + parser.add_argument( + "--python-dir", + required=True, + dest="python_dir", + metavar="PATH", + help="The path to the directory where to generate the python files", + ) - While it is not recommended, it is possible to run the compilation with a - different set of protocol files by passing the --proto-dir option: + arguments = parser.parse_args(args) + return arguments - python setup.py compile_proto --proto-dir=../other-proto-files - """ - - description = "Compile the protocol files." - user_options = [ - # The format is (long option, short option, description) - ("proto-dir=", None, "Path to the directory containing the protocol files."), - ] - - def initialize_options(self): - """ - Set the default values for the options. - """ - # By default, the setup.py file is in nanover-protocol/python-libraries/nanover-core, - # the protocol files are in nanover-protocol/protocol, which is ../../protocol relative - # to the directory of setup.py. - here = Path(__file__).parent - self.proto_dir = here / "../../protocol" - - def finalize_options(self): - """ - Post-process options. - """ - self.proto_dir = Path(self.proto_dir) - assert ( - self.proto_dir.exists - ), "The prototype directory {} does not exist.".format(self.proto_dir) - - def run(self): - """ - Run the compilation. - """ - self.announce("Compile protocol files.", level=distutils.log.INFO) - setup_path = Path(__file__).parent.resolve() - compile_protocol(self.proto_dir, setup_path / "src", self) - - -def compile_protocol(proto_dir, python_dir, logger): +def compile_protocol(proto_dir, python_dir): """ Compile the protocol files to python. :param proto_dir: The path to the directory containing the proto files. :param python_dir: The path to the directory where to generate the python files. - :param logger: The logger instance used by distutils. """ from grpc_tools import protoc + try: + os.makedirs(python_dir) + except OSError: + pass + # Note on calling grpc_tools.protoc as a python function: # grpc_tools.protoc.main is called by the command line with sys.argv and # the include path for the default protobuf proto files. sys.argv is a list of @@ -79,17 +63,15 @@ def compile_protocol(proto_dir, python_dir, logger): proto_include = resources.files("grpc_tools") / "_proto" with move_in_directory(proto_dir): for protocol_file in Path(".").glob("**/*.proto"): - logger.announce( - "Compiling {}".format(protocol_file), level=distutils.log.INFO - ) + print(f"Compiling {protocol_file}") protoc.main( ( "protoc", - "--proto_path=.", - "--python_out=" + str(python_dir), - "--grpc_python_out=" + str(python_dir), + f"--proto_path=.", + f"--python_out={python_dir}", + f"--grpc_python_out={python_dir}", str(protocol_file), - "--proto_path={}".format(proto_include), + f"--proto_path={proto_include}", ) ) generated_protocol_directories = ( @@ -132,16 +114,17 @@ def move_in_directory(destination): os.chdir(str(directory_to_restore)) -# Avoid repeating the content of requirements.txt here. -# The requirements.txt file is in the same directory as this setup.py, -# we then should now were the setup lies to be independent of the working -# directory. -requirements_path = Path(__file__).parent.resolve() / "requirements.txt" -with open(str(requirements_path)) as f: - requirements = f.readlines() +def main(): + """ + Entry point for the command line. + """ + arguments = handle_user_arguments() + + compile_protocol( + Path(arguments.proto_dir).resolve(), + Path(arguments.python_dir).resolve(), + ) + -setup( - cmdclass={ - "compile_proto": CompileProtoCommand, - }, -) +if __name__ == "__main__": + main() diff --git a/win_compile.ps1 b/win_compile.ps1 index 73371725a..532a13a57 100644 --- a/win_compile.ps1 +++ b/win_compile.ps1 @@ -38,7 +38,7 @@ announce "Installing python test requirements" python -m pip install -r ./python-libraries/requirements.test ${user_option} announce "Compiling proto files to python" -python ./python-libraries/nanover-core/setup.py compile_proto +python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src/nanover/protocol announce "Installing the python packages" python -m pip install ${edit_option} ${user_option} ./python-libraries/nanover-core/ From c6694c80246377c39decbd63b32feb99a749a6b0 Mon Sep 17 00:00:00 2001 From: candle Date: Tue, 1 Oct 2024 16:41:04 +0200 Subject: [PATCH 05/15] missing include --- python-libraries/nanover-core/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-libraries/nanover-core/pyproject.toml b/python-libraries/nanover-core/pyproject.toml index f2d1e3d69..49b0511c6 100644 --- a/python-libraries/nanover-core/pyproject.toml +++ b/python-libraries/nanover-core/pyproject.toml @@ -26,5 +26,5 @@ nanover-multiplayer = "nanover.multiplayer.cli:main" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) -include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) +include = ["nanover.*", "nanover.protocol"] # package names should match these glob patterns (["*"] by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) From 8f5424f961ee065c6c6b0a515f95447ac992d406 Mon Sep 17 00:00:00 2001 From: candle Date: Tue, 1 Oct 2024 16:44:32 +0200 Subject: [PATCH 06/15] fix paths --- .github/workflows/conda.yml | 2 +- compile.sh | 2 +- win_compile.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index 67e3e4dce..b641fd520 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -32,7 +32,7 @@ jobs: - name: Install dependencies run: conda install -y python conda-build "grpcio-tools<1.62" conda-verify - name: Compiling the prototypes - run: python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src/nanover/protoco + run: python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src - name: Building the Conda packages run: | $build_command \ diff --git a/compile.sh b/compile.sh index c839480e4..808f6456e 100755 --- a/compile.sh +++ b/compile.sh @@ -63,7 +63,7 @@ if [[ $with_python == true ]]; then python -m pip install -r ./python-libraries/requirements.test ${user_option} announce "Compiling proto files to python" - python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src/nanover/protocol + python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src announce "Installing the python packages" python -m pip install ${edit_option} ${nanover_user_option} ./python-libraries/nanover-core/ diff --git a/win_compile.ps1 b/win_compile.ps1 index 532a13a57..b000adcf6 100644 --- a/win_compile.ps1 +++ b/win_compile.ps1 @@ -38,7 +38,7 @@ announce "Installing python test requirements" python -m pip install -r ./python-libraries/requirements.test ${user_option} announce "Compiling proto files to python" -python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src/nanover/protocol +python ./python-libraries/compile_proto.py --proto-dir=./protocol --python-dir=./python-libraries/nanover-core/src announce "Installing the python packages" python -m pip install ${edit_option} ${user_option} ./python-libraries/nanover-core/ From 4a8aba562cdbb2c29121f4de9413c3a048d8be8c Mon Sep 17 00:00:00 2001 From: candle Date: Tue, 1 Oct 2024 16:47:32 +0200 Subject: [PATCH 07/15] style --- python-libraries/compile_proto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-libraries/compile_proto.py b/python-libraries/compile_proto.py index 41a449a09..fe079434a 100644 --- a/python-libraries/compile_proto.py +++ b/python-libraries/compile_proto.py @@ -67,7 +67,7 @@ def compile_protocol(proto_dir, python_dir): protoc.main( ( "protoc", - f"--proto_path=.", + "--proto_path=.", f"--python_out={python_dir}", f"--grpc_python_out={python_dir}", str(protocol_file), From 3a5a39ecbf13f7ddc92e49b0ce9475c18c55e6bc Mon Sep 17 00:00:00 2001 From: candle Date: Tue, 1 Oct 2024 16:55:36 +0200 Subject: [PATCH 08/15] remove spurious file --- python-libraries/nanover-core/conda/bld.bat | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 python-libraries/nanover-core/conda/bld.bat diff --git a/python-libraries/nanover-core/conda/bld.bat b/python-libraries/nanover-core/conda/bld.bat deleted file mode 100644 index 602113031..000000000 --- a/python-libraries/nanover-core/conda/bld.bat +++ /dev/null @@ -1,2 +0,0 @@ -"%PYTHON%" setup.py install -if errorlevel 1 exit 1 \ No newline at end of file From 19c9fdcade5b6b0bc010d0f10e426e25650666f1 Mon Sep 17 00:00:00 2001 From: candle Date: Wed, 2 Oct 2024 11:39:27 +0200 Subject: [PATCH 09/15] fix compile scripts? --- compile.sh | 2 +- win_compile.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compile.sh b/compile.sh index 808f6456e..d5c2b429b 100755 --- a/compile.sh +++ b/compile.sh @@ -69,7 +69,7 @@ if [[ $with_python == true ]]; then python -m pip install ${edit_option} ${nanover_user_option} ./python-libraries/nanover-core/ for package in python-libraries/nanover-*/; do - if [[ -f "${package}/setup.py" ]]; then + if [[ -f "${package}/pyproject.toml" ]]; then python -m pip install ${edit_option} ${nanover_user_option} ${package} fi done diff --git a/win_compile.ps1 b/win_compile.ps1 index b000adcf6..e73ac34c5 100644 --- a/win_compile.ps1 +++ b/win_compile.ps1 @@ -44,7 +44,7 @@ announce "Installing the python packages" python -m pip install ${edit_option} ${user_option} ./python-libraries/nanover-core/ Get-ChildItem -Directory python-libraries/nanover-* | ForEach-Object { - if (Test-Path -Path "$($_.FullName)/setup.py") { + if (Test-Path -Path "$($_.FullName)/pyproject.toml") { Write-Host "$($_.FullName)" pip install ${edit_option} ${user_option} ""$($_.FullName)"" } From 5c87d12647673076a8cdd4b2af7b572539347e8a Mon Sep 17 00:00:00 2001 From: candle Date: Wed, 2 Oct 2024 12:01:47 +0200 Subject: [PATCH 10/15] correct package name for nanover-core --- python-libraries/nanover-core/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-libraries/nanover-core/pyproject.toml b/python-libraries/nanover-core/pyproject.toml index 49b0511c6..f75d57e14 100644 --- a/python-libraries/nanover-core/pyproject.toml +++ b/python-libraries/nanover-core/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools", "setuptools-scm"] build-backend = "setuptools.build_meta" [project] -name = "nanover-core" +name = "nanover" authors = [ {name = "Intangible Realities Lab"}, ] From a3d756f0f2813eee1181673aeca6e4df112b83bb Mon Sep 17 00:00:00 2001 From: candle Date: Thu, 3 Oct 2024 13:33:42 +0200 Subject: [PATCH 11/15] missing entry point --- python-libraries/nanover-essd/conda/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-libraries/nanover-essd/conda/meta.yaml b/python-libraries/nanover-essd/conda/meta.yaml index e60293a1a..b42fc6720 100644 --- a/python-libraries/nanover-essd/conda/meta.yaml +++ b/python-libraries/nanover-essd/conda/meta.yaml @@ -8,6 +8,8 @@ source: build: noarch: python number: 0 + entry_points: + - nanover-essd-list = nanover.essd.list_cli:main requirements: build: From b1c3b11b4ba302674aa67c859d46b59326656e66 Mon Sep 17 00:00:00 2001 From: candle Date: Thu, 3 Oct 2024 13:36:34 +0200 Subject: [PATCH 12/15] allow PEP 420 packages --- python-libraries/nanover-ase/pyproject.toml | 1 - python-libraries/nanover-core/pyproject.toml | 1 - python-libraries/nanover-essd/pyproject.toml | 1 - python-libraries/nanover-jupyter/pyproject.toml | 1 - python-libraries/nanover-lammps/pyproject.toml | 1 - python-libraries/nanover-mdanalysis/pyproject.toml | 1 - python-libraries/nanover-omni/pyproject.toml | 1 - python-libraries/nanover-openmm/pyproject.toml | 1 - 8 files changed, 8 deletions(-) diff --git a/python-libraries/nanover-ase/pyproject.toml b/python-libraries/nanover-ase/pyproject.toml index 7891258c5..6d84b036b 100644 --- a/python-libraries/nanover-ase/pyproject.toml +++ b/python-libraries/nanover-ase/pyproject.toml @@ -22,4 +22,3 @@ nanover-omm-ase = "nanover.ase.openmm.cli:main" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) -namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-core/pyproject.toml b/python-libraries/nanover-core/pyproject.toml index f75d57e14..9da6ae5a5 100644 --- a/python-libraries/nanover-core/pyproject.toml +++ b/python-libraries/nanover-core/pyproject.toml @@ -27,4 +27,3 @@ nanover-multiplayer = "nanover.multiplayer.cli:main" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["nanover.*", "nanover.protocol"] # package names should match these glob patterns (["*"] by default) -namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-essd/pyproject.toml b/python-libraries/nanover-essd/pyproject.toml index 4aa224190..f320ccca9 100644 --- a/python-libraries/nanover-essd/pyproject.toml +++ b/python-libraries/nanover-essd/pyproject.toml @@ -20,4 +20,3 @@ nanover-essd-list = "nanover.essd.list_cli:main" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) -namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-jupyter/pyproject.toml b/python-libraries/nanover-jupyter/pyproject.toml index 8a20e3e5d..670a461d7 100644 --- a/python-libraries/nanover-jupyter/pyproject.toml +++ b/python-libraries/nanover-jupyter/pyproject.toml @@ -20,4 +20,3 @@ dynamic = ["version"] [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) -namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-lammps/pyproject.toml b/python-libraries/nanover-lammps/pyproject.toml index 179608060..4385c567d 100644 --- a/python-libraries/nanover-lammps/pyproject.toml +++ b/python-libraries/nanover-lammps/pyproject.toml @@ -19,4 +19,3 @@ dynamic = ["version"] [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) -namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-mdanalysis/pyproject.toml b/python-libraries/nanover-mdanalysis/pyproject.toml index f33847bb3..28f0d53ee 100644 --- a/python-libraries/nanover-mdanalysis/pyproject.toml +++ b/python-libraries/nanover-mdanalysis/pyproject.toml @@ -18,4 +18,3 @@ dynamic = ["version"] [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) -namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-omni/pyproject.toml b/python-libraries/nanover-omni/pyproject.toml index 1a7ff2233..def4a2633 100644 --- a/python-libraries/nanover-omni/pyproject.toml +++ b/python-libraries/nanover-omni/pyproject.toml @@ -21,4 +21,3 @@ nanover-omni = "nanover.omni.cli:main" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) -namespaces = false # to disable scanning PEP 420 namespaces (true by default) diff --git a/python-libraries/nanover-openmm/pyproject.toml b/python-libraries/nanover-openmm/pyproject.toml index 5dde3d718..3bfa3d22a 100644 --- a/python-libraries/nanover-openmm/pyproject.toml +++ b/python-libraries/nanover-openmm/pyproject.toml @@ -21,4 +21,3 @@ nanover-omm-server = "nanover.openmm.cli:main" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["nanover.*"] # package names should match these glob patterns (["*"] by default) -namespaces = false # to disable scanning PEP 420 namespaces (true by default) From 2d04711bb349d6cc688f3162013c522e8b7e9c87 Mon Sep 17 00:00:00 2001 From: candle Date: Thu, 3 Oct 2024 16:04:43 +0200 Subject: [PATCH 13/15] fix mypy --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ee776ff22..2f7842a8e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,8 +44,8 @@ jobs: run: conda install -y mpi4py openmm - name: Install tests dependancies run: python -m pip install -r python-libraries/requirements.test - - name: Compile - run: ./compile.sh --no-dotnet + - name: Compile (mypy requires --no-edit) + run: ./compile.sh --no-dotnet --no-edit - name: mypy run: | # Mypy accepts paths, modules or packages as inputs. However, only From bc6d08a2148d12dfbf611e0d9eea408ab5bee100 Mon Sep 17 00:00:00 2001 From: candle Date: Thu, 3 Oct 2024 16:22:41 +0200 Subject: [PATCH 14/15] fix test --- .../tests/core/test_nanover_client_server_state.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-libraries/nanover-core/tests/core/test_nanover_client_server_state.py b/python-libraries/nanover-core/tests/core/test_nanover_client_server_state.py index 42412151b..ac0be4d63 100644 --- a/python-libraries/nanover-core/tests/core/test_nanover_client_server_state.py +++ b/python-libraries/nanover-core/tests/core/test_nanover_client_server_state.py @@ -3,6 +3,8 @@ import numpy import pytest + +from nanover.testing import assert_in_soon from nanover.utilities.change_buffers import DictionaryChange from nanover.utilities.key_lockable_map import ResourceLockedError @@ -80,7 +82,8 @@ def test_client_copy_state_is_independent(client_server): client, server = client_server client.subscribe_all_state_updates(0) - time.sleep(IMMEDIATE_REPLY_WAIT_TIME) + # wait for first update + assert_in_soon(lambda: "test", lambda: client.copy_state()) copy = client.copy_state() copy["test"]["baby"] = "shark" From b15855e9c5e321c35f4519473cf48340101f0cbc Mon Sep 17 00:00:00 2001 From: candle Date: Thu, 3 Oct 2024 18:57:40 +0200 Subject: [PATCH 15/15] python 3.11 not 3.12 --- python-libraries/nanover-ase/pyproject.toml | 2 +- python-libraries/nanover-core/pyproject.toml | 2 +- python-libraries/nanover-essd/pyproject.toml | 2 +- python-libraries/nanover-jupyter/pyproject.toml | 2 +- python-libraries/nanover-lammps/pyproject.toml | 2 +- python-libraries/nanover-mdanalysis/pyproject.toml | 2 +- python-libraries/nanover-omni/pyproject.toml | 2 +- python-libraries/nanover-openmm/pyproject.toml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/python-libraries/nanover-ase/pyproject.toml b/python-libraries/nanover-ase/pyproject.toml index 6d84b036b..42ad61bcc 100644 --- a/python-libraries/nanover-ase/pyproject.toml +++ b/python-libraries/nanover-ase/pyproject.toml @@ -9,7 +9,7 @@ authors = [ ] description = "ASE integration for NanoVer" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" dependencies = [ "nanover", "ase >= 3.21", diff --git a/python-libraries/nanover-core/pyproject.toml b/python-libraries/nanover-core/pyproject.toml index 9da6ae5a5..2afa88ebd 100644 --- a/python-libraries/nanover-core/pyproject.toml +++ b/python-libraries/nanover-core/pyproject.toml @@ -8,7 +8,7 @@ authors = [ {name = "Intangible Realities Lab"}, ] description = "NanoVer python framework" -requires-python = ">=3.12" +requires-python = ">=3.11" dependencies = [ "setuptools>=40.1.1", "grpcio>=1.63.0", diff --git a/python-libraries/nanover-essd/pyproject.toml b/python-libraries/nanover-essd/pyproject.toml index f320ccca9..779bc11f1 100644 --- a/python-libraries/nanover-essd/pyproject.toml +++ b/python-libraries/nanover-essd/pyproject.toml @@ -8,7 +8,7 @@ authors = [ {name = "Intangible Realities Lab"}, ] description = "Extremely Simple Server Discovery, for use with NanoVer" -requires-python = ">=3.12" +requires-python = ">=3.11" dependencies = [ "netifaces", ] diff --git a/python-libraries/nanover-jupyter/pyproject.toml b/python-libraries/nanover-jupyter/pyproject.toml index 670a461d7..304c2f0c3 100644 --- a/python-libraries/nanover-jupyter/pyproject.toml +++ b/python-libraries/nanover-jupyter/pyproject.toml @@ -8,7 +8,7 @@ authors = [ {name = "Intangible Realities Lab"}, ] description = "Utilities for using Jupyter with NanoVer" -requires-python = ">=3.12" +requires-python = ">=3.11" dependencies = [ "nanover", "MDAnalysis", diff --git a/python-libraries/nanover-lammps/pyproject.toml b/python-libraries/nanover-lammps/pyproject.toml index 4385c567d..21be654bd 100644 --- a/python-libraries/nanover-lammps/pyproject.toml +++ b/python-libraries/nanover-lammps/pyproject.toml @@ -8,7 +8,7 @@ authors = [ {name = "Intangible Realities Lab"}, ] description = "LAMMPS integration for NanoVer" -requires-python = ">=3.12" +requires-python = ">=3.11" dependencies = [ "nanover", "mpi4py", diff --git a/python-libraries/nanover-mdanalysis/pyproject.toml b/python-libraries/nanover-mdanalysis/pyproject.toml index 28f0d53ee..a538c473c 100644 --- a/python-libraries/nanover-mdanalysis/pyproject.toml +++ b/python-libraries/nanover-mdanalysis/pyproject.toml @@ -8,7 +8,7 @@ authors = [ {name = "Intangible Realities Lab"}, ] description = "MDAnalysis integration for NanoVer" -requires-python = ">=3.12" +requires-python = ">=3.11" dependencies = [ "nanover", "MDAnalysis", diff --git a/python-libraries/nanover-omni/pyproject.toml b/python-libraries/nanover-omni/pyproject.toml index def4a2633..5e804a05c 100644 --- a/python-libraries/nanover-omni/pyproject.toml +++ b/python-libraries/nanover-omni/pyproject.toml @@ -8,7 +8,7 @@ authors = [ {name = "Intangible Realities Lab"}, ] description = "Multi-simulation server for NanoVer" -requires-python = ">=3.12" +requires-python = ">=3.11" dependencies = [ "nanover", "openmm", diff --git a/python-libraries/nanover-openmm/pyproject.toml b/python-libraries/nanover-openmm/pyproject.toml index 3bfa3d22a..5204466aa 100644 --- a/python-libraries/nanover-openmm/pyproject.toml +++ b/python-libraries/nanover-openmm/pyproject.toml @@ -8,7 +8,7 @@ authors = [ {name = "Intangible Realities Lab"}, ] description = "Multi-simulation server for NanoVer" -requires-python = ">=3.12" +requires-python = ">=3.11" dependencies = [ "nanover", "openmm",