- Change the username in the useradd line on Dockerfile to your local user.
- put your API-CollectionID-CollectionName-Crosswalk.xlsx in the txgio_extension directory (May not be necessary for single collection generation)
- this requires .aws keys for reading only. So add credentials for a iam user who has read access to s3.
- If desired setup a devcontainer
- install remote - containers plugin @ https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
- setup a bind type mount to desired .aws keys. I'd recommend setting the permissions to readonly for s3 for the IAM user you configure.
"mounts": [
{
"source": "${localEnv:HOME}/.aws",
"target": "PATH TO READONLY S3 IAM USER .aws DIRECTORY",
"type": "bind"
}
],
- setup a matching username in postcreatecommand and give it permissions
"postCreateCommand": "useradd -ms /bin/bash EXAMPLE_USER && chown -R EXAMPLE_USER:EXAMPLE_USER /local_libs/* && chown -R EXAMPLE_USER:EXAMPLE_USER /stac_factory/*", - Then set remoteuser
"remoteUser": "${localEnv:USER}" - build dockerfile
"build": {
"dockerfile": "../Dockerfile",
"context": "."
},
- pass in network
"runArgs": ["--network=host"], - name docker container
"name": "stac_factory-devcontainer", - mount workspace
"workspaceMount": "source=${localWorkspaceFolder},target=/stac_factory/workspace,type=bind","workspaceFolder": "/stac_factory/workspace", - press cmd-p and type
>Dev Containers Rebuild and reopen container - Subsequent starts are with >
Dev Containers Reopen in container
- Make sure test validator works in debug mode at least before attempting to create the distributable. (Highly suggested to make sure your environment is configured.)
- pip install pyinstaller
- uv run pyinstaller --collect-all pandas --collect-all numpy --collect-all pdal tests/testvalidator.py --collect-all osgeo
- uv run pyinstaller testvalidator.spec
- There is also a github action to do this.
- prereqs, I recommend fedora os. Make sure python, python3-devel, pdal, PDAL-devel, gdal, gdal-devel, uv, and g++ packages are installed
- git clone https://github.com/TNRIS/stac_factory.git
- export PYTHONPATH="/path/to/your/library:$PYTHONPATH"
- uv pip install -e /path/to/stac_factory directory (Change to where you installed.) ((might work with uv add rather than uv pip install but I haven't tested yet. Both use uv though under the hood.))
- from stac_factory import gen_this_stac_collection
- from stac_factory import S3Config (Use this to configure s3 bucket)
- When you call gen_this_stac_factory just pass in a object with api keys. and a instance of S3Config (gen_this_stac_collection(whc, s3_configuration))
- This will upsert the collection into the postgres db in your environment
- (Make sure you activate venv) Either using the activate script or selecting interpretor through vscode
I use launch.json definitions to test this since it's less limiting. When development is done I'll write some other types of tests.
I use python Black code formatter. Formatting heavy commits should be in a seperate commit though.