This repository is organized as follows:
Fork this repo and clone your fork. (GitHub docs)
GITHUB_USERNAME="YOUR-GITHUB-USERNAME" \ git clone https://github.com/${GITHUB_USERNAME}/hamilton-sdk.git cd ./hamilton-sdk git remote add upstream https://github.com/apache/hamilton-sdk.git
Install the project's dependencies in your preferred method for managing python dependencies. For example, run the following to use venv.
python -m venv ./venv . ./venv/bin/activate pip install \ -r ./requirements.txt \ -r ./requirements-dev.txt \ -r ./requirements-test.txt
Set up prek, which will run some lightweight formatting and linting tasks on every commit.
prek install
Make sure your local copy of the main branch is up to date with the official hamilton-sdk repo.
git checkout main git pull upstream main # and might as well update your fork too! git push origin main
Create a new branch.
git checkout -b feat/some-feature
Make changes, commit them, and push them to your fork.
git push origin HEAD
Test your changes locally with prek...
prek run --all-files
...and by following the steps in “How to run unit tests”.
Navigate to https://github.com/apache/hamilton-sdk/pulls and open a pull request.
You need to have installed the requirements-test.txt dependencies into the environment you're running for this to work. You can run tests two ways:
You can debug and execute unit tests in pycharm easily. To set it up, you just hit Edit configurations and then add New > Python Tests > pytest. You then want to specify the tests/ folder under Script path, and ensure the python environment executing it is the appropriate one with all the dependencies installed. If you add -v to the additional arguments part, you'll then get verbose diffs if any tests fail.
These are the steps to push to pypi. This is taken from the python packaging tutorial.
python3 -m pip install --upgrade build.python3 -m pip install --upgrade twinepython3 -m build to build hamilton-sdk. It should create things in dist/*.python3 -m twine upload --repository testpypi dist/*. Note: you cannot push the same version twice to test or real pypi. So it‘s useful to append -rcX to the version. Once you’re happy, you can remove that; just remember to not check that in.python3 -m twine upload dist/*These are the steps to push to Anaconda after you have built and pushed to PyPi successfully.
conda config --set auto_activate_base False to not set conda to be active by default.