-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
1,597 additions
and
97 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Python Wrapper | ||
|
||
The Migration SDK is written in .NET. It has a Python wrapper package that provides access to most of this functionality. | ||
|
||
## Capabilities | ||
|
||
With the Python Wrapper, you can: | ||
|
||
- Provide basic [configuration](~/articles/configuration.md) values to the Migration SDK via the PlanBuilder. | ||
- Set configuration options as described in [Configuration](~/articles/configuration.md) with environment variables. | ||
- Configure Python [logging](~/articles/logging.md#python-support). | ||
- Run a migration using the wrapper. | ||
- Write [Python hooks](~/samples/python_hooks.md) (See [Hooks](~/articles/hooks/index.md) for an overview). | ||
|
||
## Current limitations | ||
|
||
There are advanced features of the Migration SDK that the Python Wrapper cannot currently access: | ||
|
||
- Override `C#` classes and methods to change how the SDK works. | ||
|
||
## Examples to get started | ||
|
||
The following code samples are for writing a simple migration app using the Migration SDK. For details on configuring and customizing the Migration SDK to your specific needs, see [Articles](~/articles/intro.md) and [Code Samples](~/samples/intro.md). | ||
|
||
### [Startup Script](#tab/startup) | ||
|
||
[!code-python[](../../../examples/Python.ExampleApplication/Python.ExampleApplication.py)] | ||
|
||
### [config.ini](#tab/config) | ||
|
||
> [!Important] | ||
> The values below should not be quoted. So ***no*** `'` or `"`. | ||
[!code-ini[](../../../examples/Python.ExampleApplication/config.ini)] | ||
|
||
### [requirements.txt](#tab/reqs) | ||
|
||
[!code-text[](../../../examples/Python.ExampleApplication/requirements.txt#L3-)] | ||
|
||
--- |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
8 changes: 5 additions & 3 deletions
8
...les/advanced_config/hooks/python_hooks.md → src/Documentation/samples/python_hooks.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<# | ||
.SYNOPSIS | ||
Builds and publishes the migration-sdk python package | ||
.NOTES | ||
Author: Steffen Froehlich | ||
.PARAMETER SkipPublish | ||
Builds everything but skips pushing to repository | ||
.PARAMETER VersionOverride | ||
String used to override the version in the Directory.Build.props file in the root directory. | ||
The Python Hatchling project is required for this: https://pypi.org/project/hatchling/ | ||
#> | ||
|
||
[CmdletBinding()] | ||
param( | ||
[switch]$SkipPublish, | ||
[string]$VersionOverride | ||
) | ||
|
||
function Test-CommandExists ($command) | ||
{ | ||
$oldPreference = $ErrorActionPreference | ||
|
||
$ErrorActionPreference = 'stop' | ||
|
||
try { | ||
if(Get-Command $command) { | ||
return $true | ||
} | ||
} | ||
catch { | ||
return $false | ||
} | ||
finally { | ||
$ErrorActionPreference=$oldPreference | ||
} | ||
} | ||
|
||
pushd (Join-Path $PSScriptRoot "..") | ||
|
||
$env:TWINE_REPOSITORY="tabpypi" | ||
$env:TWINE_REPOSITORY_URL="https://artifactory.prod.tableautools.com/artifactory/api/pypi/tabpypi" | ||
$env:TWINE_USERNAME="svc_cmt" | ||
$env:TWINE_NON_INTERACTIVE="1" | ||
|
||
if (-not($SkipPublish)) { | ||
if( [string]::IsNullOrEmpty($env:TWINE_PASSWORD) ) { | ||
Write-Error "Set `$env:TWINE_PASSWORD to the svc_cmd password found in cyberark" | ||
exit 1 | ||
} | ||
} | ||
if ($VersionOverride) { | ||
if( -not(Test-CommandExists hatch)) { | ||
Write-Error "install hatch to set custom version. 'pip install hatch'" | ||
exit 1 | ||
} | ||
} | ||
|
||
try { | ||
& (Join-Path $PSScriptRoot "build-package.ps1") | ||
|
||
if ($VersionOverride) { | ||
$oldVersion = (hatch version) | ||
hatch version $VersionOverride | ||
} | ||
python -m build --wheel # Build the wheel package | ||
python -m build --sdist # Build the source dist package | ||
|
||
if (-not($SkipPublish)) { | ||
# The package will be uploaded to https://artifactory.prod.tableautools.com/ui/repos/tree/General/tabpypi/tableau-migration/ | ||
Write-Host "Uploading package to https://artifactory.prod.tableautools.com/ui/repos/tree/General/tabpypi/tableau-migration/" | ||
python -m twine upload --repository-url https://artifactory.prod.tableautools.com/artifactory/api/pypi/tabpypi dist/* | ||
} | ||
|
||
} | ||
finally { | ||
popd | ||
|
||
if ($oldVersion){ | ||
hatch version $oldVersion | ||
} | ||
} |
Oops, something went wrong.