-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup pre-commit hoooks and change installation to use pyproject.toml
- Loading branch information
Showing
10 changed files
with
263 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# .coveragerc | ||
|
||
[run] | ||
branch = True | ||
source = ic3_labels | ||
|
||
[report] | ||
|
||
omit = ic3_labels/__about__.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Unit Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ | ||
"3.8", | ||
"3.9", | ||
"3.10", | ||
"3.11", | ||
"3.12", | ||
] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: pre-commit/[email protected] | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install .[test] | ||
- name: Test with pytest | ||
run: | | ||
coverage run -m pytest -v -s | ||
- name: Generate Coverage Report | ||
run: | | ||
coverage report -m | ||
continue-on-error: false | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Adapted from simweights | ||
# SPDX-FileCopyrightText: © 2022 the SimWeights contributors | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
ci: | ||
autoupdate_commit_msg: autoupdate pre-commit hooks | ||
autoupdate_schedule: quarterly | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 24.3.0 | ||
hooks: | ||
- id: black | ||
- id: black-jupyter | ||
- repo: https://github.com/asottile/blacken-docs | ||
rev: "1.16.0" | ||
hooks: | ||
- id: blacken-docs | ||
args: [-l 100] | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.3.5 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --show-fixes] | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.6 | ||
hooks: | ||
- id: codespell | ||
args: [-L, livetime] | ||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.10.0 | ||
hooks: | ||
- id: python-no-log-warn | ||
- id: python-no-eval | ||
exclude: ^tests/.* | ||
- id: python-use-type-annotations | ||
- id: rst-backticks | ||
- id: rst-directive-colons | ||
- id: rst-inline-touching-normal | ||
- repo: https://github.com/Lucas-C/pre-commit-hooks | ||
rev: v1.5.5 | ||
hooks: | ||
- id: forbid-crlf | ||
- id: forbid-tabs | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-builtin-literals | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-executables-have-shebangs | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-toml | ||
- id: check-vcs-permalinks | ||
- id: debug-statements | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: fix-byte-order-marker | ||
- id: mixed-line-ending | ||
- id: name-tests-test | ||
args: [--pytest-test-first] | ||
- id: trailing-whitespace | ||
exclude: \.svg$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Contributing | ||
|
||
Welcome and thanks for considering to contribute to this repository! | ||
|
||
## Pre-commit Hooks | ||
|
||
When contributing to this project, please utilize the pre-commit hooks. If not installed yet, you will need to add the python package `pre-commit`: | ||
|
||
pip install pre-commit | ||
|
||
Once the package is installed, simply install the pre-commit hooks defined in the repository by executing: | ||
|
||
pre-commit install | ||
|
||
from within the repository directory. | ||
|
||
The pre-commit hooks will now automatically run when invoking `git commit`. Note, however, that this requires an active shell that has `pre-commit` installed. | ||
You can also manually run the pre-commit on single files or on all files via: | ||
|
||
pre-commit run --all-files | ||
|
||
If you need to commit something even though there are errors (this should not have to be done!), then you can add the flag `--no-verify` to the `git commit` command. This will bypass the pre-commit hooks. | ||
|
||
Additional information is provided here: https://pre-commit.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
| Testing | Coverage | | ||
| :-----: | :------: | | ||
| [![Unit Tests](https://github.com/icecube/ic3_labels/actions/workflows/test_suite.yml/badge.svg)](https://github.com/icecube/ic3_labels/actions/workflows/test_suite.yml) | [![codecov](https://codecov.io/github/icecube/ic3_labels/graph/badge.svg?token=ZQ6K8V9F4U)](https://codecov.io/github/icecube/ic3_labels) | ||
|
||
|
||
|
||
# ic3-labels | ||
Helper functions and I3-Modules to create labels for IceCube data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
__version__ = '1.1.0-dev' | ||
__version__ = "1.1.0-dev" | ||
__author__ = "Mirco Huennefeld" | ||
__author_email__ = "[email protected]" | ||
__description__ = "Creates MC labels for IceCube simulation data" | ||
__description__ = "MC weights and labels for IceCube simulation data" | ||
__url__ = "https://github.com/mhuen/ic3-labels" | ||
|
||
__version_major__ = 1 | ||
__version_minor__ = 1 | ||
__version_patch__ = 0 | ||
__version_info__ = "-dev" | ||
|
||
__version__ = "{}.{}.{}{}".format( | ||
__version_major__, | ||
__version_minor__, | ||
__version_patch__, | ||
__version_info__, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
from ic3_labels.__about__ import __version__, __description__, __url__ | ||
from .__about__ import ( | ||
__version_major__, | ||
__version_minor__, | ||
__version_patch__, | ||
__version_info__, | ||
__version__, | ||
__description__, | ||
__url__, | ||
) | ||
|
||
__all__ = [ | ||
"__version_major__", | ||
"__version_minor__", | ||
"__version_patch__", | ||
"__version_info__", | ||
"__version__", | ||
"__description__", | ||
"__url__", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "ic3_labels" | ||
description = "MC weights and labels for IceCube simulation data" | ||
readme = "README.md" | ||
dynamic = ["version"] | ||
authors = [ | ||
{ name = "Mirco Huennefeld", email = "[email protected]" }, | ||
] | ||
maintainers = [ | ||
{ name = "Mirco Huennefeld", email = "[email protected]" }, | ||
] | ||
requires-python = ">=3.7" | ||
|
||
dependencies = [ | ||
'numpy', 'click', 'pyyaml', 'scipy', 'MCEq', 'crflux', | ||
'nuVeto', | ||
] | ||
|
||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"License :: OSI Approved :: BSD License", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: Scientific/Engineering :: Physics", | ||
"Topic :: Scientific/Engineering :: Statistics", | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = ["pre-commit","black","ruff"] | ||
test = ["pytest", "coverage", "codecov"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/icecube/ic3_labels" | ||
Documentation = "https://github.com/icecube/ic3_labels" | ||
"Bug Tracker" = "https://github.com/icecube/ic3_labels/issues" | ||
Discussions = "https://github.com/icecube/ic3_labels/discussions" | ||
|
||
[tool.setuptools] | ||
packages = ["ic3_labels"] | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "ic3_labels.__version__"} | ||
|
||
[tool.black] | ||
line-length = 79 | ||
target-version = ["py38"] | ||
|
||
[tool.ruff] | ||
# select = ["ALL"] | ||
fixable = ["I"] | ||
ignore = [ | ||
"D213", # multi-line-summary-second-line incompatible with multi-line-summary-first-line | ||
"D203", # one-blank-line-before-class" incompatible with no-blank-line-before-class | ||
"D401", # non-imperative-mood | ||
"D417", # undocumented-param | ||
"ANN101", # missing-type-self | ||
"ANN401", # any-type | ||
"FBT", # flake8-boolean-trap | ||
"INP", # flake8-no-pep420 | ||
"T20", # flake8-print | ||
"TCH", # flake8-type-checking | ||
"S101", # assert-used | ||
"F401", # imported but unused. NOTE: sooner or later, we should not ignore this | ||
] | ||
line-length = 79 | ||
target-version = "py38" | ||
|
||
[tool.ruff.pydocstyle] | ||
convention = "numpy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,3 @@ | ||
#!/usr/bin/env python | ||
import os | ||
from setuptools import setup, find_packages | ||
from setuptools import setup | ||
|
||
here = os.path.dirname(__file__) | ||
|
||
about = {} | ||
with open(os.path.join(here, 'ic3_labels', '__about__.py')) as fobj: | ||
exec(fobj.read(), about) | ||
|
||
setup( | ||
name='ic3_labels', | ||
version=about['__version__'], | ||
packages=find_packages(), | ||
install_requires=[ | ||
'numpy', 'click', 'pyyaml', 'scipy', 'MCEq', 'crflux', | ||
'nuVeto', | ||
], | ||
include_package_data=True, | ||
author=about['__author__'], | ||
author_email=about['__author_email__'], | ||
maintainer=about['__author__'], | ||
maintainer_email=about['__author_email__'], | ||
description=about['__description__'], | ||
url=about['__url__'] | ||
) | ||
setup() |
Empty file.