Metadata-Version: 2.1
Name: lektorlib
Version: 1.2.1
Summary: A few bits which are potentially useful to developers of Lektor plugins
Keywords: Lektor utilities
Author-Email: Jeff Dairiki <dairiki@dairiki.org>
License: Copyright © 2020 Geoffrey T. Dairiki
        
        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.
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Framework :: Lektor
Classifier: Environment :: Plugins
Classifier: Topic :: Software Development :: Libraries
Project-URL: Home, https://github.com/dairiki/lektorlib
Requires-Python: >=3.7
Description-Content-Type: text/markdown

# Lektorlib

[![PyPI version](https://img.shields.io/pypi/v/lektorlib.svg)](https://pypi.org/project/lektorlib/)
[![PyPI Supported Python Versions](https://img.shields.io/pypi/pyversions/lektorlib.svg)](https://pypi.python.org/pypi/lektorlib/)
[![GitHub license](https://img.shields.io/github/license/dairiki/lektorlib)](https://github.com/dairiki/lektorlib/blob/master/LICENSE)
[![GitHub Actions (Tests)](https://github.com/dairiki/lektorlib/workflows/Tests/badge.svg)](https://github.com/dairiki/lektorlib)
[![Trackgit Views](https://us-central1-trackgit-analytics.cloudfunctions.net/token/ping/lhaqecdxux7krt01vbsl)](https://trackgit.com)

A few bits which may possibly be useful to developers of [Lektor][] plugins.

## Bits Included

### `lektorlib.query.PrecomputedQuery`

A subclass of `lektor.db.Query` which yields a pre-computed
sequence of children.

This is useful in (at least) two circumstances:

First, when the children to be queried are virtual source objects,
the standard `lektor.db.Query` will not work.  This version will.

Second, when we would like to generate a query of a pre-computed
subset of a resource's children, this prevents intruducing
unnecessary build dependencies.  If we used a standard query with
a filter applied, it still iterates over all of the parent node’s
children, registering dependencies on all of them.

### `lektorlib.context.disable_dependency_recording`

A python context manager which (temporarily) disables lektor’s
dependency recording system.

### `lektorlib.recordcache.get_or_create_virtual`

This function is a helper to streamline the caching of virtual
source objects in the lektor record cache.

`Lektor.db.Pad.get()` handles caching for regular records.
At present, however, it does not appear that it ever caches
virtual source objects, even though its record cache is perfectly
capable of doing so.

### `lektorlib.testing.assert_no_dependencies(match=None)`

This context manager is a testing helper which can be used to
check that no dependencies are recorded with lektor’s dependency
tracking system.

## Author

Jeff Dairiki <dairiki@dairiki.org>

[Lektor]: <https://www.getlektor.com/> "Lektor Static Content Management System"

## Changelog

### Release 1.2.1 (2023-06-15)

#### Type Annotations

- Narrow the return type of `lektorlib.recordcache.get_or_create_virtual`.
- Convert `lektorlib.query.PrecomputedQuery` to a generic type.

### Release 1.2.0 (2023-06-02)

- Added type annotations
- Use PDM instead of setuptools to build distribution
- Configured pre-commit
- Run black and reorder-python-imports on the code

### Release 1.1.0 (2023-04-20)

Fixes for Lektor 3.4 (in pre-release).

We now test under Lektor 3.3 and Lektor 3.4 (pre-release).

### Release 1.0 (2022-01-28)

Drop support for python < 3.7. Test under python 3.10.

### Release 0.1 (2021-02-05)

No code changes.

Release is now classified as "production/stable".

### Release 0.1a1 (2020-05-05)

Initial release.
