Skip to content

Commit 096361d

Browse files
authored
Merge pull request #18 from C-Achard/cookiecutter-test
Cookiecutter + test + docs
2 parents 4fa2943 + efd6e51 commit 096361d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2608
-268
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# This workflows will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: tests
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- npe2
11+
tags:
12+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
13+
pull_request:
14+
branches:
15+
- main
16+
- npe2
17+
workflow_dispatch:
18+
19+
jobs:
20+
test:
21+
name: ${{ matrix.platform }} py${{ matrix.python-version }}
22+
runs-on: ${{ matrix.platform }}
23+
strategy:
24+
matrix:
25+
platform: [ubuntu-latest, windows-latest, macos-latest]
26+
python-version: [3.8, 3.9, '3.10']
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v2
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
36+
# these libraries enable testing on Qt on linux
37+
- uses: tlambert03/setup-qt-libs@v1
38+
39+
# strategy borrowed from vispy for installing opengl libs on windows
40+
- name: Install Windows OpenGL
41+
if: runner.os == 'Windows'
42+
run: |
43+
git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
44+
powershell gl-ci-helpers/appveyor/install_opengl.ps1
45+
46+
# note: if you need dependencies from conda, considering using
47+
# setup-miniconda: https://github.com/conda-incubator/setup-miniconda
48+
# and
49+
# tox-conda: https://github.com/tox-dev/tox-conda
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
python -m pip install setuptools tox tox-gh-actions
54+
55+
# this runs the platform-specific tests declared in tox.ini
56+
- name: Test with tox
57+
uses: GabrielBB/xvfb-action@v1
58+
with:
59+
run: python -m tox
60+
env:
61+
PLATFORM: ${{ matrix.platform }}
62+
63+
- name: Coverage
64+
uses: codecov/codecov-action@v2
65+
66+
deploy:
67+
# this will run when you have tagged a commit, starting with "v*"
68+
# and requires that you have put your twine API key in your
69+
# github secrets (see readme for details)
70+
needs: [test]
71+
runs-on: ubuntu-latest
72+
if: contains(github.ref, 'tags')
73+
steps:
74+
- uses: actions/checkout@v2
75+
- name: Set up Python
76+
uses: actions/setup-python@v2
77+
with:
78+
python-version: "3.x"
79+
- name: Install dependencies
80+
run: |
81+
python -m pip install --upgrade pip
82+
pip install -U setuptools setuptools_scm wheel twine build
83+
- name: Build and publish
84+
env:
85+
TWINE_USERNAME: __token__
86+
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
87+
run: |
88+
git tag
89+
python -m build .
90+
twine upload dist/*
91+

.gitignore

Lines changed: 18 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ __pycache__/
88

99
# Distribution / packaging
1010
.Python
11+
env/
1112
build/
1213
develop-eggs/
1314
dist/
@@ -19,12 +20,9 @@ lib64/
1920
parts/
2021
sdist/
2122
var/
22-
wheels/
23-
share/python-wheels/
2423
*.egg-info/
2524
.installed.cfg
2625
*.egg
27-
MANIFEST
2826

2927
# PyInstaller
3028
# Usually these files are written by a python script from a template
@@ -39,17 +37,14 @@ pip-delete-this-directory.txt
3937
# Unit test / coverage reports
4038
htmlcov/
4139
.tox/
42-
.nox/
4340
.coverage
4441
.coverage.*
4542
.cache
4643
nosetests.xml
4744
coverage.xml
48-
*.cover
49-
*.py,cover
45+
*,cover
5046
.hypothesis/
51-
.pytest_cache/
52-
cover/
47+
.napari_cache
5348

5449
# Translations
5550
*.mo
@@ -58,91 +53,33 @@ cover/
5853
# Django stuff:
5954
*.log
6055
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
6356

64-
# Flask stuff:
57+
# Flask instance folder
6558
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
7059

7160
# Sphinx documentation
7261
docs/_build/
7362

63+
# MkDocs documentation
64+
/site/
65+
7466
# PyBuilder
75-
.pybuilder/
7667
target/
7768

78-
# Jupyter Notebook
79-
.ipynb_checkpoints
80-
81-
# IPython
82-
profile_default/
83-
ipython_config.py
84-
85-
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
89-
90-
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# poetry
98-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102-
#poetry.lock
103-
104-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
105-
__pypackages__/
106-
107-
# Celery stuff
108-
celerybeat-schedule
109-
celerybeat.pid
110-
111-
# SageMath parsed files
112-
*.sage.py
113-
114-
# Environments
115-
.env
116-
.venv
117-
env/
69+
# Pycharm and VSCode
70+
.idea/
11871
venv/
119-
ENV/
120-
env.bak/
121-
venv.bak/
122-
123-
# Spyder project settings
124-
.spyderproject
125-
.spyproject
126-
127-
# Rope project settings
128-
.ropeproject
72+
.vscode/
12973

130-
# mkdocs documentation
131-
/site
132-
133-
# mypy
134-
.mypy_cache/
135-
.dmypy.json
136-
dmypy.json
74+
# IPython Notebook
75+
.ipynb_checkpoints
13776

138-
# Pyre type checker
139-
.pyre/
77+
# pyenv
78+
.python-version
14079

141-
# pytype static type analyzer
142-
.pytype/
80+
# OS
81+
.DS_Store
14382

144-
# Cython debug symbols
145-
cython_debug/
83+
# written by setuptools_scm
84+
**/_version.py
14685

147-
# PyCharm
148-
.idea/

.napari/DESCRIPTION.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
3+
<!-- This file is designed to provide you with a starting template for documenting
4+
the functionality of your plugin. Its content will be rendered on your plugin's
5+
napari hub page.
6+
7+
The sections below are given as a guide for the flow of information only, and
8+
are in no way prescriptive. You should feel free to merge, remove, add and
9+
rename sections at will to make this document work best for your plugin.
10+
11+
## Description
12+
13+
This should be a detailed description of the context of your plugin and its
14+
intended purpose.
15+
16+
If you have videos or screenshots of your plugin in action, you should include them
17+
here as well, to make them front and center for new users.
18+
19+
You should use absolute links to these assets, so that we can easily display them
20+
on the hub. The easiest way to include a video is to use a GIF, for example hosted
21+
on imgur. You can then reference this GIF as an image.
22+
23+
![Example GIF hosted on Imgur](https://i.imgur.com/A5phCX4.gif)
24+
25+
Note that GIFs larger than 5MB won't be rendered by GitHub - we will however,
26+
render them on the napari hub.
27+
28+
The other alternative, if you prefer to keep a video, is to use GitHub's video
29+
embedding feature.
30+
31+
1. Push your `DESCRIPTION.md` to GitHub on your repository (this can also be done
32+
as part of a Pull Request)
33+
2. Edit `.napari/DESCRIPTION.md` **on GitHub**.
34+
3. Drag and drop your video into its desired location. It will be uploaded and
35+
hosted on GitHub for you, but will not be placed in your repository.
36+
4. We will take the resolved link to the video and render it on the hub.
37+
38+
Here is an example of an mp4 video embedded this way.
39+
40+
https://user-images.githubusercontent.com/17995243/120088305-6c093380-c132-11eb-822d-620e81eb5f0e.mp4
41+
42+
## Intended Audience & Supported Data
43+
44+
This section should describe the target audience for this plugin (any knowledge,
45+
skills and experience required), as well as a description of the types of data
46+
supported by this plugin.
47+
48+
Try to make the data description as explicit as possible, so that users know the
49+
format your plugin expects. This applies both to reader plugins reading file formats
50+
and to function/dock widget plugins accepting layers and/or layer data.
51+
For example, if you know your plugin only works with 3D integer data in "tyx" order,
52+
make sure to mention this.
53+
54+
If you know of researchers, groups or labs using your plugin, or if it has been cited
55+
anywhere, feel free to also include this information here.
56+
57+
## Quickstart
58+
59+
This section should go through step-by-step examples of how your plugin should be used.
60+
Where your plugin provides multiple dock widgets or functions, you should split these
61+
out into separate subsections for easy browsing. Include screenshots and videos
62+
wherever possible to elucidate your descriptions.
63+
64+
Ideally, this section should start with minimal examples for those who just want a
65+
quick overview of the plugin's functionality, but you should definitely link out to
66+
more complex and in-depth tutorials highlighting any intricacies of your plugin, and
67+
more detailed documentation if you have it.
68+
69+
## Additional Install Steps (uncommon)
70+
We will be providing installation instructions on the hub, which will be sufficient
71+
for the majority of plugins. They will include instructions to pip install, and
72+
to install via napari itself.
73+
74+
Most plugins can be installed out-of-the-box by just specifying the package requirements
75+
over in `setup.cfg`. However, if your plugin has any more complex dependencies, or
76+
requires any additional preparation before (or after) installation, you should add
77+
this information here.
78+
79+
## Getting Help
80+
81+
This section should point users to your preferred support tools, whether this be raising
82+
an issue on GitHub, asking a question on image.sc, or using some other method of contact.
83+
If you distinguish between usage support and bug/feature support, you should state that
84+
here.
85+
86+
## How to Cite
87+
88+
Many plugins may be used in the course of published (or publishable) research, as well as
89+
during conference talks and other public facing events. If you'd like to be cited in
90+
a particular format, or have a DOI you'd like used, you should provide that information here. -->
91+
92+
The developer has not yet provided a napari-hub specific description.

.pre-commit-config.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: check-docstring-first
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/asottile/setup-cfg-fmt
9+
rev: v1.20.0
10+
hooks:
11+
- id: setup-cfg-fmt
12+
- repo: https://github.com/PyCQA/flake8
13+
rev: 4.0.1
14+
hooks:
15+
- id: flake8
16+
additional_dependencies: [flake8-typing-imports>=1.9.0]
17+
- repo: https://github.com/myint/autoflake
18+
rev: v1.4
19+
hooks:
20+
- id: autoflake
21+
args: ["--in-place", "--remove-all-unused-imports"]
22+
- repo: https://github.com/PyCQA/isort
23+
rev: 5.10.1
24+
hooks:
25+
- id: isort
26+
- repo: https://github.com/psf/black
27+
rev: 21.11b1
28+
hooks:
29+
- id: black
30+
- repo: https://github.com/asottile/pyupgrade
31+
rev: v2.29.1
32+
hooks:
33+
- id: pyupgrade
34+
args: [--py38-plus, --keep-runtime-typing]
35+
- repo: https://github.com/tlambert03/napari-plugin-checks
36+
rev: v0.2.0
37+
hooks:
38+
- id: napari-plugin-checks
39+
# https://mypy.readthedocs.io/en/stable/introduction.html
40+
# you may wish to add this as well!
41+
# - repo: https://github.com/pre-commit/mirrors-mypy
42+
# rev: v0.910-1
43+
# hooks:
44+
# - id: mypy

0 commit comments

Comments
 (0)