Metadata-Version: 2.5
Name: lupaxa-expired
Version: 0.1.0
Summary: Tiny utility to check whether a timestamp has expired relative to UTC now.
Project-URL: Homepage, https://expired.thelupaxaproject.org/
Project-URL: Documentation, https://expired.thelupaxaproject.org/
Project-URL: Repository, https://github.com/lupaxa-developers-toolbox/expired
Project-URL: Issues, https://github.com/lupaxa-developers-toolbox/expired/issues
Author: The Lupaxa Project
License: MIT License
        
        Copyright (c) 2026 The Lupaxa Project
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENCE
Keywords: cli,expired,timedelta,timestamp
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: bump-my-version>=1.2.0; extra == 'dev'
Requires-Dist: hatch>=1.12.0; extra == 'dev'
Requires-Dist: mkdocs-material==9.7.7; extra == 'dev'
Requires-Dist: mkdocs==1.6.1; extra == 'dev'
Requires-Dist: mypy>=1.12.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6.0; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest-cov>=5.0; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Description-Content-Type: text/markdown

<!-- markdownlint-disable -->
<p align="center">
  <a href="https://github.com/lupaxa-developers-toolbox">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/organisations/developers-toolbox/readme-logo.png" alt="Project Logo" width="256"/><br/>
  </a>
</p>
<h3 align="center">
  The Lupaxa Developers Toolbox<br />
  Part of The Lupaxa Project
</h3>

<br />

# lupaxa-expired

Tiny utility to check whether a timestamp has expired relative to UTC now.
A value is expired when it is strictly earlier than `(now - delta)`. With
no window, `delta` is zero: anything before UTC now is expired, and a time
equal to now is not.

Built for scripts and tools used by The Lupaxa Project.

The PyPI name is `lupaxa-expired`. The import path is `lupaxa.expired`.
The CLI is installed as `expired`.

## Features

- Accepts ISO, SQL, and date-only timestamp strings, or a `datetime`
- Optional window via `timedelta` or parts: years, months, weeks, days, hours, minutes, seconds
- Timezone-aware UTC comparison (naive values treated as UTC)
- Library API returns a boolean; equal-to-cutoff is not expired
- CLI with `--version`, stdout `expired` / `not expired`, and shell exit codes
- Fully typed, linted, formatted, and tested
- No runtime dependencies

## Installation

### From PyPI

```bash
pip install lupaxa-expired
```

### From source (development mode)

```bash
pip install -e ".[dev]"
```

Requires Python 3.10+. `lupaxa` is a namespace package — there is no
`lupaxa/__init__.py`.

## Usage

```python
from datetime import datetime, timedelta, timezone
from lupaxa.expired import is_expired

if is_expired("2022-10-19 14:43:57.563803"):
    print("Expired")

cutoff = datetime(2025, 11, 6, 12, 0, 0, tzinfo=timezone.utc)
is_expired("2025-10-01", days=3, now=cutoff)
is_expired(cutoff - timedelta(hours=72), hours=48, now=cutoff)
is_expired("2025/11/01 14:43:57", fmt="%Y/%m/%d %H:%M:%S", days=2, now=cutoff)
```

Built-in string formats include `YYYY-MM-DD`, `YYYY-MM-DD HH:MM:SS[.ffffff]`,
and ISO-8601 with an optional `Z`. Pass `fmt=` for anything else. Years
are 365 days and months are 30 days.

```bash
expired --time "2022-10-19 14:43:57.563803"
expired --time "2022-10-19 14:43:57.563803" --days 3
expired --time "2024-11-06T09:00:00Z" --hours 12
expired --time "2024/11/06 09:00:00" --format "%Y/%m/%d %H:%M:%S" --days 1
expired --version
expired --help
```

The CLI prints `expired` or `not expired`. Exit `0` means not expired
(or `--version`), `1` means expired, and `2` means bad input.

Delta flags: `--years`, `--months`, `--weeks`, `--days`, `--hours`,
`--minutes`, `--seconds`.

## Development

```bash
make init
make python-install-dev
make python-check
make mkdocs-serve
```

Documentation: <https://expired.thelupaxaproject.org/>.

<a href="https://github.com/the-lupaxa-project">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/components/footer-for-child-orgs.svg" alt="The Lupaxa Project Footer" width="100%" />
</a>
