Skip to content

Commit

Permalink
Merge pull request #16 from bioio-devs/feature/upgrade-docs
Browse files Browse the repository at this point in the history
Upgrade docs
  • Loading branch information
SeanLeRoy authored Nov 29, 2023
2 parents 0bb4107 + ad6ae37 commit 8c1ae43
Show file tree
Hide file tree
Showing 15 changed files with 1,138 additions and 45 deletions.
293 changes: 293 additions & 0 deletions .gitchangelog.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
# -*- coding: utf-8; mode: python -*-
##
## Format
##
## ACTION: COMMIT_MSG [!TAG ...]
##
## Description
##
## ACTION is one of 'feature', 'bugfix', 'other'
##
## COMMIT_MSG is ... well ... the commit message itself.
##
## TAGs are additionnal adjective as 'refactor' 'minor' 'cosmetic'
##
## They are preceded with a '!' or a '@' (prefer the former, as the
## latter is wrongly interpreted in github.) Commonly used tags are:
##
## 'refactor' is obviously for refactoring code only
## 'minor' is for a very meaningless change (a typo, adding a comment)
## 'cosmetic' is for cosmetic driven change (re-indentation, 80-col...)
## 'wip' is for partial functionality but complete subfunctionality.
##
## Example:
##
## feature/use-dask
##
## Please note that multi-line commit message are supported, and only the
## first line will be considered as the "summary" of the commit message. So
## tags, and other rules only applies to the summary. The body of the commit
## message will be displayed in the changelog without reformatting.


##
## ``ignore_regexps`` is a line of regexps
##
## Any commit having its full commit message matching any regexp listed here
## will be ignored and won't be reported in the changelog.
##
ignore_regexps = [
r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$',
r'^[iI]ntial commit.?\s*$',
r'^$', ## ignore commits with empty messages
r'^Bump version: .*',
]


## ``section_regexps`` is a list of 2-tuples associating a string label and a
## list of regexp
##
## Commit messages will be classified in sections thanks to this. Section
## titles are the label, and a commit is classified under this section if any
## of the regexps associated is matching.
##
## Please note that ``section_regexps`` will only classify commits and won't
## make any changes to the contents. So you'll probably want to go check
## ``subject_process`` (or ``body_process``) to do some changes to the subject,
## whenever you are tweaking this variable.
##
section_regexps = [
('New', [
r'^[fF]eature.*$'
]),
('Fix', [
r'^[bB]ugfix.*$',
r'^[fF]ix.*$',
r'^[hH]otfix.*$',
]),
('Other', None), ## Match all lines
]


## ``body_process`` is a callable
##
## This callable will be given the original body and result will
## be used in the changelog.
##
## Available constructs are:
##
## - any python callable that take one txt argument and return txt argument.
##
## - ReSub(pattern, replacement): will apply regexp substitution.
##
## - Indent(chars=" "): will indent the text with the prefix
## Please remember that template engines gets also to modify the text and
## will usually indent themselves the text if needed.
##
## - Wrap(regexp=r"\n\n"): re-wrap text in separate paragraph to fill 80-Columns
##
## - noop: do nothing
##
## - ucfirst: ensure the first letter is uppercase.
## (usually used in the ``subject_process`` pipeline)
##
## - final_dot: ensure text finishes with a dot
## (usually used in the ``subject_process`` pipeline)
##
## - strip: remove any spaces before or after the content of the string
##
## - SetIfEmpty(msg="No commit message."): will set the text to
## whatever given ``msg`` if the current text is empty.
##
## Additionally, you can `pipe` the provided filters, for instance:
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ")
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)')
#body_process = noop
#body_process = ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip
body_process = ReSub(r'.*', '') | strip


## ``subject_process`` is a callable
##
## This callable will be given the original subject and result will
## be used in the changelog.
##
## Available constructs are those listed in ``body_process`` doc.
#subject_process = (strip |
# ReSub(r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') |
# SetIfEmpty("No commit message.") | ucfirst | final_dot)
subject_process = ReSub(
r'^(.*)(\ ?\(\#([0-9]+)\))$',
r'\1 (`#\3 <https://github.com/bioio-devs/bioio/pull/\3>`_)'
)
#subject_process = ReSub(r'.*', '')


## ``tag_filter_regexp`` is a regexp
##
## Tags that will be used for the changelog must match this regexp.
##
tag_filter_regexp = r'^v[0-9]+\.[0-9]+(\.[0-9]+)?$'


## ``unreleased_version_label`` is a string or a callable that outputs a string
##
## This label will be used as the changelog Title of the last set of changes
## between last valid tag and HEAD if any.
unreleased_version_label = "(unreleased)"


## ``output_engine`` is a callable
##
## This will change the output format of the generated changelog file
##
## Available choices are:
##
## - rest_py
##
## Legacy pure python engine, outputs ReSTructured text.
## This is the default.
##
## - mustache(<template_name>)
##
## Template name could be any of the available templates in
## ``templates/mustache/*.tpl``.
## Requires python package ``pystache``.
## Examples:
## - mustache("markdown")
## - mustache("restructuredtext")
##
## - makotemplate(<template_name>)
##
## Template name could be any of the available templates in
## ``templates/mako/*.tpl``.
## Requires python package ``mako``.
## Examples:
## - makotemplate("restructuredtext")
##
output_engine = rest_py
#output_engine = mustache("restructuredtext")
#output_engine = mustache("markdown")
#output_engine = makotemplate("restructuredtext")


## ``include_merge`` is a boolean
##
## This option tells git-log whether to include merge commits in the log.
## The default is to include them.
include_merge = False


## ``log_encoding`` is a string identifier
##
## This option tells gitchangelog what encoding is outputed by ``git log``.
## The default is to be clever about it: it checks ``git config`` for
## ``i18n.logOutputEncoding``, and if not found will default to git's own
## default: ``utf-8``.
#log_encoding = 'utf-8'


## ``publish`` is a callable
##
## Sets what ``gitchangelog`` should do with the output generated by
## the output engine. ``publish`` is a callable taking one argument
## that is an interator on lines from the output engine.
##
## Some helper callable are provided:
##
## Available choices are:
##
## - stdout
##
## Outputs directly to standard output
## (This is the default)
##
## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start())
##
## Creates a callable that will parse given file for the given
## regex pattern and will insert the output in the file.
## ``idx`` is a callable that receive the matching object and
## must return a integer index point where to insert the
## the output in the file. Default is to return the position of
## the start of the matched string.
##
## - FileRegexSubst(file, pattern, replace, flags)
##
## Apply a replace inplace in the given file. Your regex pattern must
## take care of everything and might be more complex. Check the README
## for a complete copy-pastable example.
##
#publish = stdout
OUTPUT_FILE = "docs/CHANGELOG.rst"
INSERT_POINT_REGEX = r'''(?isxu)
^
(
\s*Changelog\s*(\n|\r\n|\r) ## ``Changelog`` line
==+\s*(\n|\r\n|\r){2} ## ``=========`` rest underline
)
( ## Match all between changelog and release rev
(
(?!
(?<=(\n|\r)) ## look back for newline
%(rev)s ## revision
\s+
\([0-9]+-[0-9]{2}-[0-9]{2}\)(\n|\r\n|\r) ## date
--+(\n|\r\n|\r) ## ``---`` underline
)
.
)*
)
(?P<rev>%(rev)s)
''' % {'rev': r"v[0-9]+\.[0-9]+(\.[0-9]+)?"}

revs = [
Caret(FileFirstRegexMatch(OUTPUT_FILE, INSERT_POINT_REGEX)),
"HEAD"
]

publish = FileRegexSubst(OUTPUT_FILE, INSERT_POINT_REGEX, r"\1\o\g<rev>")


## ``revs`` is a list of callable or a list of string
##
## callable will be called to resolve as strings and allow dynamical
## computation of these. The result will be used as revisions for
## gitchangelog (as if directly stated on the command line). This allows
## to filter exaclty which commits will be read by gitchangelog.
##
## To get a full documentation on the format of these strings, please
## refer to the ``git rev-list`` arguments. There are many examples.
##
## Using callables is especially useful, for instance, if you
## are using gitchangelog to generate incrementally your changelog.
##
## Some helpers are provided, you can use them::
##
## - FileFirstRegexMatch(file, pattern): will return a callable that will
## return the first string match for the given pattern in the given file.
## If you use named sub-patterns in your regex pattern, it'll output only
## the string matching the regex pattern named "rev".
##
## - Caret(rev): will return the rev prefixed by a "^", which is a
## way to remove the given revision and all its ancestor.
##
## Please note that if you provide a rev-list on the command line, it'll
## replace this value (which will then be ignored).
##
## If empty, then ``gitchangelog`` will act as it had to generate a full
## changelog.
##
## The default is to use all commits to make the changelog.
#revs = ["^1.0.3", ]

# revs = [
# Caret(
# FileFirstRegexMatch(
# "docs/CHANGELOG.rst",
# r"(?P<rev>v[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n")),
# "HEAD"
# ]

revs = []
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
pip install .[docs]
- name: Generate Docs
run: |
gitchangelog
just generate-docs
touch docs/_build/.nojekyll
- name: Publish Docs
Expand Down
57 changes: 38 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,52 @@
# bioio
# BioIO

[![Build Status](https://github.com/bioio-devs/bioio/actions/workflows/ci.yml/badge.svg)](https://github.com/bioio-devs/bioio/actions)
[![Documentation](https://github.com/bioio-devs/bioio/actions/workflows/docs.yml/badge.svg)](https://bioio-devs.github.io/bioio)
[![PyPI version](https://badge.fury.io/py/bioio.svg)](https://badge.fury.io/py/bioio)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Python 3.9+](https://img.shields.io/badge/python-3.9,3.10,3.11-blue.svg)](https://www.python.org/downloads/release/python-390/)


Image reading, metadata management, and image writing for Microscopy images in Python
Image Reading, Metadata Conversion, and Image Writing for Microscopy Images in Pure Python

---

## Installation

**Stable Release:** `pip install bioio`<br>
**Development Head:** `pip install git+https://github.com/bioio-devs/bioio.git`

## Quickstart

```python
from bioio import example
## Documentation

print(example.str_len("hello")) # prints 5
```
[See the full documentation on our GitHub pages site](https://bioio-devs.github.io/bioio/OVERVIEW.html)

## Documentation
## Example Usage (see full documentation for more examples)

For full package documentation please visit [bioio-devs.github.io/bioio](https://bioio-devs.github.io/bioio).
Install bioio alongside OME TIFF and OME ZARR plug-ins with pip (this example won't use the OME ZARR plug-in):

## Development
`pip install bioio bioio-ome-tiff bioio-ome-zarr`

See [CONTRIBUTING.md](CONTRIBUTING.md) for information related to developing the code.
```python
from bioio import BioImage

# Get a BioImage object
img = BioImage("my_file.tiff") # selects the first scene found
img.data # returns 5D TCZYX numpy array
img.xarray_data # returns 5D TCZYX xarray data array backed by numpy
img.dims # returns a Dimensions object
img.dims.order # returns string "TCZYX"
img.dims.X # returns size of X dimension
img.shape # returns tuple of dimension sizes in TCZYX order
img.get_image_data("CZYX", T=0) # returns 4D CZYX numpy array

# Get the id of the current operating scene
img.current_scene

# Get a list valid scene ids
img.scenes

# Change scene using name
img.set_scene("Image:1")
# Or by scene index
img.set_scene(1)

# Use the same operations on a different scene
# ...
```

**BSD License**
## Issues
[_Click here to view all open issues in bioio-devs organization at once_](https://github.com/search?q=user%3Abioio-devs+is%3Aissue+is%3Aopen&type=issues&ref=advsearch)
6 changes: 1 addition & 5 deletions bioio/writers/timeseries_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ class TimeseriesWriter(Writer):
"""
A writer for timeseries Greyscale, RGB, or RGBA image data.
Primarily directed at formats: "gif", "mp4", "mkv", etc.
Notes
-----
To use this writer, install with: `pip install aicsimageio[base-imageio]`.
"""

_TIMEPOINT_DIMENSIONS = [
Expand Down Expand Up @@ -124,7 +120,7 @@ def save(
a non-time dimension. For example, creating a timeseries image where each frame
is a Z-plane from a source volumetric image as seen below.
>>> image = AICSImageIO("some_z_stack.ome.tiff")
>>> image = BioImage("some_z_stack.ome.tiff")
... TimeseriesWriter.save(
... data=image.get_image_data("ZYX", T=0, C=0),
... uri="some_z_stack.mp4",
Expand Down
Loading

0 comments on commit 8c1ae43

Please sign in to comment.