Skip to content

Commit

Permalink
Create initial project infrastructure (#1)
Browse files Browse the repository at this point in the history
* Create initial project infrastructure

* Fix pylint warnings

* Fix markdown heading
  • Loading branch information
cgohlke authored Aug 22, 2023
1 parent e77b9bc commit beee234
Show file tree
Hide file tree
Showing 40 changed files with 1,763 additions and 6 deletions.
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help improve PhasorPy
title: ''
labels: ''
assignees: ''

---

**Describe the bug**

A clear and concise description of what the bug is and what was expected to happen.

**To Reproduce**

A minimal, self-contained Python code reproducing the problem. Format the code using markdown, for example:

```Python
import phasorpy
phasorpy.do_something('my.file')
```

A Python traceback if available, for example:

```Python traceback
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'phasorpy' has no attribute 'do_something'
```

Any data files necessary to run the code can be attached to the issue or shared via cloud storage.

Information how PhasorPy was installed (pip, conda, or other) and the console output of:

```
$ python -m phasorpy --versions
```
51 changes: 51 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy documentation

on:
push:
tags:
- '*'
branches:
- main
pull_request:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install package and dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements_dev.txt
python -m pip install --no-build-isolation --no-deps --verbose --editable .
- name: Build docs
run: |
cd docs
make html
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: docs
path: docs/_build/html
- name: Deploy docs
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.PHASORPY_DOC_DEPLOY_KEY }}
external_repository: phasorpy/phasorpy.github.io
publish_dir: docs/_build/html
publish_branch: main
destination_dir: ${{github.ref_name}}
# cname: phasorpy.org
75 changes: 75 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Publish to PyPI

on:
push:
tags:
- '*'
branches:
- main
pull_request:
branches:
- main

jobs:

build_artifacts:
name: Build sdist and wheel
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install PyBuild
run: |
python -m pip install build
- name: Build wheel and sdist
run: |
python -m build .
- uses: actions/upload-artifact@v3
with:
name: releases
path: dist

test_artifacts:
name: Test sdist and wheel
needs: [build_artifacts]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: releases
path: dist
- uses: actions/setup-python@v4.6.0
with:
python-version: "3.11"
- run: |
ls
ls dist
python -m pip install -U twine
python -m twine check dist/*
python -m pip install --upgrade --no-cache-dir --no-deps --pre --no-index --find-links=dist phasorpy
python -c"from phasorpy import __version__;print(__version__)"
upload_artifacts:
name: Upload release to PyPI
needs: [build_artifacts]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/phasorpy
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
name: releases
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
96 changes: 96 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Run tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
name: Test library and docs
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Editable install
run: |
python -m pip install --upgrade pip
python -m pip install --editable .
python -m pip install -r requirements_dev.txt
- name: Print dependency versions
run: |
phasorpy --versions
- name: Test with pytest
run: |
python -X dev -m pytest
- name: Build docs
run: |
cd docs
make html
test_win_mac:
name: Test Windows and macOS
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-2019", "macos-12"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Editable install
run: |
python -m pip install --upgrade pip
python -m pip install --editable .
python -m pip install -r requirements_dev.txt
- name: Test with pytest
run: |
python -X dev -m pytest
- name: Build docs
run: |
cd docs
make html
static_analysis:
name: Static code analysis
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Editable install
run: |
python -m pip install --upgrade pip
python -m pip install --editable .
python -m pip install -r requirements_dev.txt
- name: Test with black
run: |
python -m black --check src/phasorpy tutorials docs
- name: Test with mypy
run: |
python -m mypy
- name: Test with isort
run: |
python -m isort --check src/phasorpy tutorials
- name: Check spelling
run: |
python -m codespell_lib
38 changes: 33 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
_/*
data/*
tutorials/data/*
*.tif
*.tiff
*.lsm
*.ome.tif
*.sdt
*.b64
*.r64
*.npy
*.flif
*.lif
*.czi

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -7,6 +22,7 @@ __pycache__/
*.so

# Distribution / packaging
setup.cfg
.Python
build/
develop-eggs/
Expand Down Expand Up @@ -37,6 +53,7 @@ pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
_htmlcov/
htmlcov/
.tox/
.nox/
Expand All @@ -49,6 +66,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
.ruff_cache/
cover/

# Translations
Expand All @@ -69,7 +87,11 @@ instance/
.scrapy

# Sphinx documentation
_build/
docs/build/
docs/_build/
docs/examples/
docs/tutorials/

# PyBuilder
.pybuilder/
Expand All @@ -85,25 +107,25 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
Expand Down Expand Up @@ -152,9 +174,15 @@ dmypy.json
# Cython debug symbols
cython_debug/

.vs
.vscode
*.code-workspace

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

.benchmarks
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See the [PhasorPy release notes](docs/release.rst).
1 change: 1 addition & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See the [PhasorPy code of conduct](docs/code_of_conduct.rst).
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See the [PhasorPy contributing guide](docs/contributing.rst).
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 PhasorPy Developers
Copyright (c) 2022-2023 PhasorPy Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit beee234

Please sign in to comment.