Registry / crm-productivity / launchpadlib

launchpadlib

JSON →
library2.1.0pypypi✓ verified 84d ago

launchpadlib is an officially supported Python library for scripting Launchpad.net through its web services interfaces. It allows interaction with Launchpad objects like bugs, blueprints, and packages. The current version is 2.1.0, and it generally follows an as-needed release cadence for bug fixes and Python compatibility updates.

pip install launchpadlib
INSTALL
IMPORT
SIG · LAUNCHPADLIB
L
launchpadlib
crm-productivitypythonv2.1.0
Install
2.4s avg
Import
583ms
Disk
26MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.615s · 23.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.4s · import 0.550s · 24MB
26MB installed
● package 26MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Launchpad
from launchpadlib.launchpad import Launchpad

This quickstart demonstrates both anonymous and authenticated access to the Launchpad API. Anonymous access is suitable for reading public data. Authenticated access (via `login_with_creds`) allows for private data access and write operations, often requiring interactive credential setup or pre-existing credential files for automated scripts. Remember to use a unique application name.

import os from launchpadlib.launchpad import Launchpad # Anonymous access (read-only for most public data) # Use a unique application name, e.g., 'my-app-name-dev' launchpad_anon = Launchpad.login_anonymously('my-checklist-day-app', 'production') print(f"Logged in anonymously as {launchpad_anon.me}") # Authenticated access (for writing data, private access) # This will prompt for credentials if not already cached. # Launchpad credentials are often stored in ~/.launchpadlib/creds # To avoid interactive prompts in automated scripts, ensure credentials # are pre-configured or use a 'testing' or 'staging' service root. # For example, to avoid prompting, you could use: # launchpad_auth = Launchpad.login_with_creds( # 'my-checklist-day-app-auth', # 'production', # credentials_file='~/.launchpadlib/creds_my_app' # ) try: # This may prompt for credentials interactively if not cached launchpad_auth = Launchpad.login_with_creds('my-checklist-day-app-auth', 'production') print(f"Logged in as {launchpad_auth.me}") # Example: Access your personal information # print(f"My email address: {launchpad_auth.me.preferred_email_address}") except Exception as e: print(f"Could not log in with credentials: {e}") print("To enable authenticated access, run this script interactively once to cache credentials.") # Example of using the anonymous connection to get a person: person = launchpad_anon.people['canonical'] print(f"Canonical's display name: {person.display_name}")
Debug
Known issues
breakinglaunchpadlib 2.0.0+ requires Python 3.8 and is incompatible with Python 2.x. Older versions (pre-2.0.0) were Python 2 only.
fix
Upgrade to Python 3.8+ and install launchpadlib 2.x. If you have legacy Python 2 code, it will require porting.
affects: <2.0.0
gotchaSSL/TLS Certificate Verification Errors due to `httplib2` dependency.
fix
Ensure your system's CA certificates are up-to-date. In some cases, configuring `HTTP_PROXY` or `HTTPS_PROXY` environmental variables incorrectly can also lead to issues. If strictly necessary and aware of security implications, you might temporarily disable verification (e.g., `httplib2.Http(disable_ssl_certificate_validation=True)`), but this is not recommended for production.
affects: All versions using `httplib2` (including 2.x)
gotchaAuthentication issues with `login_with_creds` in non-interactive environments.
fix
For automated scripts, ensure credentials are pre-cached by running the script once interactively, or explicitly provide a `credentials_file` argument to `login_with_creds` pointing to a file with pre-obtained credentials (e.g., `~/.launchpadlib/creds`). Ensure your application name is consistent.
affects: All versions
gotchaLaunchpad API Rate Limiting can cause requests to fail with HTTP 429 Too Many Requests.
fix
Implement exponential backoff and retry logic for your API calls. Design your scripts to make efficient use of the API, fetching data in batches where possible rather than individual items.
affects: All versions
Errors
Common errors & fixes
ImportError: No module named 'launchpadlib.launchpad'
launchpadlib is not installed, or you are running in a different Python environment than where it was installed.
fix
Ensure launchpadlib is installed in your active Python environment: `pip install launchpadlib`.
launchpadlib.errors.HTTPError: [401] Unauthorized
Attempted to access private data or perform an action requiring authentication without valid credentials, or the provided credentials are incorrect/expired.
fix
Use `Launchpad.login_with_creds()` and ensure you have valid, cached credentials. If running interactively, it should prompt you. For scripts, verify `~/.launchpadlib/creds` exists and is valid, or explicitly provide a `credentials_file`.
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:XXXX)
The underlying `httplib2` library is failing to verify the SSL certificate of Launchpad.net. This can be due to outdated system CA certificates or network configurations (e.g., corporate proxies intercepting SSL).
fix
Update your operating system's CA certificates. If behind a corporate proxy, consult your IT department for proper proxy configuration (e.g., `HTTP_PROXY`, `HTTPS_PROXY` env vars) or necessary custom certificate installations.
launchpadlib.errors.HTTPError: [404] Not Found
The requested Launchpad object (e.g., a person, bug, project) does not exist or its URL is incorrect.
fix
Double-check the identifier or URL you are using. For example, ensure the person's Launchpad ID or project name is spelled correctly.
Upgrade
Version history
2.1.0latest on PyPI · released Jan 16, 2025
Audit
Dependencies
lazr.restfulclientrequiredProvides the RESTful client base for interacting with Launchpad's API.
httplib2requiredUsed for HTTP communication. Can sometimes cause SSL/TLS issues with older versions or configurations.
requests-unixsocketrequiredProvides Unix domain socket support for requests.
python-subunitrequiredUsed for parsing subunit streams, often in testing contexts.
Agent activity
40 hits · last 30 days
node
36
OpenAI (training)
1
Resources
launchpadlib — pip install launchpadlib · libregistry