# Make sure you have py4j0.10.9.8.jar or similar at altastata/lib directory

# for example for Windows
cp /c/Users/serge/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0/LocalCache/local-packages/share/py4j/py4j0.10.9.8.jar altastata/lib/

# Make sure you have altastata-hadoop jar (created without bouncy castle) and separate bouncy castle jars

# for example
# go to altastata-hadoop

gradle clean build shadowJar -PexcludeBouncyCastle=true copyDeps

# to build this one

cp ../mycloud/altastata-hadoop/build/libs/altastata-hadoop-all.jar altastata/lib/
cp ../mycloud/altastata-hadoop/build/libs_dependency/bc*-jdk18on-*.jar altastata/lib/

# verify that the jar is ok (it was corrupted in Linux)
jar tf altastata/lib/py4j0.10.9.5.jar | grep GatewayServer

# if py4j file is corrupted, run
wget https://repo1.maven.org/maven2/net/sf/py4j/py4j/0.10.9.5/py4j-0.10.9.5.jar -O altastata/lib/py4j0.10.9.5.jar

# if you want to change the logs level copy and modify this file
cp ../mycloud/altastata-hadoop/src/main/resources/logback.xml altastata/lib/

# install
pip install -e .

# test
python test_script.py

# build docker
docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/sergevil/altastata/jupyter-datascience:2024a_latest -f openshift/Dockerfile .

# push to the registry if needed
docker push ghcr.io/sergevil/altastata/jupyter-datascience:2024a_latest

# run docker
docker run --name altastata-jupyter -d -p 8888:8888 -v /Users/sergevilvovsky/.altastata:/opt/app-root/src/.altastata:rw -v /Users/sergevilvovsky/Desktop:/opt/app-root/src/Desktop:rw ghcr.io/sergevil/altastata/jupyter-datascience:2024a_latest

## Usage in Python Code

```python
from altastata import AltaStataFunctions
from altastata.altastata_pytorch_dataset import register_altastata_functions

# Configuration parameters
user_properties = """#My Properties
#Sun Jan 05 12:10:23 EST 2025
AWSSecretKey=vcJXbtg/YGApAUpY9sjsj1xvmpz9MUPTYMxY+hDn5zZ3Fmc1BuVS34zoTRDQJ7XAvu2Z0+piCEN3TA5OArj77FlL4doYDZx7YWXUopwUhMVyBvP+gT4buHc3hkf1FvHYElbUe3yX/57fnaYP1Nwg1zN9fupzEOGtCMjy39e9Xj4vvVgXo/+YW6ogG8uXi5JA9Fm2aG7hEWQstjwu5shcMT+Q6BR2SOtkAB8B9gYlCIt7ciJ4ikkAKqtfQ8TWkOsN
media-player=vlcj
myuser=bob123
accounttype=amazon-s3-secure
AWSAccessKeyId=ZWnrkxX43me3l1YBCGX42RhdzXmhP4q4rEOcquLZJIFWCEA9+sVA+hnRYTFcJoJ5nn0luDmQJJkYaayvtAP1IG6/0h4d4sWb+1NQ/hVozOdQMezUSp+z2Wruv4WX6TQpmz12N7zqQALMDD6qi5hTiv2QLJY084ufcoMZzmK1E0uw3jTG6Pci03Zy8TFbhhbuag88Stc9thyoN44ou/d5/8Id0AruvE0EK2Q7Jg0AZZI\\=
region=us-east-1
kms-region=us-east-2
metadata-encryption=RSA
password-timeout-interval=9000000000
acccontainer-prefix=altastata-myorgrsa444-
logging.level.root=WARN
logging.level.com.altastata=WARN
logging.level.org.apache.http=ERROR
logging.level.software.amazon=ERROR"""

private_key = """-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3,F26EBECE6DDAEC52


wV5BUmp5CEmbeB4r/+BlFttRZBLBXT1sq80YyQIVLumq0Livao9mOg==
-----END RSA PRIVATE KEY-----"""

# Create an instance of AltaStataFunctions
altastata_functions = AltaStataFunctions.from_credentials(user_properties, private_key)
altastata_functions.set_password("123")

# register the altastata functions
register_altastata_functions(altastata_functions, "bob123_rsa")
```
