Skip to content

Commit 3a52887

Browse files
merge master -Dorg -Ssuccess-only: PR 187 (Rtd)
2 parents 0ce3845 + 743084b commit 3a52887

31 files changed

+993
-603
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ values =
1818
[bumpversion:part:build]
1919

2020
[bumpversion:file:setup.py]
21+
[bumpversion:file:docs/conf.py]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
*.pyc
44
.gitignore
55
*.DS_Store*
6+
docs/_build

.readthedocs.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Required
2+
version: 2
3+
4+
build:
5+
os: "ubuntu-22.04"
6+
tools:
7+
python: "3.11"
8+
9+
# Build documentation in the docs/ directory with Sphinx
10+
sphinx:
11+
configuration: docs/conf.py
12+
13+
14+
python:
15+
install:
16+
- requirements: docs/requirements.txt

README.rst

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
.. image:: https://github.com/ome/omero-scripts/workflows/OMERO/badge.svg
22
:target: https://github.com/ome/omero-scripts/actions
33

4+
.. image:: https://github.com/ome/omero-scripts/workflows/sphinx/badge.svg
5+
:target: https://github.com/ome/omero-scripts/actions
6+
47
.. image:: https://badge.fury.io/py/omero-scripts.svg
58
:target: https://badge.fury.io/py/omero-scripts
69

@@ -12,34 +15,37 @@ OMERO.scripts API. All scripts (e.g. ``*.py``) present in the
1215
directory will be automatically distributed with all binary
1316
builds. Which file-endings will be detected and how they
1417
will be launched are both configured centrally in the server.
15-
``.py``, ``.jy", and ``.m`` (MATLAB) files should all be detected
18+
``.py``, ``.jy``, and ``.m`` (MATLAB) files should all be detected
1619
by default starting with OMERO 5.
1720

1821

1922
Categories
20-
----------
23+
==========
2124

2225
Scripts are separated into several categories, one per directory.
2326

24-
| In the directory | should be scripts which ... |
25-
| ---------------- | --------------------- |
27+
+------------------------+-------------------------------------------------------------------------------+
28+
| Directory | Description |
29+
+========================+===============================================================================+
2630
| **analysis_scripts** | crunch images to produce numerical results and similar tasks |
31+
+------------------------+-------------------------------------------------------------------------------+
2732
| **export_scripts** | take one or more images as an input, and produce a representation for exchange|
33+
+------------------------+-------------------------------------------------------------------------------+
2834
| **figure_scripts** | take one or more images as an input, and produce a summary representation |
29-
| **hcs_scripts** | work with screens/plates/wells rather than just images |
35+
+------------------------+-------------------------------------------------------------------------------+
3036
| **import_scripts** | are run on images after import for extra processing |
31-
| **processing_scripts** | create new images from existing images or other data |
32-
| **setup_scripts** | are executed once, often by administrators, to configure OMERO itself |
37+
+------------------------+-------------------------------------------------------------------------------+
3338
| **util_scripts** | perform other miscellaneous tasks like cleaning up or optimizing OMERO itself |
39+
+------------------------+-------------------------------------------------------------------------------+
3440

3541

3642
Scripts which would like to rely on other scripts can
37-
use:
43+
use::
3844

3945
import omero.<sub_dir>.<script_name>
4046

4147
For this to work, the official script in question must
42-
be properly importable, i.e.:
48+
be properly importable, i.e.::
4349

4450
def run():
4551
client = omero.scripts.client(...)
@@ -49,28 +55,54 @@ be properly importable, i.e.:
4955

5056

5157
OMERO User Scripts
52-
------------------
58+
==================
5359

5460
If you would like to provide your own scripts for others to install
55-
into their OMERO installations, please see http://openmicroscopy.org/info/scripts
61+
into their OMERO installations, please see https://openmicroscopy.org/info/scripts
5662

5763

5864
Testing
59-
-------
65+
=======
6066

6167
Integration tests under ``test/`` require an OMERO server with scripts installed.
6268
The tests are run by Travis for open PRs using omero-test-infra to deploy OMERO
6369
via Docker containers.
6470

65-
To run tests locally:
71+
To run tests locally::
6672

6773
# All tests
6874
$ python setup.py test
6975

7076
# Single test in a single file
7177
$ python setup.py test -t test/integration/test_util_scripts.py -k test_dataset_to_plate
7278

79+
Usage
80+
=====
81+
82+
See https://omero-scripts.readthedocs.io/en/stable/
83+
84+
Release process
85+
===============
86+
87+
This repository uses `bump2version <https://pypi.org/project/bump2version/>`_ to manage version numbers.
88+
To tag a release run::
89+
90+
$ bumpversion release
91+
92+
This will remove the ``.dev0`` suffix from the current version, commit, and tag the release.
93+
94+
To switch back to a development version run::
95+
96+
$ bumpversion --no-tag [major|minor|patch]
97+
98+
specifying ``major``, ``minor`` or ``patch`` depending on whether the development branch will be a `major, minor or patch release <https://semver.org/>`_. This will also add the ``.dev0`` suffix.
99+
100+
Remember to ``git push`` all commits and tags.s essential.
101+
102+
The CI pipeline will automatically deploy the tag onto PyPI.
103+
104+
73105
Copyright
74-
---------
106+
=========
75107

76-
2010-2020, The Open Microscopy Environment
108+
2010-2021, The Open Microscopy Environment

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/analysis_scripts.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Analysis scripts
2+
================
3+
4+
Kymograph
5+
---------
6+
7+
.. automodule:: Kymograph
8+
:members:
9+
10+
11+
Kymograph Analysis
12+
------------------
13+
14+
.. automodule:: Kymograph_Analysis
15+
:members:
16+
17+
18+
Plot Profile
19+
------------
20+
21+
.. automodule:: Plot_Profile
22+
:members:

docs/conf.py

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
from datetime import datetime
8+
import os
9+
import sys
10+
from sphinx.util import logging
11+
logger = logging.getLogger(__name__)
12+
13+
14+
# -- Path setup --------------------------------------------------------------
15+
16+
# If extensions (or modules to document with autodoc) are in another directory,
17+
# add these directories to sys.path here. If the directory is relative to the
18+
# documentation root, use os.path.abspath to make it absolute, like shown here.
19+
#
20+
def get_scripts(directory):
21+
"""
22+
Find all the scripts available
23+
"""
24+
scripts = []
25+
26+
# Walk the tree.
27+
for root, directories, files in os.walk(directory):
28+
for filename in files:
29+
if filename.endswith(".py") and "_init_" not in filename:
30+
scripts.append(filename.replace('\n', '').replace(".py", ""))
31+
32+
return scripts
33+
34+
35+
def find_scripts_entry(file_name):
36+
"""
37+
Find the entries corresponding to the scripts.
38+
"""
39+
40+
with open(file_name) as file:
41+
lines = file.readlines()
42+
43+
entries = []
44+
for line in lines:
45+
if "automodule" in line:
46+
values = line.split(".. automodule::")
47+
entries.append(values[1].replace('\n', '').strip())
48+
return entries
49+
50+
51+
def compare(list1, list2):
52+
"""
53+
Return the elements not common to both lists
54+
"""
55+
return [i for i in list1 + list2 if i not in list1 or i not in list2]
56+
57+
58+
# List of directories to scan and add the path.
59+
directories = ['../omero/analysis_scripts', '../omero/export_scripts',
60+
'../omero/figure_scripts', '../omero/import_scripts',
61+
'../omero/util_scripts']
62+
63+
scripts = []
64+
entries = []
65+
for d in directories:
66+
sys.path.insert(0, d)
67+
scripts.extend(get_scripts(d))
68+
p = d.split("/")
69+
name = "%s.rst" % (p[len(p) - 1])
70+
entries.extend(find_scripts_entry(name))
71+
72+
# Indicate the scripts not listed for documentation
73+
if len(entries) < len(scripts):
74+
common = compare(scripts, entries)
75+
logger.warning("automodule entries missing for:\n" + '\n'.join(common))
76+
77+
# -- Project information -----------------------------------------------------
78+
79+
# The master toctree document.
80+
master_doc = 'index'
81+
82+
project = u'omero scripts'
83+
now = datetime.now()
84+
author = u'Open Microscopy Environment'
85+
copyright = u'2016-%d, %s ' % (now.year, author)
86+
87+
# The full version, including alpha/beta/rc tags
88+
# The short X.Y version.
89+
version = '5.6.2.dev0'
90+
release = version
91+
92+
93+
# -- General configuration ---------------------------------------------------
94+
95+
extlinks = {}
96+
97+
# Add any Sphinx extension module names here, as strings. They can be
98+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
99+
# ones.
100+
extensions = [
101+
'sphinx.ext.autodoc',
102+
'sphinx.ext.extlinks',
103+
'sphinx_rtd_theme',
104+
]
105+
106+
# Add any paths that contain templates here, relative to this directory.
107+
templates_path = ['_templates']
108+
109+
# List of patterns, relative to source directory, that match files and
110+
# directories to ignore when looking for source files.
111+
# This pattern also affects html_static_path and html_extra_path.
112+
exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store']
113+
114+
# Build docs without external dependencies
115+
autodoc_mock_imports = ['numpy', 'omero-py', 'omero', "PIL"]
116+
117+
# The name of the Pygments (syntax highlighting) style to use.
118+
pygments_style = 'sphinx'
119+
120+
# -- Options for HTML output -------------------------------------------------
121+
122+
# The theme to use for HTML and HTML Help pages. See the documentation for
123+
# a list of builtin themes.
124+
#
125+
html_theme = 'default'
126+
127+
# Add any paths that contain custom static files (such as style sheets) here,
128+
# relative to this directory. They are copied after the builtin static files,
129+
# so a file named "default.css" will overwrite the builtin "default.css".
130+
html_static_path = []
131+
132+
# Grouping the document tree into LaTeX files. List of tuples
133+
# (source start file, target name, title,
134+
# author, documentclass [howto, manual, or own class]).
135+
latex_documents = [
136+
(master_doc, 'OMEROScripts.tex', u'OMERO Scripts Documentation',
137+
author, 'manual'),
138+
]
139+
140+
141+
# -- Options for manual page output ------------------------------------------
142+
143+
# One entry per manual page. List of tuples
144+
# (source start file, name, description, authors, manual section).
145+
man_pages = [
146+
(master_doc, 'omeroscripts', u'OMERO Scripts Documentation',
147+
[author], 1)
148+
]
149+
150+
151+
# -- Options for Texinfo output ----------------------------------------------
152+
153+
# Grouping the document tree into Texinfo files. List of tuples
154+
# (source start file, target name, title, author,
155+
# dir menu entry, description, category)
156+
texinfo_documents = [
157+
(master_doc, 'OMEROScripts', u'OMERO Script Documentation',
158+
author, 'OMEROScripts', 'One line description of project.',
159+
'Miscellaneous'),
160+
]
161+
162+
163+
# -- Options for Epub output -------------------------------------------------
164+
165+
# Bibliographic Dublin Core info.
166+
epub_title = project
167+
168+
# The unique identifier of the text. This can be a ISBN number
169+
# or the project homepage.
170+
#
171+
# epub_identifier = ''
172+
173+
# A unique identification for the text.
174+
#
175+
# epub_uid = ''
176+
177+
# A list of files that should not be packed into the epub file.
178+
epub_exclude_files = ['search.html']

docs/export_scripts.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Export scripts
2+
==============
3+
4+
5+
Batch Image Export
6+
------------------
7+
8+
.. automodule:: Batch_Image_Export
9+
:members:
10+
11+
Batch ROI Export
12+
----------------
13+
14+
.. automodule:: Batch_ROI_Export
15+
:members:
16+
17+
Make Movie
18+
----------
19+
20+
.. automodule:: Make_Movie
21+
:members:

0 commit comments

Comments
 (0)