Revert "Remove CI file from frame branch"

This reverts commit dac3632c28
This commit is contained in:
Joel Collins 2020-05-18 09:54:18 +00:00
parent e91b9bf356
commit 79259b3fc9
26 changed files with 224 additions and 60 deletions

1
.gitattributes vendored
View file

@ -1 +0,0 @@
openflexure_microscope/api/static/** filter=lfs diff=lfs merge=lfs -text

View file

@ -0,0 +1,73 @@
stages:
- build
- deploy
# Cache modules in between jobs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
# Electron app build
build:
stage: build
image: nikolaik/python-nodejs:python3.7-nodejs14
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- git submodule sync --recursive
- git submodule update --init --recursive
- curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
script:
# Install server
- $HOME/.poetry/bin/poetry install
# Run static build script
- $HOME/.poetry/bin/poetry run build_static
# Build distribution archive
- mkdir -p dist
- tar -c --exclude-vcs --exclude-from .tarignore -vzf dist/openflexure-microscope-server-${CI_COMMIT_REF_NAME}.tar.gz .
artifacts:
name: "dist"
expire_in: 1 week
paths:
- "./dist/*"
only:
- merge_requests
- tags
- web
# Deploy to builds.openflexure.org
deploy:
stage: deploy
dependencies:
- build
image: ubuntu:latest
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY_BATH_OPENFLEXURE_BASE64" | base64 --decode)
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
script:
# Install rsync if not already installed
- 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
# Upload the builds folder to openflexure-microscope builds
- rsync -hrvz -e ssh dist/ ci-user@openflexure.bath.ac.uk:/var/www/build/openflexure-microscope-server
# Run update-latest.py on the build server
- ssh -t ci-user@openflexure.bath.ac.uk "/var/www/build/update-latest.py"
only:
- tags
- web

4
.gitmodules vendored Normal file
View file

@ -0,0 +1,4 @@
[submodule "openflexure_microscope/api/static"]
path = openflexure_microscope/api/static
url = https://gitlab.com/openflexure/openflexure-microscope-jsclient.git
branch = frame

80
.tarignore Normal file
View file

@ -0,0 +1,80 @@
Distribution archive rules
node_modules
.gitlab-ci.yml
./dist
!openflexure_microscope/api/static/dist
.tarignore
# Pyenv files
.python-version
.venv*
.env*
# Byte-compiled / optimized / DLL files
__pycache__
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Pytho
env/
build
develop-eggs
downloads
eggs
lib
lib64
parts
sdist
var
*.egg-info
.installed.cfg
*.egg
pip-wheel-metadata
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov
.tox
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build
# PyBuilder
target
#Big-o files
capture
record
*.data
#IDE files
.vscode
.idea
activate
# UML diagrams
classes.png
packages.png

View file

@ -9,6 +9,15 @@ This includes basic installation instructions suitable for most users.
Full developer documentation can be found on [**ReadTheDocs**](https://openflexure-microscope-software.readthedocs.io/en/stable/). Full developer documentation can be found on [**ReadTheDocs**](https://openflexure-microscope-software.readthedocs.io/en/stable/).
This includes installing the server in a mode better suited for active development. This includes installing the server in a mode better suited for active development.
## Installation
* `git clone --recurse-submodules https://gitlab.com/openflexure/openflexure-microscope-server.git`
* `poetry install`
* `poetry run build_static`
### Distributing
* `mkdir -p dist`
* `tar -c --exclude-vcs --exclude-from .tarignore -vzf dist/openflexure-microscope-server.tar.gz .`
## Build-system ## Build-system
As of 1.0.0b0, we're using [Poetry](https://github.com/sdispater/poetry) to manage dependencies, build, and distribute the package. All package information and dependencies are found in `pyproject.toml`, in line with [PEP 518](https://www.python.org/dev/peps/pep-0518/). If you're developing this package, make use of `poetry.lock` to ensure you're using the latest locked dependency list. As of 1.0.0b0, we're using [Poetry](https://github.com/sdispater/poetry) to manage dependencies, build, and distribute the package. All package information and dependencies are found in `pyproject.toml`, in line with [PEP 518](https://www.python.org/dev/peps/pep-0518/). If you're developing this package, make use of `poetry.lock` to ensure you're using the latest locked dependency list.

View file

@ -65,8 +65,8 @@ app, labthing = create_app(
title=f"OpenFlexure Microscope {api_microscope.name}", title=f"OpenFlexure Microscope {api_microscope.name}",
description="Test LabThing-based API for OpenFlexure Microscope", description="Test LabThing-based API for OpenFlexure Microscope",
types=["org.openflexure.microscope"], types=["org.openflexure.microscope"],
version=pkg_resources.get_distribution("openflexure_microscope").version, version=pkg_resources.get_distribution("openflexure-microscope-server").version,
flask_kwargs={"static_url_path": ""}, flask_kwargs={"static_url_path": "", "static_folder": "static/dist"},
) )
# Enable CORS for some routes outside of LabThings # Enable CORS for some routes outside of LabThings

@ -0,0 +1 @@
Subproject commit df7169ba6833fa213f497ff71594dc4330af0792

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8605f70737729f74f48d3183b30b4a2f50706f4f750cd208aeb8c136253f7d01
size 772

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e68506e72389393d35cc47e5184459fff9a23bedea8c9ee96491f66c88e71954
size 1375875

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ee944cc13be0a52ce48a81a09c179dac70729bd7580a516ccc8ac10b4cfa3f98
size 1310

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:710327f8b3d83c83019ed2c4b27de8caf8e4e923c9148f93c1c0a2662f683f26
size 1659

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0405ef60ab42df1c2e8721bf1f500c8c7d9e1afae130307101b8f77925ffdac1
size 1150

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4a1baec300d09e03a8380b85918267ee80faae8e00c6c56b48e2e74b1d9b38d
size 57620

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a87d66c91b2e7dc5530aef76c03bd6a3d25ea5826110bf4803b561b811cc8726
size 44300

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b7f4a3ab562048f28dd1fa691601bc43363a61d0f876d16d8316c52e4f32d696
size 128180

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8c998b4a9c0acbb9fe5dd572c206a5a33fdd5ca2b58db87fc3b893beac85068d
size 143258

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:463bfdbd635ddff1d00df38b1149ffd3947b492d71cfb546549dffebd311b090
size 843

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a536bfa88fd1bf69284804285c5cf1da33cf05f164f175eb4085f7d057ff4f17
size 378133

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:996b19391845b7cf1810f1181d935aad524897763da4c36847c7715f762b63fa
size 1597950

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0a77d7d2e5e4220883bc1491a627435cc80d0b2574d51972bcd6b12add7a4a94
size 116850

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1404c938e8f60b1694dd48357d486d919f5b1e32c9f226ca26fc0ee399019542
size 395811

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:187e61d8f6171eebf611502412556c707fab1d837f8763b2b60ce3915303f0ad
size 1734

View file

@ -0,0 +1,14 @@
from pynpm import NPMPackage
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
pkg_path = os.path.join(dir_path, "api", "static", "package.json")
pkg = NPMPackage(pkg_path)
def install():
pkg.install()
def build():
pkg.install()
pkg.run_script('build')

View file

@ -15,7 +15,8 @@ from openflexure_microscope.stage.sanga import SangaStage
try: try:
from openflexure_microscope.camera.pi import PiCameraStreamer from openflexure_microscope.camera.pi import PiCameraStreamer
except ImportError: except Exception as e:
logging.error(e)
logging.warning("Unable to import PiCameraStreamer") logging.warning("Unable to import PiCameraStreamer")
from openflexure_microscope.camera.mock import MissingCamera from openflexure_microscope.camera.mock import MissingCamera

31
poetry.lock generated
View file

@ -389,19 +389,19 @@ six = "*"
category = "main" category = "main"
description = "A pure Python interface for the Raspberry Pi camera module." description = "A pure Python interface for the Raspberry Pi camera module."
name = "picamera" name = "picamera"
optional = true optional = false
python-versions = "*" python-versions = "*"
version = "1.13.2b0" version = "1.13.2b0"
[package.extras] [package.extras]
array = ["numpy"] array = ["numpy"]
doc = ["sphinx"] doc = ["sphinx"]
test = ["pillow", "coverage", "mock", "numpy", "pytest"] test = ["coverage", "pytest", "mock", "pillow", "numpy"]
[package.source] [package.source]
reference = "e50a34826fc8691e9f8554c529a1700662724ade" reference = ""
type = "git" type = "url"
url = "https://github.com/rwb27/picamera.git" url = "https://github.com/rwb27/picamera/releases/download/v1.13.2b0/picamera-1.13.2b0-py3-none-any.whl"
[[package]] [[package]]
category = "main" category = "main"
description = "Python Imaging Library (Fork)" description = "Python Imaging Library (Fork)"
@ -453,6 +453,19 @@ isort = ">=4.2.5,<5"
mccabe = ">=0.6,<0.7" mccabe = ">=0.6,<0.7"
toml = ">=0.7.1" toml = ">=0.7.1"
[[package]]
category = "main"
description = "Python interface to your NPM and package.json."
name = "pynpm"
optional = false
python-versions = "*"
version = "0.1.2"
[package.extras]
all = ["Sphinx (>=1.5.1)", "check-manifest (>=0.25)", "coverage (>=4.0)", "isort (>=4.2.2)", "pydocstyle (>=1.0.0)", "pytest-cache (>=1.0)", "pytest-cov (>=1.8.0)", "pytest-pep8 (>=1.0.6)", "pytest (>=2.8.0)"]
docs = ["Sphinx (>=1.5.1)"]
tests = ["check-manifest (>=0.25)", "coverage (>=4.0)", "isort (>=4.2.2)", "pydocstyle (>=1.0.0)", "pytest-cache (>=1.0)", "pytest-cov (>=1.8.0)", "pytest-pep8 (>=1.0.6)", "pytest (>=2.8.0)"]
[[package]] [[package]]
category = "dev" category = "dev"
description = "Python parsing module" description = "Python parsing module"
@ -744,10 +757,10 @@ version = "0.26.1"
ifaddr = "*" ifaddr = "*"
[extras] [extras]
rpi = ["picamera", "RPi.GPIO"] rpi = ["RPi.GPIO"]
[metadata] [metadata]
content-hash = "7fbc27aa162c3acb7f1775b974ed87d3261e4038e0999904e9d1cf0f80ec98a2" content-hash = "e62efd90867a69b3385fb417a0cd0a9124fb4d23a36177ebef27903b4e78eb77"
python-versions = "^3.6" python-versions = "^3.6"
[metadata.files] [metadata.files]
@ -1140,6 +1153,10 @@ pylint = [
{file = "pylint-2.5.2-py3-none-any.whl", hash = "sha256:dd506acce0427e9e08fb87274bcaa953d38b50a58207170dbf5b36cf3e16957b"}, {file = "pylint-2.5.2-py3-none-any.whl", hash = "sha256:dd506acce0427e9e08fb87274bcaa953d38b50a58207170dbf5b36cf3e16957b"},
{file = "pylint-2.5.2.tar.gz", hash = "sha256:b95e31850f3af163c2283ed40432f053acbc8fc6eba6a069cb518d9dbf71848c"}, {file = "pylint-2.5.2.tar.gz", hash = "sha256:b95e31850f3af163c2283ed40432f053acbc8fc6eba6a069cb518d9dbf71848c"},
] ]
pynpm = [
{file = "pynpm-0.1.2-py2.py3-none-any.whl", hash = "sha256:3f03fbf667549f8b8b7e0419eef88d1b21833ce288f96de66fbb761b9f4c4061"},
{file = "pynpm-0.1.2.tar.gz", hash = "sha256:8a6d3f9423760cf3c142db3bf9bda5a075e8a91837e7d2e2b0a3de5be5e26da2"},
]
pyparsing = [ pyparsing = [
{file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},

View file

@ -3,8 +3,8 @@ requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api" build-backend = "poetry.masonry.api"
[tool.poetry] [tool.poetry]
name = "openflexure_microscope" name = "openflexure-microscope-server"
version = "2.1.0-dev" version = "2.1.0-beta"
description = "Python module, and Flask-based web API, to run the OpenFlexure Microscope." description = "Python module, and Flask-based web API, to run the OpenFlexure Microscope."
authors = [ authors = [
@ -22,6 +22,12 @@ keywords = ['raspberry pi', 'arduino', 'microscope']
license = "GPL-3.0" license = "GPL-3.0"
exclude = ["**/node_modules/"]
packages = [
{ include = "openflexure_microscope" },
]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.6" python = "^3.6"
Flask = "^1.0" Flask = "^1.0"
@ -29,8 +35,9 @@ numpy = "1.18.2"
Pillow = "^5.4" Pillow = "^5.4"
scipy = "1.4.1" # Exact version so we can guarantee a wheel scipy = "1.4.1" # Exact version so we can guarantee a wheel
picamera = { git = "https://github.com/rwb27/picamera.git", branch = "master", optional = true } # Lens shading requires >1.14 or RWB fork, lens-shading branch.
"RPi.GPIO" = { version = "^0.6.5", optional = true } "RPi.GPIO" = { version = "^0.6.5", optional = true }
picamera = {url = "https://github.com/rwb27/picamera/releases/download/v1.13.2b0/picamera-1.13.2b0-py3-none-any.whl" }
pyserial = "^3.4" # Used for sangaboard (basic_serial_instrument) until we move to sangaboard pip library pyserial = "^3.4" # Used for sangaboard (basic_serial_instrument) until we move to sangaboard pip library
python-dateutil = "^2.8" python-dateutil = "^2.8"
@ -40,9 +47,13 @@ opencv-python-headless = [
{version = "4.2.0.34", python = "^3.8"} # Latest for Py38 systems {version = "4.2.0.34", python = "^3.8"} # Latest for Py38 systems
] ]
labthings = "0.6.1" labthings = "0.6.1"
pynpm = "^0.1.2"
[tool.poetry.extras] [tool.poetry.extras]
rpi = ["picamera", "RPi.GPIO"] rpi = ["RPi.GPIO"]
[tool.poetry.scripts]
build_static = 'openflexure_microscope.install:build'
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
sphinxcontrib-httpdomain = "^1.7" sphinxcontrib-httpdomain = "^1.7"