Skip to content

Commit

Permalink
Merge branch 'release/v0.1.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Nov 3, 2019
2 parents d4c5541 + e871dc9 commit de35069
Showing 14 changed files with 309 additions and 70 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,3 +5,4 @@
.coverage
.idea
__pycache__
poetry.lock
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.8
hooks:
- id: flake8
exclude: examples
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.23.0
hooks:
- id: yapf
51 changes: 51 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others’ private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities


Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement


Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting Thomas Mansencal and Michael Mauderer via email at thomas.mansencal@gmail.com and michael@mauderer.me respectively. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.

## Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct.html][homepage].

For answers to common questions about this code of conduct, see [https://www.contributor-covenant.org/faq][faq].


[homepage]: https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[faq]: https://www.contributor-covenant.org/faq
6 changes: 3 additions & 3 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -12,6 +12,6 @@ About
-----

| **Colour - Dash** by Colour Developers
| Copyright © 2018 – Colour Developers – `colour-science@googlegroups.com <colour-science@googlegroups.com>`_
| This software is released under terms of New BSD License: http://opensource.org/licenses/BSD-3-Clause
| `http://github.com/colour-science/colour-dash <http://github.com/colour-science/colour-dash>`_
| Copyright © 2018-2019 – Colour Developers – `colour-science@googlegroups.com <colour-science@googlegroups.com>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-dash <https://github.com/colour-science/colour-dash>`__
20 changes: 8 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
FROM continuumio/miniconda
FROM python:3.6

RUN apt-get update
WORKDIR /tmp
COPY ./requirements.txt /tmp
RUN pip install -r requirements.txt \
&& rm /tmp/requirements.txt

RUN /opt/conda/bin/conda install -y -c conda-forge colour-science
RUN pip install \
dash \
dash-core-components \
dash-html-components \
dash-renderer \
gunicorn \
plotly
ARG CACHE_DATE

RUN mkdir -p /home/dash/colour-dash
WORKDIR /home/dash/colour-dash
COPY . /home/dash/colour-dash

CMD sh -c 'if [ -z "${SSL_CERTIFICATE}" ]; then \
gunicorn -b 0.0.0.0:8000 index:SERVER; else \
gunicorn --certfile "${SSL_CERTIFICATE}" --keyfile "${SSL_KEY}" -b 0.0.0.0:8000 index:SERVER; fi'
gunicorn --log-level debug -b 0.0.0.0:8000 index:SERVER; else \
gunicorn --certfile "${SSL_CERTIFICATE}" --keyfile "${SSL_KEY}" --log-level debug -b 0.0.0.0:8000 index:SERVER; fi'
24 changes: 13 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@ Colour - Dash
Introduction
------------

Various colour science `Dash <https://dash.plot.ly/>`_ apps built on top of
`Colour <https://github.com/colour-science/colour>`_.
Various colour science `Dash <https://dash.plot.ly/>`__ apps built on top of
`Colour <https://github.com/colour-science/colour>`__.

Installation
------------
@@ -36,17 +36,19 @@ Development

.. code-block:: bash
$ conda create -y -n python-colour-dash
$ source activate python-colour-dash
$ conda install -y -c conda-forge colour-science
$ conda install invoke
$ pip install dash dash-core-components dash-html-components dash-renderer plotly
$ python index.py
$ poetry install
$ poetry run invoke docker-run
Code of Conduct
---------------

The *Code of Conduct*, adapted from the `Contributor Covenant 1.4 <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>`__,
is available on the `Code of Conduct <https://www.colour-science.org/code-of-conduct/>`__ page.

About
-----

| **Colour - Dash** by Colour Developers
| Copyright © 2018 – Colour Developers – `colour-science@googlegroups.com <colour-science@googlegroups.com>`_
| This software is released under terms of New BSD License: http://opensource.org/licenses/BSD-3-Clause
| `http://github.com/colour-science/colour-dash <http://github.com/colour-science/colour-dash>`_
| Copyright © 2018-2019 – Colour Developers – `colour-science@googlegroups.com <colour-science@googlegroups.com>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-dash <https://github.com/colour-science/colour-dash>`__
12 changes: 6 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@
from flask import Flask

__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2018 - Colour Developers'
__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause'
__copyright__ = 'Copyright (C) 2018-2019 - Colour Developers'
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
__maintainer__ = 'Colour Developers'
__email__ = 'colour-science@googlegroups.com'
__status__ = 'Production'
@@ -21,7 +21,7 @@

__major_version__ = '0'
__minor_version__ = '1'
__change_version__ = '9'
__change_version__ = '10'
__version__ = '.'.join(
(__major_version__,
__minor_version__,
@@ -33,21 +33,21 @@
"""
*Flask* server hosting the *Dash* app.
SERVER : Flask
SERVER : Flask
"""

SERVER_URL = os.environ.get('COLOUR_DASH_SERVER')
"""
Server url used to construct permanent links for the individual apps.
SERVER_URL : unicode
SERVER_URL : unicode
"""

APP = dash.Dash(__application_name__, server=SERVER)
"""
*Dash* app.
APP : Dash
APP : Dash
"""

APP.config['suppress_callback_exceptions'] = True
17 changes: 11 additions & 6 deletions apps/common.py
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
import colour

__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2018 - Colour Developers'
__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause'
__copyright__ = 'Copyright (C) 2018-2019 - Colour Developers'
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
__maintainer__ = 'Colour Developers'
__email__ = 'colour-science@googlegroups.com'
__status__ = 'Production'
@@ -28,7 +28,7 @@
"""
*RGB* colourspace options for a :class:`Dropdown` class instance.
RGB_COLOURSPACES_OPTIONS : list
RGB_COLOURSPACES_OPTIONS : list
"""

CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS = [{
@@ -39,7 +39,7 @@
*Chromatic adaptation transform* options for a :class:`Dropdown` class
instance.
CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS : list
CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS : list
"""

ILLUMINANTS_OPTIONS = [{
@@ -51,7 +51,7 @@
*CIE 1931 2 Degree Standard Observer* illuminant options for a
:class:`Dropdown`class instance.
ILLUMINANTS_OPTIONS : list
ILLUMINANTS_OPTIONS : list
"""

NUKE_COLORMATRIX_NODE_TEMPLATE = """
@@ -90,7 +90,12 @@ def nuke_format_matrix(M, decimals=10):
*The Foundry Nuke* formatted matrix.
"""

pretty = lambda x: ' '.join(map('{{: 0.{0}f}}'.format(decimals).format, x))
def pretty(x):
"""
Prettify given number.
"""

return ' '.join(map('{{: 0.{0}f}}'.format(decimals).format, x))

tcl = '{{{0}}}\n'.format(pretty(M[0]))
tcl += ' {{{0}}}\n'.format(pretty(M[1]))
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# -*- coding: utf-8 -*-
"""
RGB Colourspace Models Chromatically Adapted Primaries Application
==================================================================
RGB Colourspace Chromatically Adapted Primaries Application
===========================================================
"""

from __future__ import division, unicode_literals

import numpy as np
import urlparse
import sys
import urllib.parse
from dash.dependencies import Input, Output
from dash_core_components import Dropdown, Link, Markdown, Slider, Textarea
from dash_core_components import Dropdown, Link, Markdown, Slider
from dash_html_components import A, Code, Div, H3, H5, Li, Pre, Ul

import colour
@@ -19,8 +19,8 @@
ILLUMINANTS_OPTIONS, RGB_COLOURSPACES_OPTIONS)

__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2018 - Colour Developers'
__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause'
__copyright__ = 'Copyright (C) 2018-2019 - Colour Developers'
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
__maintainer__ = 'Colour Developers'
__email__ = 'colour-science@googlegroups.com'
__status__ = 'Production'
@@ -30,7 +30,7 @@
'set_primaries_output'
]

APP_NAME = 'RGB Colourspace Models Chromatically Adapted Primaries'
APP_NAME = 'RGB Colourspace Chromatically Adapted Primaries'
"""
App name.
@@ -46,8 +46,8 @@

APP_DESCRIPTION = ('This app computes the '
'*Chromatically Adapted Primaries* of the given '
'*RGB Colourspace Model* to the given *Illuminant*'
' using the given *Chromatic Adaptation Transform*.')
'*RGB Colourspace* to the given *Illuminant* using the '
'given *Chromatic Adaptation Transform*.')
"""
App description.
@@ -116,7 +116,7 @@
className='list-inline-item'),
Li([
A('Permalink',
href=urlparse.urljoin(SERVER_URL, APP_PATH),
href=urllib.parse.urljoin(SERVER_URL, APP_PATH),
target='_blank')
],
className='list-inline-item'),
@@ -153,7 +153,7 @@ def set_primaries_output(colourspace, illuminant,
chromatic_adaptation_transform, formatter, decimals):
"""
Computes and writes the chromatically adapted *primaries *of the given
*RGB* colourspace model to the given *illuminant* using the given
*RGB* colourspace to the given *illuminant* using the given
*chromatic adaptation transform*to into the output :class:`Pre` class
instance.
@@ -185,7 +185,7 @@ def set_primaries_output(colourspace, illuminant,

with colour.utilities.numpy_print_options(
formatter={'float': ('{{: 0.{0}f}}'.format(decimals)).format},
threshold=np.nan):
threshold=sys.maxsize):
if formatter == 'str':
P = str(P)
elif formatter == 'repr':
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# -*- coding: utf-8 -*-
"""
RGB Colourspace Models Transformation Matrix Application
========================================================
RGB Colourspace Transformation Matrix Application
=================================================
"""

from __future__ import division, unicode_literals

import numpy as np
import urlparse
import urllib.parse
import sys
from dash.dependencies import Input, Output
from dash_core_components import Dropdown, Link, Markdown, Slider, Textarea
from dash_core_components import Dropdown, Link, Markdown, Slider
from dash_html_components import A, Code, Div, H3, H5, Li, Pre, Ul

import colour
@@ -20,8 +20,8 @@
RGB_COLOURSPACES_OPTIONS, nuke_format_matrix)

__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2018 - Colour Developers'
__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause'
__copyright__ = 'Copyright (C) 2018-2019 - Colour Developers'
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
__maintainer__ = 'Colour Developers'
__email__ = 'colour-science@googlegroups.com'
__status__ = 'Production'
@@ -31,7 +31,7 @@
'set_RGB_to_RGB_matrix_output'
]

APP_NAME = 'RGB Colourspace Models Transformation Matrix'
APP_NAME = 'RGB Colourspace Transformation Matrix'
"""
App name.
@@ -124,7 +124,7 @@
className='list-inline-item'),
Li([
A('Permalink',
href=urlparse.urljoin(SERVER_URL, APP_PATH),
href=urllib.parse.urljoin(SERVER_URL, APP_PATH),
target='_blank')
],
className='list-inline-item'),
@@ -191,7 +191,7 @@ def set_RGB_to_RGB_matrix_output(input_colourspace, output_colourspace,

with colour.utilities.numpy_print_options(
formatter={'float': ('{{: 0.{0}f}}'.format(decimals)).format},
threshold=np.nan):
threshold=sys.maxsize):
if formatter == 'str':
M = str(M)
elif formatter == 'repr':
Loading

0 comments on commit de35069

Please sign in to comment.