Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check_example_nbs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.8
- name: Set Up Environment
run: |
make install-uv reset-venv
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python: ["3.7", "3.12"]
python: ["3.8", "3.12"]

steps:
- name: Checkout Code
Expand All @@ -51,8 +51,8 @@ jobs:
make install-uv reset-venv
source .venv/bin/activate
make install-pinned-extras-${{ matrix.python }}
- name: Run Pytest (Python 3.7)
if: matrix.python == '3.7'
- name: Run Pytest (Python 3.8)
if: matrix.python == '3.8'
run: |
source .venv/bin/activate
export LIGHTLY_SERVER_LOCATION="localhost:-1"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_code_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python: ["3.7", "3.12"]
python: ["3.8", "3.12"]
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_minimal_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python: ["3.7"]
python: ["3.8"]
dependencies: ["minimal", "minimal-extras"]
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.8
- name: Set Up Environment
run: |
make install-uv reset-venv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_unmocked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.8
cache: pip
cache-dependency-path: |
pyproject.toml
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ formats:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
version: 3.8
install:
- method: pip
path: .
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ else
endif

# Install package with pinned extras for specific Python versions used in CI.
.PHONY: install-pinned-extras-3.7 install-pinned-extras-3.12
install-pinned-extras-3.7: install-pinned-extras-no-video
.PHONY: install-pinned-extras-3.8 install-pinned-extras-3.12
install-pinned-extras-3.8: install-pinned-extras-no-video
install-pinned-extras-3.12: install-av-system-deps install-pinned-extras

# Install package with the latest dependencies.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Community and partner projects:

## Quick Start

Lightly requires **Python 3.7+**. We recommend installing Lightly in a **Linux** or **OSX** environment. Python 3.13 is not yet supported, as PyTorch itself lacks Python 3.13 compatibility.
Lightly requires **Python 3.8+**. We recommend installing Lightly in a **Linux** or **OSX** environment. Python 3.13 is not yet supported, as PyTorch itself lacks Python 3.13 compatibility.

### Dependencies

Expand Down
2 changes: 1 addition & 1 deletion docs/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Installation
Supported Python versions
-------------------------

Lightly\ **SSL** requires Python 3.7+. We recommend installing Lightly\ **SSL** in a Linux or OSX environment.
Lightly\ **SSL** requires Python 3.8+. We recommend installing Lightly\ **SSL** in a Linux or OSX environment.

.. _rst-installing:

Expand Down
9 changes: 7 additions & 2 deletions lightly/loss/lejepa_loss.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""LeJEPA loss functions and regularizers."""

from typing import cast

import torch
from torch import Tensor, nn
from torch import distributed as torch_dist
Expand Down Expand Up @@ -202,7 +204,10 @@ def _compute_cf_error_at_each_frequency(
cos_mean = cos_sum / num_samples
sin_mean = sin_sum / num_samples
phi = self.phi.to(dtype=x_t.dtype)
return (cos_mean - phi).square() + sin_mean.square() # type: ignore[operator]
return cast(
Tensor,
(cos_mean - phi).square() + sin_mean.square(), # type: ignore[operator]
)

def _integrate_via_trapezoidal_rule(
self,
Expand All @@ -212,7 +217,7 @@ def _integrate_via_trapezoidal_rule(
"""Integrate the error over frequency using trapezoidal weights."""
weights = self.weights.to(dtype=err_per_frequency.dtype)
statistic = (err_per_frequency @ weights) * num_samples # type: ignore[operator]
return statistic.mean()
return cast(Tensor, statistic.mean())

def forward(self, proj: Tensor) -> Tensor:
"""Compute the SIGReg loss for a batch of projections.
Expand Down
2 changes: 1 addition & 1 deletion lightly/utils/lars.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __setstate__(self, state: Dict[str, Any]) -> None:
for group in self.param_groups:
group.setdefault("nesterov", False)

# Type ignore for overloads is required for Python 3.7.
# PyTorch's version-dependent overloads do not match these signatures.
@overload # type: ignore[override]
def step(self, closure: None = None) -> None: ...

Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"

[project]
name="lightly"
requires-python = ">=3.6"
requires-python = ">=3.8"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the repository guidance to the new Python floor

After raising this requirement, CLAUDE.md:58-61 still tells AI assistants that the package declares requires-python = ">=3.6" and tests old Python versions. Future assistant-authored changes following that repository guidance may unnecessarily preserve Python 3.6 compatibility or report conflicting requirements, so the guidance should be updated alongside the package metadata.

Useful? React with 👍 / 👎.

authors = [
{name = "Lightly Team", email = "team@lightly.ai"},
]
Expand All @@ -26,8 +26,6 @@ classifiers = [
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down Expand Up @@ -103,7 +101,7 @@ openapi = [
"aenum>=3.1.11"
]
timm = ["timm>=0.9.9"]
video = ["av>=8.0.3; python_version>='3.8'"]
video = ["av>=12.0.0; python_version>='3.8'"]
matplotlib = ["matplotlib>=3"]


Expand Down Expand Up @@ -135,7 +133,7 @@ lightly = ["lightly/cli/config/*.yaml"]

[tool.ruff]
line-length = 88
target-version = "py37"
target-version = "py38"
extend-exclude = ["lightly/openapi_generated"]

[tool.ruff.lint]
Expand Down
Loading