Skip to content

Commit

Permalink
finished merging template
Browse files Browse the repository at this point in the history
  • Loading branch information
deeenes committed Jun 26, 2024
2 parents 85d6fae + 8c9a476 commit 2681208
Show file tree
Hide file tree
Showing 22 changed files with 1,552 additions and 28 deletions.
7 changes: 7 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[bumpversion]
current_version = 0.0.1
commit = True
tag = True
files = pyproject.toml lipyd/_metadata.py
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize = {major}.{minor}.{patch}
17 changes: 17 additions & 0 deletions .codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Based on pydata/xarray
codecov:
require_ci_to_pass: no

coverage:
status:
project:
default:
# Require 1% coverage, i.e., always succeed
target: 1
patch: false
changes: false

comment:
layout: diff, flags, files
behavior: once
require_base: no
22 changes: 22 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[paths]
source =
project_name
*/site-packages/Lipyd

[run]
branch = true
parallel = true
source = Lipyd
omit = */__init__.py

[report]
exclude_lines =
\#.*pragma:\s*no.?cover

if __name__ == .__main__.

^\s*raise AssertionError\b
^\s*raise NotImplementedError\b
^\s*return NotImplemented\b
show_missing = true
precision = 2
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = tab
23 changes: 23 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Package build

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install build dependencies
run: python -m pip install --upgrade pip wheel twine build
- name: Build package
run: python -m build
- name: Check package
run: twine check --strict dist/*.whl
55 changes: 55 additions & 0 deletions .github/workflows/sphinx_autodoc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Sphinx build docs on push
on:
- push

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out main
uses: actions/checkout@main
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.10.5
- name: Load cached Poetry installation
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-0
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Poetry disable modern-installation
run: poetry config installer.modern-installation false
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install library
run: poetry install --no-interaction
- name: Build documentation
run: poetry run make html --directory docs/
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
touch docs/_build/html/.nojekyll
git add -f docs/_build/
git commit -m "Update autodoc" -a
# using https://github.com/marketplace/actions/push-git-subdirectory-as-branch
- name: Deploy
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: gh-pages
FOLDER: docs/_build/html
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57 changes: 57 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:

test:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -e {0}

strategy:
fail-fast: false
matrix:
python: [3.8, 3.9, 3.10]
os: [ubuntu-latest, macos-latest]

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: '**/pyproject.toml'

- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
pip install codecov
- name: Install dependencies
run: |
pip install ".[dev,test]"
- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
pytest -v --cov --color=yes
- name: Upload coverage
env:
CODECOV_NAME: ${{ matrix.python }}-${{ matrix.os }}
run: |
codecov --no-color --required --flags unittests
25 changes: 22 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
build/
dist/
*~
__pycache__/
/build/
/docs/_build/
/docs/generated/
.DS_Store
/.vscode/
/*.egg-info/
*.egg
*.prof
*.coverage
*.pickle
/out/
*.log
/dist/
*.pye
*.pyc
*.egg-info/
*.kate-swp
/.tox/
/.idea/
/.pytest_cache/
/.cache/
/data/
110 changes: 110 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
fail_fast: false
default_language_version:
python: python3
default_stages:
- commit
- push
minimum_pre_commit_version: 2.7.1
repos:
- repo: https://github.com/deeenes/unexport
rev: 0.4.0-patch0-3
hooks:
- id: unexport
args: [--refactor, --single_quotes]
exclude: __init__.py$
- repo: https://github.com/google/yapf
rev: v0.40.2
hooks:
- id: yapf
additional_dependencies: [toml]
stages: [manual]
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
additional_dependencies: [toml]
stages: [manual]
- repo: https://github.com/Instagram/Fixit
rev: 9d59f968e84bd2773f34b0069eeeaad3ce783254
hooks:
- id: fixit-run-rules
stages: [manual]
- repo: https://github.com/timothycrosley/isort
rev: 5.13.2
hooks:
- id: isort
additional_dependencies: [toml]
- repo: https://github.com/snok/pep585-upgrade
rev: v1.0
hooks:
- id: upgrade-type-hints
args: [--futures=true]
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/myint/unify
rev: v0.5
hooks:
- id: unify
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: detect-private-key
- id: check-ast
- id: check-docstring-first
- id: end-of-file-fixer
- id: check-added-large-files
- id: mixed-line-ending
args: [--fix=lf]
exclude: ^docs/make.bat$
- id: trailing-whitespace
exclude: ^.bumpversion.cfg$
- id: check-merge-conflict
- id: check-case-conflict
- id: check-symlinks
- id: check-yaml
args: [--unsafe]
- id: check-ast
- id: fix-encoding-pragma
args: [--remove] # for Python3 codebase, it's not necessary
- id: requirements-txt-fixer
- repo: https://github.com/john-hen/Flake8-pyproject
rev: 1.2.3
hooks:
- id: Flake8-pyproject
additional_dependencies:
- flake8-docstrings
- flake8-comprehensions
- flake8-bugbear
- git+https://github.com/saezlab/flake8-kwargs-spaces.git
- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.0
hooks:
- id: rstcheck
exclude: docs
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py3-plus, --py38-plus, --keep-runtime-typing]
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.13.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '4']
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-no-eval
- id: python-use-type-annotations
- id: python-check-blanket-noqa
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
22 changes: 22 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2

sphinx:
builder: html
configuration: docs/source/conf.py
fail_on_warning: true

formats:
- htmlzip
- pdf

build:
os: ubuntu-22.04
tools:
python: 3.10

python:
install:
- method: pip
path: .
extra_requirements:
- docs
Loading

0 comments on commit 2681208

Please sign in to comment.