21855: Update URL path for RPMs
[arvados.git] / sdk / python / arvados / __init__.py
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4 """Arvados Python SDK
5
6 This module provides the entire Python SDK for Arvados. The most useful modules
7 include:
8
9 * arvados.api - After you `import arvados`, you can call `arvados.api` as a
10   shortcut to the client constructor function `arvados.api.api`.
11
12 * arvados.collection - The `arvados.collection.Collection` class provides a
13   high-level interface to read and write collections. It coordinates sending
14   data to and from Keep, and synchronizing updates with the collection object.
15
16 * arvados.util - Utility functions to use mostly in conjunction with the API
17   client object and the results it returns.
18
19 Other submodules provide lower-level functionality.
20 """
21
22 import logging as stdliblog
23 import os
24 import sys
25 import types
26
27 from collections import UserDict
28
29 from . import api, errors, util
30 from .api import api_from_config, http_cache
31 from .collection import CollectionReader
32 from arvados.keep import *
33 from .arvfile import StreamFileReader
34 from .logging import log_format, log_date_format, log_handler
35 from .retry import RetryLoop
36
37 # Previous versions of the PySDK used to say `from .api import api`.  This
38 # made it convenient to call the API client constructor, but difficult to
39 # access the rest of the `arvados.api` module. The magic below fixes that
40 # bug while retaining backwards compatibility: `arvados.api` is now the
41 # module and you can import it normally, but we make that module callable so
42 # all the existing code that says `arvados.api('v1', ...)` still works.
43 class _CallableAPIModule(api.__class__):
44     __call__ = staticmethod(api.api)
45 api.__class__ = _CallableAPIModule
46
47 # Override logging module pulled in via `from ... import *`
48 # so users can `import arvados.logging`.
49 logging = sys.modules['arvados.logging']
50
51 # Set up Arvados logging based on the user's configuration.
52 # All Arvados code should log under the arvados hierarchy.
53 logger = stdliblog.getLogger('arvados')
54 logger.addHandler(log_handler)
55 logger.setLevel(stdliblog.DEBUG if config.get('ARVADOS_DEBUG')
56                 else stdliblog.WARNING)