Skip to content

Commit 639e7c5

Browse files
committed
Merge branch 'feature/v0.1.2' into develop
2 parents fd87c70 + f60470a commit 639e7c5

File tree

10 files changed

+128
-25
lines changed

10 files changed

+128
-25
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Install Poetry
3232
run: |
3333
curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py
34-
python get-poetry.py --preview --version 1.0.0b3
34+
python get-poetry.py
3535
PATH=$HOME/.poetry/bin:$PATH
3636
echo ::set-env name=PATH::$PATH
3737
- name: Install Package Dependencies
@@ -81,7 +81,7 @@ jobs:
8181
- name: Install Poetry
8282
run: |
8383
curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py
84-
python get-poetry.py --preview --version 1.0.0b3
84+
python get-poetry.py
8585
set PATH=%USERPROFILE%\.poetry\bin;%PATH%
8686
echo ::set-env name=PATH::%PATH%
8787
shell: cmd

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ repos:
33
rev: 3.7.8
44
hooks:
55
- id: flake8
6-
exclude: examples
6+
exclude: examples|setup\.py
77
- repo: https://github.com/pre-commit/mirrors-yapf
88
rev: v0.23.0
99
hooks:
1010
- id: yapf
11+
exclude: setup\.py

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ build:
22
image: latest
33

44
python:
5-
version: 3.6
5+
version: 3.7
66
pip_install: true
77
extra_requirements:
88
- read-the-docs

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ Primary Dependencies
5757

5858
**Colour - Checker Detection** requires various dependencies in order to run:
5959

60-
- `Python >=3.5 <https://www.python.org/download/releases/>`__
61-
- `Colour Science <https://www.colour-science.org>`__
62-
- `opencv-python >=4 <https://pypi.org/project/opencv-python/>`__
60+
- `python>=3.5 <https://www.python.org/download/releases/>`__
61+
- `colour-science <https://pypi.org/project/colour-science/>`__
62+
- `opencv-python>=4 <https://pypi.org/project/opencv-python/>`__
6363

6464
Pypi
6565
^^^^
@@ -68,11 +68,11 @@ Once the dependencies satisfied, **Colour - Checker Detection** can be installed
6868
the `Python Package Index <http://pypi.python.org/pypi/colour-checker-detection>`__ by
6969
issuing this command in a shell::
7070

71-
pip install colour-checker-detection
71+
pip install --user colour-checker-detection
7272

7373
The overall development dependencies are installed as follows::
7474

75-
pip install 'colour-checker-detection[development]'
75+
pip install --user 'colour-checker-detection[development]'
7676

7777
Usage
7878
-----

colour_checker_detection/examples/examples_detection.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,15 @@
379379
" \n",
380380
" image_a = adjust_image(image)\n",
381381
"\n",
382-
" plot_image(colour.cctf_encoding(segmented_image), text_parameters={\n",
382+
" plot_image(colour.cctf_encoding(segmented_image), text_kwargs={\n",
383383
" 'text': 'Segmented Image',\n",
384384
" 'color': 'black'\n",
385385
" })\n",
386386
" \n",
387387
" cv2.drawContours(image_a, swatches, -1, (1, 0, 1), 3)\n",
388388
" cv2.drawContours(image_a, clusters, -1, (0, 1, 1), 3)\n",
389389
"\n",
390-
" plot_image(colour.cctf_encoding(image_a), text_parameters={\n",
390+
" plot_image(colour.cctf_encoding(image_a), text_kwargs={\n",
391391
" 'text': 'Swatches & Clusters',\n",
392392
" 'color': 'white'\n",
393393
" });"

docs/_static/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ p {
2020

2121
div.highlight-text {
2222
background-color: rgb(252, 252, 252) !important;
23-
border: 0 !important;
2423
font-family: monospace;
24+
font-style: italic;
2525
margin: -24px 0 24px 0;
2626
}

docs/conf.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
basename = re.sub('_(\\w)', lambda x: x.group(1).upper(),
2020
package.__name__.title())
2121

22+
autodoc_member_order = 'bysource'
23+
autodoc_mock_imports = ['colour', 'cv2']
24+
2225
autosummary_generate = True
2326

24-
autodoc_mock_imports = ['colour', 'cv2']
27+
napoleon_custom_sections = ['Attributes', 'Methods']
2528

2629
# If extensions (or modules to document with autodoc) are in another directory,
2730
# add these directories to sys.path here. If the directory is relative to the
@@ -37,9 +40,9 @@
3740
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3841
# ones.
3942
extensions = [
40-
'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo',
41-
'sphinx.ext.coverage', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode',
42-
'sphinx.ext.autosummary', 'sphinx.ext.napoleon', 'sphinx.ext.mathjax',
43+
'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.coverage',
44+
'sphinx.ext.ifconfig', 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax',
45+
'sphinx.ext.napoleon', 'sphinx.ext.todo', 'sphinx.ext.viewcode',
4346
'sphinxcontrib.bibtex'
4447
]
4548

docs/index.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ Primary Dependencies
3737

3838
**Colour - Checker Detection** requires various dependencies in order to run:
3939

40-
- `Python 2.7 <https://www.python.org/download/releases/>`__ or
41-
`Python 3.7 <https://www.python.org/download/releases/>`__
42-
- `Colour Science <https://www.colour-science.org>`__
43-
- `opencv-python <https://pypi.org/project/opencv-python/>`__
40+
- `python>=3.5 <https://www.python.org/download/releases/>`__
41+
- `colour-science <https://pypi.org/project/colour-science/>`__
42+
- `opencv-python>=4 <https://pypi.org/project/opencv-python/>`__
4443

4544
Pypi
4645
^^^^
@@ -49,19 +48,19 @@ Once the dependencies satisfied, **Colour - Checker Detection** can be installed
4948
the `Python Package Index <http://pypi.python.org/pypi/colour-checker-detection>`__ by
5049
issuing this command in a shell::
5150

52-
pip install colour-checker-detection
51+
pip install --user colour-checker-detection
5352

5453
The tests suite dependencies are installed as follows::
5554

56-
pip install 'colour-checker-detection[tests]'
55+
pip install --user 'colour-checker-detection[tests]'
5756

5857
The documentation building dependencies are installed as follows::
5958

60-
pip install 'colour-checker-detection[docs]'
59+
pip install --user 'colour-checker-detection[docs]'
6160

6261
The overall development dependencies are installed as follows::
6362

64-
pip install 'colour-checker-detection[development]'
63+
pip install --user 'colour-checker-detection[development]'
6564

6665
Usage
6766
-----

setup.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# -*- coding: utf-8 -*-
2+
import codecs
3+
from setuptools import setup
4+
5+
packages = \
6+
['colour_checker_detection',
7+
'colour_checker_detection.detection',
8+
'colour_checker_detection.detection.tests']
9+
10+
package_data = \
11+
{'': ['*'],
12+
'colour_checker_detection': ['examples/*',
13+
'resources/colour-checker-detection-examples-datasets/*',
14+
'resources/colour-checker-detection-tests-datasets/*']}
15+
16+
install_requires = \
17+
['colour-science>=0.3.14,<0.4.0', 'opencv-python>=4,<5']
18+
19+
extras_require = \
20+
{'development': ['biblib-simple',
21+
'coverage',
22+
'coveralls',
23+
'flake8',
24+
'invoke',
25+
'jupyter',
26+
'matplotlib',
27+
'mock',
28+
'nose',
29+
'pre-commit',
30+
'pytest',
31+
'restructuredtext-lint',
32+
'sphinx',
33+
'sphinx_rtd_theme',
34+
'sphinxcontrib-bibtex',
35+
'toml',
36+
'twine',
37+
'yapf==0.23'],
38+
'read-the-docs': ['mock', 'numpy', 'sphinxcontrib-bibtex']}
39+
40+
setup(
41+
name='colour-checker-detection',
42+
version='0.1.1',
43+
description='Colour checker detection with Python',
44+
long_description=codecs.open('README.rst', encoding='utf8').read(),
45+
author='Colour Developers',
46+
author_email='colour-developers@colour-science.org',
47+
maintainer='Colour Developers',
48+
maintainer_email='colour-developers@colour-science.org',
49+
url='https://www.colour-science.org/',
50+
packages=packages,
51+
package_data=package_data,
52+
install_requires=install_requires,
53+
extras_require=extras_require,
54+
python_requires='>=3.5,<4.0',
55+
)

tasks.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def docs(ctx, html=True, pdf=True):
255255
Task success.
256256
"""
257257

258-
with ctx.prefix('export COLOUR_SCIENCE_DOCUMENTATION_BUILD=True'):
258+
with ctx.prefix('export COLOUR_SCIENCE__DOCUMENTATION_BUILD=True'):
259259
with ctx.cd('docs'):
260260
if html:
261261
message_box('Building "HTML" documentation...')
@@ -329,6 +329,51 @@ def build(ctx):
329329

330330
message_box('Building...')
331331
ctx.run('poetry build')
332+
333+
with ctx.cd('dist'):
334+
ctx.run('tar -xvf {0}-{1}.tar.gz'.format(PYPI_PACKAGE_NAME,
335+
APPLICATION_VERSION))
336+
ctx.run('cp {0}-{1}/setup.py ../'.format(PYPI_PACKAGE_NAME,
337+
APPLICATION_VERSION))
338+
339+
ctx.run('rm -rf {0}-{1}'.format(PYPI_PACKAGE_NAME,
340+
APPLICATION_VERSION))
341+
342+
with open('setup.py') as setup_file:
343+
source = setup_file.read()
344+
345+
setup_kwargs = []
346+
347+
def sub_callable(match):
348+
setup_kwargs.append(match)
349+
350+
return ''
351+
352+
template = """
353+
setup({0}
354+
)
355+
"""
356+
357+
source = re.sub('from setuptools import setup',
358+
'import codecs\nfrom setuptools import setup', source)
359+
source = re.sub(
360+
'setup_kwargs = {(.*)}.*setup\\(\\*\\*setup_kwargs\\)',
361+
sub_callable,
362+
source,
363+
flags=re.DOTALL)[:-2]
364+
setup_kwargs = setup_kwargs[0].group(1).splitlines()
365+
for i, line in enumerate(setup_kwargs):
366+
setup_kwargs[i] = re.sub('^\\s*(\'(\\w+)\':\\s?)', ' \\2=', line)
367+
if setup_kwargs[i].strip().startswith('long_description'):
368+
setup_kwargs[i] = (' long_description='
369+
'codecs.open(\'README.rst\', encoding=\'utf8\')'
370+
'.read(),')
371+
372+
source += template.format('\n'.join(setup_kwargs))
373+
374+
with open('setup.py', 'w') as setup_file:
375+
setup_file.write(source)
376+
332377
ctx.run('twine check dist/*')
333378

334379

0 commit comments

Comments
 (0)