diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6866505f..db7edcc7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,14 +21,13 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.12" + python-version-file: "pyproject.toml" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install -e .[dev] make - pip install -e . - name: Run tests with pytest run: | @@ -47,19 +46,20 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.12" + python-version-file: "pyproject.toml" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - make pip install -e . - + make + + - name: Run examples + run: | synapse-sim --iface-ip 127.0.0.1 --rpc-port 50051 & sleep 2 python synapse/examples/stream_out.py 127.0.0.1:50051 - kill $(jobs -p) + kill $(jobs -p) \ No newline at end of file diff --git a/.gitignore b/.gitignore index dbe68da1..825b1f54 100644 --- a/.gitignore +++ b/.gitignore @@ -97,7 +97,7 @@ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: -# .python-version +.python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. diff --git a/.python-version b/.python-version deleted file mode 100644 index 2c073331..00000000 --- a/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.11 diff --git a/README.md b/README.md index 7640b072..7e729426 100644 --- a/README.md +++ b/README.md @@ -158,14 +158,16 @@ For an example, see the [Blackrock Neurotech CerePlex driver](https://github.com Dependencies: git submodule update --init - pip install -r requirements.txt + pip install . ./setup.sh all # or make all To build and install in development mode: - pip install -e . + git submodule update --init + pip install -e .[dev] + make To build and install a wheel: @@ -176,6 +178,13 @@ To build and install a wheel: ## Development +It is highly recommened setting up a [virtual python environment](https://docs.python.org/3/library/venv.html) if you are actively developing this repo: +```bash +python -m venv .venv + +source .venv/bin/activate +``` + If you want to catch linting errors before pushing, you can install a pre-commit hook. ```bash diff --git a/pyproject.toml b/pyproject.toml index fa9ae8d7..edf572cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,47 @@ +[project] +name = "science-synapse" +version = "2.0.0" +description = "Client library and CLI for the Synapse API" +authors = [{name = "Science Team", email = "team@science.xyz"}] +readme = "README.md" +license = "Apache-2.0" +license-files = ["LICENSE"] + +requires-python = ">=3.9" +dependencies = [ + "build>=1.2.2.post1", + "coolname>=2.2.0", + "crcmod>=1.7", + "dearpygui>=2.0.0", + "grpcio>=1.71.0", + "grpcio-tools>=1.71.0", + "numpy>=2.0.0", + "pandas>=2.2.0", + "paramiko >=3.5.1", + "protobuf>=5.29", + "protoletariat>=3.3.9", + "pyqt5>=5.15.11", + "pyqtgraph>=0.13.7", + "pyserial>=3.5", + "pyyaml>=6.0", + "pyzmq>=26.3.0", + "rich>=13.9.4", + "scipy>=1.13.1", +] + +[project.optional-dependencies] +dev = [ + "ruff>=0.9.10", + "pre-commit>=4.1.0", + "pytest>=8.3.5", + "pytest-asyncio>=0.25.3", +] + [build-system] -requires = ["setuptools", "wheel", "Cython", "crcmod"] +requires = ["setuptools", "wheel", "Cython"] build-backend = "setuptools.build_meta" + + +[project.scripts] +synapsectl = "synapse.cli:main" +synapse-sim = "synapse.simulator:main" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 33460f19..00000000 --- a/requirements.txt +++ /dev/null @@ -1,22 +0,0 @@ -coolname -grpcio -grpcio-tools -protoletariat -paramiko>=3.5.1 -pyserial -pyzmq -build -scipy -cython -rich -pre-commit -pytest -pytest-asyncio -dearpygui -pyqtgraph -pyqt5 -pyyaml -pandas>=2.2.0 -protobuf>=5.29 -numpy >=2.0.0 -crcmod diff --git a/setup.py b/setup.py index 983fd894..3daaddf7 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ -from setuptools import setup, find_packages, Extension +from setuptools import setup, Extension from Cython.Build import cythonize -from pathlib import Path import os extra_compile_args = [] @@ -13,9 +12,6 @@ "-O3", ] -this_directory = Path(__file__).parent -long_description = (this_directory / "README.md").read_text() - extensions = [ Extension( "synapse.utils.ndtp", @@ -25,40 +21,8 @@ ] setup( - name="science-synapse", - version="2.0.0", - description="Client library and CLI for the Synapse API", - author="Science Team", - author_email="team@science.xyz", - packages=find_packages(include=["synapse", "synapse.*"]), - long_description=long_description, - long_description_content_type="text/markdown", ext_modules=cythonize( extensions, compiler_directives={"language_level": "3"}, ), - python_requires=">=3.9", - install_requires=[ - "coolname", - "grpcio-tools", - "protoletariat", - "numpy >=2.0.0", - "pyserial", - "scipy", - "crcmod", - "rich", - "pyqtgraph", - "pyqt5", - "pandas >=2.2.0", - "dearpygui", - "pyzmq", - "pyyaml", - "paramiko >=3.5.1" - ], - entry_points={ - "console_scripts": [ - "synapsectl = synapse.cli:main", - "synapse-sim = synapse.simulator:main", - ], - }, )