Pricing guide documents a custom file path that the loader ignores

Open Beginner friendly
#2,225 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Domain
documentation

Research direction

Open docs/compute/pricing.rst and review the “Using a custom pricing file” and “Updating pricing” sections cited in the issue. Correct the custom pricing path to match the loader, and align the download-source description with the current default noted in the issue. Done when all three path references and the outdated source description accurately reflect those defaults.

Written by the indexing model from the issue text.

Description

Summary

The pricing guide tells users to put custom pricing in ~/.libcloud.pricing.json, but Libcloud reads ~/.libcloud/pricing.json. Following the documented setup leaves the custom data unused.

At current trunk 8a0ef6260680625d54fce5093d2315e0926a7dc9, the incorrect path appears twice under Using a custom pricing file and once under Updating pricing in docs/compute/pricing.rst.

Detailed Information

Reproduced with Python 3.12 on Linux using unchanged Libcloud 4.0.0.dev0. This uses temporary directories and fresh subprocesses, so an existing home-directory file or in-memory pricing cache does not affect the result. No cloud service or pricing-data download is involved.

import json
import os
import subprocess
import sys
import tempfile
from pathlib import Path

probe = '''
from libcloud import pricing
path = pricing.get_pricing_file_path()
print("selected", "custom" if path == pricing.CUSTOM_PRICING_FILE_PATH else "bundled")
try:
    print("price", pricing.get_size_price("compute", "local_probe", "small"))
except KeyError:
    print("custom driver unavailable")
'''

with tempfile.TemporaryDirectory() as tmp:
    home = Path(tmp)
    content = json.dumps({"compute": {"local_probe": {"small": 0.125}}, "storage": {}})
    (home / ".libcloud.pricing.json").write_text(content)
    env = dict(os.environ, HOME=tmp)
    subprocess.run([sys.executable, "-c", probe], env=env, check=True)
    # selected bundled
    # custom driver unavailable

    (home / ".libcloud").mkdir()
    (home / ".libcloud" / "pricing.json").write_text(content)
    subprocess.run([sys.executable, "-c", probe], env=env, check=True)
    # selected custom
    # price 0.125

The expected documentation path is ~/.libcloud/pricing.json, matching CUSTOM_PRICING_FILE_PATH, get_pricing_file_path() and the existing upgrade notes. With the documented dot-separated path, the loader silently falls back to bundled data; for this synthetic custom-only driver the lookup then raises KeyError.

The Updating pricing paragraph also says the default download source is the git repository, while the function currently defaults to DEFAULT_FILE_URL_S3_BUCKET; the preceding section already describes that S3 service. It would be useful to bring that paragraph into line with the current defaults at the same time.

This is a documentation report, not a change to actual prices or a claim about provider billing. No full test suite or live download was run.

Dominant language
Python
Stars
2.1k
Forks
935
Avg merge
5d 3h
Merged PRs (30d)
15

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/libcloud

All issues in apache/libcloud

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.