Skip to content

Commit

Permalink
Merge branch 'main' into bump/py3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Nov 25, 2024
2 parents 6612d2b + a6a350f commit fdc8907
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ coverage:
# https://codecov.readme.io/v1.0/docs/commit-status
project:
default:
informational: true
target: 99% # specify the target coverage for each commit status
threshold: 30% # allow this little decrease on project
# https://github.com/codecov/support/wiki/Filtering-Branches
Expand All @@ -27,6 +28,7 @@ coverage:
# https://github.com/codecov/support/wiki/Patch-Status
patch:
default:
informational: true
target: 50% # specify the target "X%" coverage to hit
# threshold: 50% # allow this much decrease on patch
changes: false
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/ci-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test CLI

on:
push:
branches: [main, "release/*"]
pull_request:
branches: [main, "release/*"]

defaults:
run:
shell: bash

jobs:
test-cli:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.10"]
timeout-minutes: 10
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
- name: Set up Python 🐍 ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: install package
run: |
pip install -e '.[cli]'
pip list
- name: run CLI
working-directory: ./requirements
run: |
python -m lightning_utilities.cli version
python -m lightning_utilities.cli --help
python -m lightning_utilities.cli requirements set-oldest --req_files="cli.txt"
python -m lightning_utilities.cli requirements set-oldest --req_files='["cli.txt", "docs.txt"]'
cli-guardian:
runs-on: ubuntu-latest
needs: test-cli
if: always()
steps:
- run: echo "${{ needs.test-cli.result }}"
- name: failing...
if: needs.test-cli.result == 'failure'
run: exit 1
- name: cancelled or skipped...
if: contains(fromJSON('["cancelled", "skipped"]'), needs.test-cli.result)
timeout-minutes: 1
run: sleep 90
8 changes: 3 additions & 5 deletions .github/workflows/ci-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "macos-13", "windows-2022"]
python-version: ["3.9", "3.12"]
timeout-minutes: 35
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.10"]
timeout-minutes: 15
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 🐍 ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on: # Trigger the workflow on push or pull request, but only for the master bran
tags: ["v?[0-9]+.[0-9]+.[0-9]+"]
release:
types: [published]
pull_request:
branches: [main]

defaults:
run:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- CLI: update parsing inputs ([#333](https://github.com/Lightning-AI/utilities/pull/333))



## [0.11.9] - 2024-11-19

### Changed

- CI: split and rename `custom-import` to `custom-import-code` ([#325](https://github.com/Lightning-AI/utilities/pull/325))

### Fixed

- fixed missing package's CLI ([#332](https://github.com/Lightning-AI/utilities/pull/332))


## [0.11.8] - 2024-10-15

Expand Down
5 changes: 2 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include CHANGELOG.md
include src/lightning_utilities/py.typed
graft src/lightning_utilities/test
recursive-include src py.typed

graft requirements
prune src/lightning_utilities/cli
2 changes: 1 addition & 1 deletion src/lightning_utilities/__about__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import time

__version__ = "0.11.8"
__version__ = "0.11.9"
__author__ = "Lightning AI et al."
__author_email__ = "pytorch@lightning.ai"
__license__ = "Apache-2.0"
Expand Down
6 changes: 4 additions & 2 deletions src/lightning_utilities/cli/__main__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Copyright The PyTorch Lightning team.
# Copyright The Lightning AI team.
# Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0
#

import lightning_utilities
from lightning_utilities.cli.dependencies import prune_pkgs_in_requirements, replace_oldest_ver


Expand All @@ -14,7 +15,8 @@ def main() -> None:
"requirements": {
"prune-pkgs": prune_pkgs_in_requirements,
"set-oldest": replace_oldest_ver,
}
},
"version": lambda: print(lightning_utilities.__version__),
})


Expand Down
13 changes: 10 additions & 3 deletions src/lightning_utilities/cli/dependencies.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Copyright The PyTorch Lightning team.
# Copyright The Lightning AI team.
# Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0
#
import glob
import os.path
from collections.abc import Sequence
from pprint import pprint
from typing import Sequence, Union

REQUIREMENT_ROOT = "requirements.txt"
REQUIREMENT_FILES_ALL: list = glob.glob(os.path.join("requirements", "*.txt"))
Expand All @@ -14,8 +15,12 @@
REQUIREMENT_FILES_ALL += [REQUIREMENT_ROOT]


def prune_pkgs_in_requirements(packages: Sequence[str], req_files: Sequence[str] = REQUIREMENT_FILES_ALL) -> None:
def prune_pkgs_in_requirements(
packages: Union[str, Sequence[str]], req_files: Union[str, Sequence[str]] = REQUIREMENT_FILES_ALL
) -> None:
"""Remove some packages from given requirement files."""
if isinstance(packages, str):
packages = [packages]
if isinstance(req_files, str):
req_files = [req_files]
for req in req_files:
Expand Down Expand Up @@ -44,7 +49,9 @@ def _replace_min(fname: str) -> None:
fw.write(req)


def replace_oldest_ver(req_files: Sequence[str] = REQUIREMENT_FILES_ALL) -> None:
def replace_oldest_ver(req_files: Union[str, Sequence[str]] = REQUIREMENT_FILES_ALL) -> None:
"""Replace the min package version by fixed one."""
if isinstance(req_files, str):
req_files = [req_files]
for fname in req_files:
_replace_min(fname)
2 changes: 1 addition & 1 deletion src/lightning_utilities/core/apply_func.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The PyTorch Lightning team.
# Copyright The Lightning AI team.
# Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0
#
Expand Down
2 changes: 1 addition & 1 deletion src/lightning_utilities/core/enums.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The PyTorch Lightning team.
# Copyright The Lightning AI team.
# Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0
#
Expand Down
2 changes: 1 addition & 1 deletion src/lightning_utilities/core/imports.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The PyTorch Lightning team.
# Copyright The Lightning AI team.
# Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0

Expand Down
2 changes: 1 addition & 1 deletion src/lightning_utilities/core/inheritance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The PyTorch Lightning team.
# Copyright The Lightning AI team.
# Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0
#
Expand Down
2 changes: 1 addition & 1 deletion src/lightning_utilities/core/overrides.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The PyTorch Lightning team.
# Copyright The Lightning AI team.
# Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0
#
Expand Down
2 changes: 1 addition & 1 deletion src/lightning_utilities/core/rank_zero.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The PyTorch Lightning team.
# Copyright The Lightning AI team.
# Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0
#
Expand Down

0 comments on commit fdc8907

Please sign in to comment.