Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuf Khan authored and Yusuf Khan committed Sep 11, 2023
1 parent a1f1a31 commit 0a16087
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ The secondary aim is for it to extend the functionality with some additional sca
-- INFO HERE --

---
## Installation
## Installation & Init

Currently supports Windows, Mac (Apple Silicon and Intel)
Currently supports x86_64, and Apple Silicon

> 📢 _**Important:** For both convenience and the purpose of behaving as a python native library; installing azpype will additionally download the platform appropriate precompiled [azcopy](https://github.com/Azure/azure-storage-azcopy/releases) binary (**v10.18.1**) and store it under
`~/.azpype/`. This will be bundled in as part of the package distributuion and not as a separate installation script._
Expand All @@ -27,16 +27,29 @@ Install via pip
```
pip install azpype
```

Then from the terminal run
```
azpype-init
```
This will install and setup a `~/.azpype` directory and download the appropriate azcopy binary and baseline config.

---
## Usage

### Setup for Authentication
Currently azpype leverages application service principal based auth. Ensure that either the environment or the process make the following environement variables available:
Currently azpype supports application service principal based and shared access signature (SAS) token authentication.


### Service Principal
The recommended method is to use application service principals. To do so create/register the app in Azure and then grant it the appropriate RBAC permissions in any Blob Storage accounts you intend to use.
Ensure that the host that runs Azpype has access to the following environment variables via the host or process environment.
- `AZCOPY_TENANT_ID`
- `AZCOPY_SPA_APPLICATION_ID`
- `AZCOPY_SPA_CLIENT_SECRET`
- `AZCOPY_AUTO_LOGIN_TYPE`

#### Examples of setting the environment variables
Setting and environment variable in python:
```python
import os
Expand Down Expand Up @@ -71,6 +84,10 @@ OR Set environment variable via shell (Windows)
setx AZCOPY_TENANT_ID ""12d3fba3-efac-1234-a1b2-3f4cafbcb123"
```

#### Shared Access Signature (SAS) Token

For shared access signature use the `sas_token` parameter in the `Copy()` command and supply the sas token excluding the leading '?'

### Configuration

When pip installed a directory called `~/.azpype` will be created, underneath it there will be a configuration file called `copy_config.yaml`. These are default key-values that are options/arguments to the `Copy` command.
Expand Down
5 changes: 5 additions & 0 deletions azpype/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import requests
from pathlib import Path
import platform
import urllib3
from requests.packages.urllib3.exceptions import InsecureRequestWarning
urllib3.disable_warnings(InsecureRequestWarning)



def download_file(url, target_path):
response = requests.get(url, stream=True, verify=False)
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run(self):

setup(
name="azpype",
version="0.3.12",
version="0.3.1",
description="A native Python interface wrapping AzCopy for bulk data transfer to and from Azure Blob Storage.",
long_description=open('README.md', encoding="UTF-8").read(),
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 0a16087

Please sign in to comment.