Skip to content

Commit

Permalink
Merge branch 'main' into addTH1Fhelpers
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Jun 10, 2021
2 parents c9aab0c + 74562b6 commit 764bbef
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 33 deletions.
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


[flake8]
ignore = E203, E231, E501, E722, W503, B950
select = C,E,F,W,T,B,B9,I
per-file-ignores =
tests/*: T
noxfile.py: T
11 changes: 11 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ detailed description of best practices for developing Scikit-HEP packages.

[skhep-dev-intro]: https://scikit-hep.org/developer/intro

# Quick run with Nox

If you have nox, this project supports nox. These are the supplied sessions:

```console
nox -s lint
nox -s tests
nox -s docs -- serve
nox -s build
```

# Setting up a development environment

You can set up a development environment by running:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.3
with:
Expand All @@ -33,7 +33,7 @@ jobs:
runs-on: [ubuntu-latest, macos-latest, windows-latest]

include:
- python-version: pypy-3.6
- python-version: pypy-3.7
runs-on: ubuntu-latest


Expand All @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@v1

- name: Build sdist and wheel
run: pipx run --spec build pyproject-build
run: pipx run build

- uses: actions/upload-artifact@v2
with:
Expand All @@ -68,5 +68,4 @@ jobs:
- uses: pypa/gh-action-pypi-publish@v1.4.2
if: github.event_name == 'release' && github.event.action == 'published'
with:
user: __token__
password: ${{ secrets.pypi_password }}
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 21.5b1
rev: 21.5b2
hooks:
- id: black

Expand All @@ -24,7 +24,7 @@ repos:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: v2.18.2
rev: v2.19.3
hooks:
- id: pyupgrade
args: ["--py36-plus"]
Expand All @@ -37,7 +37,7 @@ repos:
additional_dependencies: [flake8-bugbear, flake8-print]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
rev: v0.901
hooks:
- id: mypy
files: ^(src|tests)
Expand Down
65 changes: 65 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import shutil
from pathlib import Path

import nox

ALL_PYTHONS = ["3.6", "3.7", "3.8", "3.9"]

nox.options.sessions = ["lint", "tests"]


DIR = Path(__file__).parent.resolve()


@nox.session
def lint(session):
"""
Run the linter.
"""
session.install("pre-commit")
session.run("pre-commit", "run", "--all-files")


@nox.session(python=ALL_PYTHONS)
def tests(session):
"""
Run the unit and regular tests.
"""
session.install(".[test]")
session.run("pytest")


@nox.session
def docs(session):
"""
Build the docs. Pass "serve" to serve.
"""

session.install(".[docs]")
session.chdir("docs")
session.run("sphinx-build", "-M", "html", ".", "_build")

if session.posargs:
if "serve" in session.posargs:
print("Launching docs at http://localhost:8000/ - use Ctrl-C to quit")
session.run("python", "-m", "http.server", "8000", "-d", "_build/html")
else:
print("Unsupported argument to docs")


@nox.session
def build(session):
"""
Build an SDist and wheel.
"""

build_p = DIR.joinpath("build")
if build_p.exists():
shutil.rmtree(build_p)

dist_p = DIR.joinpath("dist")
if dist_p.exists():
shutil.rmtree(dist_p)

session.install("build")
session.run("python", "-m", "build")
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,22 @@ testpaths = [
[tool.isort]
profile = "black"
multi_line_output = 3

[tool.mypy]
files = "src"
python_version = "3.6"
warn_unused_configs = "true"

disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
no_implicit_reexport = true
strict_equality = true
26 changes: 0 additions & 26 deletions setup.cfg

This file was deleted.

0 comments on commit 764bbef

Please sign in to comment.