Overview
This is a command line tool used for retrieving images from various image search backends (e.g. Unsplash, Google). This tool is primarily developed for educational purposes to show people how to develop plugin friendly Python applications. Furthermore, it is an example project that shows how to effectively pair a handful of popular Python libraries to write command line applications.
To facilitate our plugin architecture, the pluggy library is used. Other libraries used include the following:
- click: used for structuring the command line application 🖱 💻
- pydantic: used for handling configuration file validation 🗃
- rich: used for UX/UI elements and generally making the application more pretty 🌈
Why "latz"
"latz" is short and easy to type! This is super important when writing CLI programs. I also might add a geolocation search feature, so it is a reference to the word "latitude".
Quick Start
Installation
latz is available for install either on PyPI:
# Run from a new virtual environment
$ pip install latz
or my own anaconda.org channel:
$ conda create -n latz 'thath::latz'
If you are interested in tinkering around with the code yourself, you can also run it locally:
$ git clone git@github.com:/travishathaway/latz.git
$ cd latz
# Create a virtual environment however you like..
$ pip install -e .
Usage
Latz comes initially configured with the "unsplash" image search backend. To use this, you will need to create an Unsplash account and create a test application. After getting your "access_key", you can set this value by running this command:
$ latz config set search_backend_settings.unsplash.access_key=<YOUR_ACCESS_KEY>
Once this is configured, you can search Unsplash for bunny pictures:
$ latz search "bunny"
[
ImageSearchResultSet(
results=(
ImageSearchResult(
url='https://unsplash.com/photos/u_kMWN-BWyU/download?ixid=MnwzOTMwOTR8MHwxfHNlYXJjaHwxfHxidW5ueXxlbnwwfHx8fDE2Nzk0MTA2NzQ',
width=3456,
height=5184
),
# ... results truncated
),
total_number_results=10,
search_backend='unsplash'
)
]
Configuring
The configuration for latz is stored in your home direct and is in the JSON format. Below is a what a default version of this configuration looks like:
{
"search_backends": [
"unsplash"
],
"search_backend_settings": {
"placeholder": {
"type": "kitten"
},
"unsplash": {
"access_key": "your-access-key"
}
}
}
Latz will also search in your current working directory for a .latz.json file and use this in your configuration.
Files in the current working directory will be prioritized over your home directory location.
To see other available image search backends, see Available image search backends below.
Available image search backends
Here are a list of the available search backends:
Built-in
- "unsplash"
- "placeholder"
Third-party
How to extend and write your own image search backend
Please see the creating plugins guide in the documentation.
Metadata
Release files for latz 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| latz-0.2.1.tar.gz | 28.0 kB | Without provenance | Details for latz-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| latz-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for latz-0.2.1-py3-none-any.whl |
Total release size: 59.9 kB
Release files / latz-0.2.1.tar.gz
| Download URL | latz-0.2.1.tar.gz |
|---|---|
| Size | 28.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2064d9589c8554cd3c35ab48ffa71bd3005b541227358c42b6531fa5dc573c0
|
|
BLAKE2b-256 checksum How to use checksums |
096c47a9cf224117f09bf17b62d6b4fb262534601ee449d39fc1e5fae9631c40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.0 Darwin/21.3.0
|
Release files / latz-0.2.1-py3-none-any.whl
| Download URL | latz-0.2.1-py3-none-any.whl |
|---|---|
| Size | 31.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
013dcf2aaaebf1b9c923c65a195b74301c424acce0ac2d9322d10fded66b813a
|
|
BLAKE2b-256 checksum How to use checksums |
b0298daf7998377a053f17c171160609dc93260b9d07626b1030fd17bac5d876
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.0 Darwin/21.3.0
|
Security for latz 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.