Skip to content

Commit

Permalink
Merge branch 'master' into pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep authored Oct 21, 2024
2 parents 9d9a91a + 090c1e5 commit 4751a4d
Show file tree
Hide file tree
Showing 23 changed files with 137 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ on: [push, pull_request, workflow_call]
jobs:
build:
strategy:
fail-fast: false
max-parallel: 20
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
python-version: ["3.9", "3.x"]
python-version: ["3.9", "3.12"]

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
stages: [Nonepre-commitNone, commit-msg]
stages: [pre-commit, commit-msg]
exclude_types: [html]
additional_dependencies: [tomli] # needed to read pyproject.toml below py3.11

Expand Down
4 changes: 2 additions & 2 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.3.2)
rexml (3.3.6)
strscan
rouge (3.26.0)
ruby2_keywords (0.0.5)
Expand All @@ -251,7 +251,7 @@ GEM
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
webrick (1.8.1)
webrick (1.8.2)

PLATFORMS
arm64-darwin-22
Expand Down
39 changes: 23 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,41 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [

"ruamel.yaml",
"numpy<2.0.0",
]
version = "2024.7.30"

[project.optional-dependencies]
ci = [
"pytest>=8",
"pytest-cov>=4",
"coverage",
"numpy<2.0.0",
"ruamel.yaml",
"msgpack",
"tqdm",
"pymongo",
"pandas",
"pint",
"orjson",
"types-orjson",
"types-requests",
"torch"
"coverage",
"monty[optional]",
"pytest>=8",
"pytest-cov>=4",
"types-requests",
]
# dev is for "dev" module, not for development
dev = ["ipython"]
docs = [
"sphinx",
"sphinx_rtd_theme",
]
json = [
"bson",
"orjson>=3.6.1",
"pandas",
"pydantic",
"pint",
"torch",
]
multiprocessing = ["tqdm"]
optional = ["monty[dev,json,multiprocessing,serialization]"]
serialization = ["msgpack"]
task = ["requests", "invoke"]

[tool.setuptools.packages.find]
where = ["src"]
include = ["monty"]
include = ["monty", "monty.*"]

[tool.black]
line-length = 120
Expand Down Expand Up @@ -101,3 +107,4 @@ lint.select = [
]

lint.isort.required-imports = ["from __future__ import annotations"]
lint.isort.known-first-party = ["monty"]
5 changes: 2 additions & 3 deletions src/monty/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,8 @@ def install_excepthook(hook_type: str = "color", **kwargs) -> int:
"""
try:
from IPython.core import ultratb # pylint: disable=import-outside-toplevel
except ImportError:
warnings.warn("Cannot install excepthook, IPyhon.core.ultratb not available")
return 1
except ImportError as exc:
raise ImportError("Cannot install excepthook, IPython not installed") from exc

# Select the hook.
hook = dict(
Expand Down
8 changes: 2 additions & 6 deletions src/monty/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
import errno
import gzip
import io

try:
import lzma
except ImportError:
lzma = None # type: ignore[assignment]
import lzma
import mmap
import os
import subprocess
Expand Down Expand Up @@ -49,7 +45,7 @@ def zopen(filename: Union[str, Path], *args, **kwargs) -> IO:
return bz2.open(filename, *args, **kwargs)
if ext in {".GZ", ".Z"}:
return gzip.open(filename, *args, **kwargs)
if lzma is not None and ext in {".XZ", ".LZMA"}:
if ext in {".XZ", ".LZMA"}:
return lzma.open(filename, *args, **kwargs)
return open(filename, *args, **kwargs)

Expand Down
5 changes: 1 addition & 4 deletions src/monty/itertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
import itertools
from typing import TYPE_CHECKING

try:
import numpy as np
except ImportError:
np = None
import numpy as np

if TYPE_CHECKING:
from typing import Iterable
Expand Down
Loading

0 comments on commit 4751a4d

Please sign in to comment.