## settings.S3Settings


S3 profile and botocore tuning from `<PREFIX>ENDPOINT_URL` and friends.


Usage

``` python
settings.S3Settings()
```


Authentication is by named AWS profile only: `<PREFIX>PROFILE` selects a section of `~/.aws/credentials` (or of `AWS_SHARED_CREDENTIALS_FILE`), so no access key ever passes through the environment. Selecting a profile explicitly also drops boto's environment-variable provider from the credential chain, so a stray `AWS_ACCESS_KEY_ID` in a shell cannot sign these requests.

`<PREFIX>ENDPOINT_URL` is optional. Without it, the endpoint is whatever the profile's config section sets, which is where botocore, s3fs and `~freezebase.s3.s3_env()` all read it from.

Build one with [from_env()](settings.S3Settings.md#freezebase.settings.S3Settings.from_env), which fixes the prefix.


## Methods

| Name | Description |
|----|----|
| [from_env()](#from_env) | Read the settings whose variable names start with `prefix`. |
| [make_upath()](#make_upath) | Open an `s3://` URI with these settings. |
| [resolve_path()](#resolve_path) | Resolve a local path or an `s3://` URI. |

------------------------------------------------------------------------


#### from_env()


Read the settings whose variable names start with `prefix`.


Usage

``` python
from_env(prefix)
```


##### Parameters


`prefix: str`  
Environment variable prefix, such as `"GLACE_S3_"`.


##### Returns


`S3Settings`  
The settings, remembering the prefix for its error messages.


------------------------------------------------------------------------


#### make_upath()


Open an `s3://` URI with these settings.


Usage

``` python
make_upath(uri)
```


##### Parameters


`uri: str`  
An `s3://` URI.


##### Returns


`UPath`  
The path, carrying the profile, endpoint, checksum policies and the retry budget `~freezebase.s3.make_s3_upath()` applies.


##### Raises


`ValueError`  
If no profile is configured.


------------------------------------------------------------------------


#### resolve_path()


Resolve a local path or an `s3://` URI.


Usage

``` python
resolve_path(raw)
```


##### Parameters


`raw: str`  
A filesystem path, possibly `~`-prefixed, or an `s3://` URI.


##### Returns


`Path or UPath`  
A `~pathlib.Path` for a local value, else the URI opened with [make_upath()](settings.S3Settings.md#freezebase.settings.S3Settings.make_upath), so downstream code does not branch on the storage backend.


##### Raises


`ValueError`  
If `raw` is an `s3://` URI and no profile is configured.
