Skip to content

Commit

Permalink
initial framework
Browse files Browse the repository at this point in the history
- pyproject.toml to allow pip install
- ci: initially using pip on windows only
- pytest test that just checks that we can import psychopy
- add install instructions to readme
- add pre-commit config
  • Loading branch information
lkeegan committed Jul 14, 2022
1 parent 73192b3 commit 99be363
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 26 deletions.
32 changes: 6 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: CI

on:
push:
# branches:
# - main
branches:
- main
pull_request:
branches:
- main
Expand All @@ -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
- run: python -m pytest -v
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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:
- [email protected]
- "prettier-plugin-toml"

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.16.0
hooks:
- id: check-github-workflows
- id: check-readthedocs
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]" }]
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"]
Empty file added setup.cfg
Empty file.
1 change: 1 addition & 0 deletions src/motor_task_prototype/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.0.1"
Empty file added tests/__init__.py
Empty file.
9 changes: 9 additions & 0 deletions tests/test_psychopy.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 99be363

Please sign in to comment.