Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbuntemeyer committed Jan 13, 2023
0 parents commit d273fea
Show file tree
Hide file tree
Showing 26 changed files with 691 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
# Check for updates once a week
interval: 'weekly'
16 changes: 16 additions & 0 deletions .github/workflows/optional/linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: linting with pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- uses: pre-commit/[email protected]
24 changes: 24 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

---
name: Release

on: [push]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install dependencies
run: |
python -m pip install -U pip wheel setuptools setuptools-scm twine
- name: Build distributions
run: python setup.py sdist bdist_wheel

- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
55 changes: 55 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tests
on:
push:
branches:
- "master"
pull_request:
branches:
- "*"
schedule:
- cron: "0 13 * * 1"

jobs:
build:
name: Build (${{ matrix.python-version }} | ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7", "3.8"]
steps:
- uses: actions/checkout@v2
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
# mamba-version: "*" # activate this to build with mamba.
# channels: conda-forge, defaults # These need to be specified to use mamba
# channel-priority: true
environment-file: ci/environment-py${{ matrix.python-version }}.yml

activate-environment: test_env_enjoy-slurm
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Set up conda environment
shell: bash -l {0}
run: |
python -m pip install -e . --no-deps --force-reinstall
- name: Run Tests
shell: bash -l {0}
run: |
pytest --cov=./ --cov-report=xml
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
91 changes: 91 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# DotEnv configuration
.env

# Database
*.db
*.rdb

# Pycharm
.idea

# VS Code
.vscode/

# Spyder
.spyproject/

# Jupyter NB Checkpoints
.ipynb_checkpoints/

# exclude data from source control by default
#/data/
# I want to be able to handle links in here...need to exclude certain file types
# instead

# Mac OS-specific storage files
.DS_Store

# vim
*.swp
*.swo

# Mypy cache
.mypy_cache/
61 changes: 61 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
repos:

- repo: https://github.com/econchick/interrogate
rev: 1.2.0
hooks:
- id: interrogate
exclude: ^(docs|setup.py|tests)
args: [--config=pyproject.toml]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: trailing-whitespace
exclude: tests/data
- id: check-ast
- id: debug-statements
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-added-large-files
- id: requirements-txt-fixer
- id: file-contents-sorter
files: requirements-dev.txt

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
exclude: docs/source/conf.py
args: [--max-line-length=105, --ignore=E203,E501,W503, --select=select=C,E,F,W,B,B950]

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
additional_dependencies: [toml]
args: [--project=gcm_filters, --multi-line=3, --lines-after-imports=2, --lines-between-types=1, --trailing-comma, --force-grid-wrap=0, --use-parentheses, --line-width=88]

- repo: https://github.com/asottile/seed-isort-config
rev: v2.1.1
hooks:
- id: seed-isort-config

- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
language_version: python3

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.770
hooks:
- id: mypy
exclude: docs/source/conf.py
args: [--ignore-missing-imports]

- repo: https://github.com/codespell-project/codespell
rev: v1.16.0
hooks:
- id: codespell
args:
- --quiet-level=2
10 changes: 10 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

The MIT License (MIT)
Copyright (c) 2023, Lars Buntemeyer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
enjoy-slurm
==============================
[![Build Status](https://github.com/larsbuntemeyer/enjoy-slurm/workflows/Tests/badge.svg)](https://github.com/larsbuntemeyer/enjoy-slurm/actions)
[![codecov](https://codecov.io/gh/larsbuntemeyer/enjoy-slurm/branch/main/graph/badge.svg)](https://codecov.io/gh/larsbuntemeyer/enjoy-slurm)
[![License:MIT](https://img.shields.io/badge/License-MIT-lightgray.svg?style=flt-square)](https://opensource.org/licenses/MIT)[![pypi](https://img.shields.io/pypi/v/enjoy-slurm.svg)](https://pypi.org/project/enjoy-slurm)
<!-- [![conda-forge](https://img.shields.io/conda/dn/conda-forge/enjoy-slurm?label=conda-forge)](https://anaconda.org/conda-forge/enjoy-slurm) -->[![Documentation Status](https://readthedocs.org/projects/enjoy-slurm/badge/?version=latest)](https://enjoy-slurm.readthedocs.io/en/latest/?badge=latest)


slim python slurm control

--------

<p><small>Project based on the <a target="_blank" href="https://github.com/jbusecke/cookiecutter-science-project">cookiecutter science project template</a>.</small></p>
15 changes: 15 additions & 0 deletions ci/environment-py3.7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: test_env_enjoy-slurm
channels:
- conda-forge
dependencies:
- python=3.7
############## These will have to be adjusted to your specific project
- numpy
- scipy
- xarray
##############
- pytest
- pip:
- codecov
- pytest-cov
- coverage[toml]
15 changes: 15 additions & 0 deletions ci/environment-py3.8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: test_env_enjoy-slurm
channels:
- conda-forge
dependencies:
- python=3.8
############## These will have to be adjusted to your specific project
- numpy
- scipy
- xarray
##############
- pytest
- pip:
- codecov
- pytest-cov
- coverage[toml]
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
10 changes: 10 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:mod:`API`
----------------------------

Example For Autogenerated API Documentation
===========================================

.. automodule:: enjoy_slurm.dummy
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit d273fea

Please sign in to comment.