diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a34835a6..3ce2355f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,8 @@ name: CI on: push: - # branches: - # - main + branches: + - main pull_request: branches: - main @@ -14,32 +14,12 @@ concurrency: cancel-in-progress: true jobs: - ci: - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash -l {0} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + ci-pip: + runs-on: windows-latest steps: - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/setup-python@v4 with: python-version: 3.8 - mamba-version: "*" - channels: conda-forge,defaults - channel-priority: true - activate-environment: motor_task_prototype - environment-file: environment.yml - - run: | - conda info - conda list - conda config --show-sources - conda config --show - printenv | sort - run: pip install -e .[tests] --verbose - - run: python -m pytest --cov=motor_task_prototype --cov-report=xml -v \ No newline at end of file + - run: python -m pytest -v diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..aeb993ac --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,35 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: requirements-txt-fixer + - id: mixed-line-ending + - id: check-toml + + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + - id: black-jupyter + + - repo: https://github.com/kynan/nbstripout + rev: 0.5.0 + hooks: + - id: nbstripout + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.6.2 + hooks: + - id: prettier + additional_dependencies: + - prettier@2.3.2 + - "prettier-plugin-toml" + + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.16.0 + hooks: + - id: check-github-workflows + - id: check-readthedocs diff --git a/README.md b/README.md index 6f2c0740..3f344638 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,36 @@ # motor-task-prototype + Prototype for motor task application + +## Installation + +### Pre-requisites + +The only dependency is [psychopy](https://www.psychopy.org/index.html). +Unfortunately, psychopy itself has a lot of dependencies, some of which are system libraries. + +- on Ubuntu 22.04 with Python 3.10 I needed to do + - `sudo apt-get install swig libasound2-dev portaudio19-dev libpulse-dev libusb-1.0-0-dev libsndfile1-dev libportmidi-dev liblo-dev libgtk-3-dev` + - `pip install wxPython` (which took a long time to complete) +- on windows + - with python 3.8 pip install on CI just worked without any further dependencies + - note: this has not been verified on a clean Windows machine + +### User installation + +To install using pip: + +``` +pip install git+https://github.com/ssciwr/motor-task-prototype +``` + +### Developer install + +To clone the repo, make an editable installation and run the tests: + +``` +git clone https://github.com/ssciwr/motor-task-prototype.git +cd motor-task-prototype +pip install -e .[tests] +pytest +``` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e5fe94b3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "motor_task_prototype" +description = "Motor task prototype" +readme = "README.md" +license = { text = "MIT" } +authors = [{ name = "Liam Keegan", email = "ssc@iwr.uni-heidelberg.de" }] +requires-python = ">=3.6" +classifiers = [ + "Topic :: Scientific/Engineering :: Bio-Informatics", + "License :: OSI Approved :: MIT License", + "Intended Audience :: Science/Research", + "Intended Audience :: Education", + "Natural Language :: English", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "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", + "Programming Language :: Python :: 3.10", +] +dependencies = ["psychopy", "numpy"] +dynamic = ["version"] + +[project.urls] +Github = "https://github.com/ssciwr/motor-task-prototype" +Issues = "https://github.com/ssciwr/motor-task-prototype/issues" + +[project.optional-dependencies] +tests = ["pytest", "pytest-cov"] +docs = ["sphinx>=4.5.0", "sphinx_rtd_theme>=1.0.0"] + +[tool.setuptools.dynamic] +version = { attr = "motor_task_prototype.__version__" } + +[tool.pytest.ini_options] +testpaths = ["tests"] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..e69de29b diff --git a/src/motor_task_prototype/__init__.py b/src/motor_task_prototype/__init__.py new file mode 100644 index 00000000..f102a9ca --- /dev/null +++ b/src/motor_task_prototype/__init__.py @@ -0,0 +1 @@ +__version__ = "0.0.1" diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_psychopy.py b/tests/test_psychopy.py new file mode 100644 index 00000000..f7212309 --- /dev/null +++ b/tests/test_psychopy.py @@ -0,0 +1,9 @@ +from psychopy.gui import DlgFromDict +from psychopy.visual import Window +from psychopy.core import Clock, quit, wait +from psychopy.event import Mouse +from psychopy.hardware.keyboard import Keyboard + + +def test_psychopy(): + return