Skip to main content

pykew: Python library for accessing Kew’s data services

Library for easy access to Kew’s nomenclatural and taxonomic services. Hides the intricacies of using the HTTP API.

https://travis-ci.com/RBGKew/pykew.svg?branch=master https://badge.fury.io/py/pykew.svg

IPNI

Module for searching IPNI data and looking up individual records.

Filtering

You can filter a given result set by taxonomic rank.

import pykew.ipni as ipni
from pykew.ipni_terms import Filters

res = ipni.search('Poa', filters = Filters.infraspecific)

Available Filters

Filters
  • familial

  • infrafamilial

  • generic

  • infrageneric

  • specific

  • infraspecific

Using results

Results sets are returned as an iterator which can be manipulated as you generally would in python. The result object also implements size() efficiently - it does not fetch all results to count them.

import pykew.ipni as ipni
from pykew.ipni_terms import Name

query = { Name.genus: 'Poa', Name.species: 'annua' }
res = ipni.search(query)

res.size()
[r['name'] for r in res if 'name' in r]

POWO

Module for searching POWO data and looking up individual records. Taxonomic data is returned by default, but other associated such as distributions and descriptive text can also be retrieved.

Simple search

import pykew.powo as powo

result = powo.search('Poa annua')

Advanced search

import pykew.powo as powo
from pykew.powo_terms import Name

query = { Name.genus: 'Poa', Name.species: 'annua' }
res = powo.search(query)

Available Search Terms

To build complex queries, use the search terms available in powo_terms. Query term are grouped into the modules Name, Characteristic, and Geography.

Name
  • full_name

  • common_name

  • kingdom

  • family

  • genus

  • species

  • author

Characteristic
  • summary

  • appearance

  • characteristic

  • flower

  • fruit

  • leaf

  • inflorescence

  • seed

  • cloning

  • use

Geography
  • distribution

Filtering

You can filter a given result set by accepted taxa, taxa with images, and taxonomic rank.

import pykew.powo as powo
from pykew.powo_terms import Filters

res = powo.search('Poa', filters = [Filters.accepted, Filters.species])

Available Filters

Filters
  • accepted

  • has_images

  • families

  • genera

  • species

  • infraspecies

Individual record

import pykew.powo as powo

res = powo.lookup('urn:lsid:ipni.org:names:320035-2')

Extra Data

The standard data returned by the POWO api includes taxonomic and nomenclatural information, but there are other data you can request.

Currently you can only retrieve distribution data, but other data should be exposed in the future.

import pykew.powo as powo

res = powo.lookup('urn:lsid:ipni.org:names:320035-2', include=['distribution'])
native_to = [d['name'] for d in res['distribution']['natives']]

Using results

Results sets are returned as an iterator which can be manipulated as you generally would in python. The result object also implements size() efficiently - it does not fetch all results to count them.

import pykew.powo as powo
from pykew.powo_terms import Name, Geography

query = { Name.genus: 'Poa', Geography.distribution: 'Africa' }
res = powo.search(query)

res.size()
[r['name'] for r in res if 'name' in r]

Metadata

Release files for pykew 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pykew 0.1.3
File Size Uploaded Provenance Actions
pykew-0.1.3.tar.gz 7.0 kB Without provenance Details for pykew-0.1.3.tar.gz

Release files / pykew-0.1.3.tar.gz

Download URL pykew-0.1.3.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
919883d9a5680bef4f016002ce3855f9629a44c1c6990f327cf7e30b6ecd7c3c
BLAKE2b-256 checksum
How to use checksums
f4ab986a0f46ee18d72f590b3eb48517b222afeaa01afaf6824f6f32c8bb9317
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.6

Security for pykew 0.1.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page