-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proposal to use pre-commit for continuous integration (#113)
* Add pre-commit * FIx typing * Play with flake8 * Fix bug * Update README.md * Remove unnecessary file
- Loading branch information
Showing
65 changed files
with
1,831 additions
and
1,787 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,44 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 23.7.0 | ||
hooks: | ||
- id: black | ||
args: [--safe, --line-length=100] | ||
- id: black-jupyter | ||
args: [--safe, --line-length=100] | ||
language_version: python3.9 | ||
|
||
- repo: https://github.com/pycqa/docformatter | ||
rev: v1.7.5 | ||
hooks: | ||
- id: docformatter | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.5.1 | ||
hooks: | ||
- id: mypy | ||
additional_dependencies: [types-PyYAML, types-tqdm] | ||
|
||
- repo: https://github.com/pycqa/doc8 | ||
rev: v1.1.1 | ||
hooks: | ||
- id: doc8 | ||
files: ^docs/.*\.(rst|md)$ | ||
|
||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 | ||
|
||
ci: | ||
autoupdate_schedule: weekly |
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
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,70 +1,62 @@ | ||
__version__ = '0.2.3' | ||
__version__ = "0.2.3" | ||
|
||
# stop jax to preallocate memory | ||
import os | ||
os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false' | ||
os.environ['XLA_PYTHON_CLIENT_ALLOCATOR'] = 'platform' | ||
|
||
os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"] = "false" | ||
os.environ["XLA_PYTHON_CLIENT_ALLOCATOR"] = "platform" | ||
|
||
from . import utils | ||
from .utils import * | ||
|
||
from . import hist | ||
from .hist import * | ||
|
||
from . import interpolation | ||
from .interpolation import * | ||
|
||
from . import config | ||
from .config import * | ||
|
||
from . import parameter | ||
from .parameter import * | ||
|
||
from . import randgen | ||
from .randgen import * | ||
|
||
from . import share | ||
from .share import * | ||
|
||
from . import plugins | ||
|
||
from . import plugin | ||
from .plugin import * | ||
|
||
from . import components | ||
from .components import * | ||
|
||
from . import component | ||
from .component import * | ||
|
||
from . import likelihood | ||
from .likelihood import * | ||
|
||
from . import contexts | ||
from .contexts import * | ||
|
||
from . import context | ||
from .context import * | ||
|
||
# check CUDA support setup | ||
from warnings import warn | ||
|
||
platform = utils.get_platform() | ||
if platform == 'cpu': | ||
warning = 'You are running appletree on CPU, which usually results in low performance.' | ||
if platform == "cpu": | ||
warning = "You are running appletree on CPU, which usually results in low performance." | ||
warn(warning) | ||
try: | ||
import jax | ||
|
||
# try allocate something | ||
jax.numpy.ones(1) | ||
except BaseException: | ||
if platform == 'gpu': | ||
print('Can not allocate memory on GPU, please check your CUDA version.') | ||
raise ImportError(f'Appletree is not correctly setup to be used on {platform.upper()}.') | ||
if platform == "gpu": | ||
print("Can not allocate memory on GPU, please check your CUDA version.") | ||
raise ImportError(f"Appletree is not correctly setup to be used on {platform.upper()}.") | ||
|
||
try: | ||
import aptext | ||
|
||
HAVE_APTEXT = True | ||
print('Using aptext package from https://github.com/XENONnT/applefiles') | ||
print("Using aptext package from https://github.com/XENONnT/applefiles") | ||
except ImportError: | ||
HAVE_APTEXT = False | ||
print('Can not find aptext') | ||
print("Can not find aptext") |
Oops, something went wrong.