Skip to content

Commit

Permalink
Ruff update (#1255)
Browse files Browse the repository at this point in the history
* Update uv lockfile dependencies

* fix mypy errors

* pre commit auto update

* add ry to shed

* testing cicd

* fix cicd issue

* ruff format

* use uv python version

* update uv lock!?

* ruff update

---------

Co-authored-by: dan-costello <[email protected]>
  • Loading branch information
jessekrubin and dan-costello authored Jan 9, 2025
1 parent d220bd7 commit e640f2e
Show file tree
Hide file tree
Showing 10 changed files with 678 additions and 80 deletions.
30 changes: 20 additions & 10 deletions .github/workflows/dgpy-libs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,37 @@ jobs:
test:
runs-on: ubuntu-latest

# matrix of python versions to test against
strategy:
matrix:
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]

# set uv environment variables
steps:
- uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: install-uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
python-version: ${{ matrix.python-version }}
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
# - name: install-uv
# run: curl -LsSf https://astral.sh/uv/install.sh | sh
# - name: python-sane-setup
# run: |
# python -m pip install --upgrade pip
# - name: setup-poetry
# id: setup-poetry
# uses: ./.github/actions/setup-poetry
# id: setup-poetry
# uses: ./.github/actions/setup-poetry
- name: uv-sync
run: uv sync --all-extras --dev
# - name: Install dependencies
# run: |
# poetry install
# run: |
# poetry install

- name: test-dgpydev
run: |
Expand Down Expand Up @@ -186,8 +196,8 @@ jobs:
# uses: ./.github/actions/setup-poetry

# - name: poetry install
# run: |
# poetry install
# run: |
# poetry install
- name: install docs deps
run: uv pip install '.[docs]'
- name: mkdocs build
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.8.4
rev: v0.9.0
hooks:
- id: ruff
- id: ruff-format
6 changes: 3 additions & 3 deletions libs/fmts/src/fmts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,11 @@ def nseconds(nsec: float) -> str:
elif nsec == 0.0:
return "0 sec"
elif 0.000001 > nsec >= 0.000000001:
return f"{(10 ** 9) * nsec:.3f} ns"
return f"{(10**9) * nsec:.3f} ns"
elif 0.001 > nsec >= 0.000001:
return f"{(10 ** 6) * nsec:.3f} μs"
return f"{(10**6) * nsec:.3f} μs"
elif 1 > nsec >= 0.001:
return f"{(10 ** 3) * nsec:.3f} ms"
return f"{(10**3) * nsec:.3f} ms"
elif nsec < 60:
return f"{nsec:.3f} sec"
elif nsec < 3600:
Expand Down
12 changes: 6 additions & 6 deletions libs/h5/tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def test_h5_core_exports():
and el
not in {"File", "Group", "__h5py_version__", "Dataset", "AttributeManager"}
]
assert (
not incorrectly_exported
), f"incorrectly exported members: {incorrectly_exported}"
assert not incorrectly_exported, (
f"incorrectly exported members: {incorrectly_exported}"
)


def test_h5_info_exports():
Expand All @@ -64,9 +64,9 @@ def test_h5_info_exports():
and el
not in {"File", "Group", "__h5py_version__", "Dataset", "AttributeManager"}
]
assert (
not incorrectly_exported
), f"incorrectly exported members: {incorrectly_exported}"
assert not incorrectly_exported, (
f"incorrectly exported members: {incorrectly_exported}"
)


def test_h5_exports():
Expand Down
2 changes: 1 addition & 1 deletion libs/jsonbourne/src/jsonbourne/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def __setitem(self, key: _KT, value: _VT, identifier: bool = False) -> None:
return None
if identifier and not is_identifier(key):
raise ValueError(
f"Invalid key: ({key}).\n" f"Key(s) is not a valid python identifier"
f"Invalid key: ({key}).\nKey(s) is not a valid python identifier"
)
self._data[key] = value

Expand Down
6 changes: 3 additions & 3 deletions libs/requires/tests/test_shed.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ def test_shed_exports():

def test_all_sorted():
expected = tuple(sorted(set(requires_shed.__all__)))
assert requires_shed.__all__ == tuple(
sorted(set(requires_shed.__all__))
), f"__all__ should be sorted -- __all__ = {expected}"
assert requires_shed.__all__ == tuple(sorted(set(requires_shed.__all__))), (
f"__all__ should be sorted -- __all__ = {expected}"
)
6 changes: 3 additions & 3 deletions libs/shellfish/tests/test_shellfish_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def _test_module_members_missing_from_all(mod: ModuleType) -> None:
members = [e for e in dir(mod) if not e.startswith("_")]
dunder_all_public = [e for e in mod.__all__ if not e.startswith("_")]
missing_members = [m for m in dunder_all_public if m not in members]
assert (
not missing_members
), f"missing members in {mod_name}.__all__: {missing_members}"
assert not missing_members, (
f"missing members in {mod_name}.__all__: {missing_members}"
)


def _is_defined_under_shellfish(member: Any, mod: ModuleType = shellfish) -> bool:
Expand Down
22 changes: 11 additions & 11 deletions libs/xtyping/tests/test_xtyping.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,18 @@ def test_xtyping_has_all_typing_extensions_members():
- set(xtyping.__all_typing_extensions_future__)
)
_xtyping_all_set = set(xtyping.__all_typing_extensions__) - all_typing
assert (
_xtyping_all_set == _typing_extensions_members
), "xtyping.__all_typing_extensions__ is missing: {} \n SHOULD BE: \n__all_typing_extensions__ = {}".format(
tuple(sorted(set(_typing_extensions_members - _xtyping_all_set))),
tuple(
sorted(
set(
list(_xtyping_all_set)
+ list(_typing_extensions_members - _xtyping_all_set)
assert _xtyping_all_set == _typing_extensions_members, (
"xtyping.__all_typing_extensions__ is missing: {} \n SHOULD BE: \n__all_typing_extensions__ = {}".format(
tuple(sorted(set(_typing_extensions_members - _xtyping_all_set))),
tuple(
sorted(
set(
list(_xtyping_all_set)
+ list(_typing_extensions_members - _xtyping_all_set)
)
)
)
),
),
)
)


Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "dgpydev"
version = "0.1.0"
description = "dgpy-libs development"
readme = "README.md"
requires-python = ">=3.11"
requires-python = ">=3.9"
classifiers = [
"Private :: Do Not Upload",
"Programming Language :: Python :: 3 :: Only",
Expand Down Expand Up @@ -140,6 +140,7 @@ lint.ignore = [
"UP022", # must test shellfish first...
"UP035", # unnecessary typing-extensions imports... must check xtying...
"UP037",
"UP045", # union type over `Optional`
]
lint.per-file-ignores."**/conftest.py" = ["D"]
lint.per-file-ignores."**/noxfile.py" = ["D"]
Expand Down
Loading

0 comments on commit e640f2e

Please sign in to comment.