Welcome to HeiWhy
Installation
This package can be added to any uv project by running the following code in the terminal:
Replace <TOKEN> with your personal access token for the Azure DevOps Workspace, make sure the token has the correct permissions to access the HeiWhy feed.uv add --index https://$ADO_PAT@heineken.pkgs.visualstudio.com/f1270abb-ff9d-403f-ac03-3095bab5c79f/_packaging/HeiWhy/pypi/simple/ heiwhy
Confirm that your pyproject.toml file looks as follows:
# omitting the above information.
...
dependencies = [
...
"heiwhy>=0.1.0",
]
...
[[tool.uv.index]]
url = "https://heineken.pkgs.visualstudio.com/f1270abb-ff9d-403f-ac03-3095bab5c79f/_packaging/HeiWhy/pypi/simple/"
Installing HeiWhy on Databricks
Notebook Scoped Install
In the event that you would like to import the package into a Databricks notebook, you would need to set up a new scope and key (in all the Databricks subscriptions where you would like to use the package). This can be done by contacting DE for assistance, and you would need to generate and provide a personal access token to the DevOps project/work space. Once this is provided, DE will add the token to the KeyVault and give it a name (this will be the key name), and will also provide you with the scope name.
Once you have the new scope and key , add this code to the first cell in the notebook:
token = dbutils.secrets.get(scope="<scope_name>", key="<key_name>")
%pip install git+https://$token@dev.azure.com/heineken/GA%20Value%20Measurement/_git/HeiWhy
dbutils.library.restartPython()
You will then be able to use the HeiWhy package like any other package, example:
from heiwhy.data_split import deterministic_balanced_split
result_df = deterministic_balanced_split(
dataframe=df,
id_column="OutletID",
number_of_splits=2
)
CI/CD Authentication
When adding HeiWhy to a repo with CI/CD pipelines, make sure to add the following to your .azure-pipelines.yml file
- task: PipAuthenticate@1
displayName: 'Pip Authentication'
inputs:
artifactFeeds: 'f1270abb-ff9d-403f-ac03-3095bab5c79f/HeiWhy'
onlyAddExtraIndex: true
- script: |
uv pip install heiwhy --index-url $PIP_EXTRA_INDEX_URL
uv pip install ".[test]" pytest-azurepipelines
displayName: 'Install dependencies'