Required tools for this repo are task-runner and docker-ce.
- Install task runner: https://github.com/go-task/task
- Install docker-ce: https://docs.docker.com/get-docker/
Reference: https://gist.github.com/Chaser324/ce0505fbed06b947d962
Fork the repo using the 'Fork' dialog at the top right corner of the github UI.
Clone the new fork into your local development environment (assuming your github login is 'githubUserHandle'):
Note: all references to 'git@github.com' assume that your local github user has adequate rights. If using ~/.ssh/config to manage ssh identities then replace all mentions of 'git@github.com' with the clause name in ~/.ssh/config which references the appropriate ssh key::
For example:
Host ssh-githubUserHandle
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_githubUserHandle
Host ssh-otherUserHandle
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_otherUserHandle
Host *
IdentitiesOnly yes
i.e. 'githubUserHandle' viz:
git clone ssh-githubUserHandle:githubUserHandle/archivist-python.git
mkdir githubUserHandle
cd githubUserHandle
git clone ssh-githubUserHandle:githubUserHandle/archivist-python.gitEnter the new cloned fork and add the original upstream repo as a remote:
cd archivist-python
git remote add upstream ssh-githubUserHandle:jitsuin-inc/archivist-python.git
git remote -vNow add a branch for your proposed changes:
git status
git checkout -b dev/githubUserHandle/some-proposed-fix
git statusTo see what options are available simply execute:
taskAll development is done using a docker image. To create the image execute the following command. This command only has to be repeated if requirements.txt or requirements-dev.txt change.
Dependencies are defined in requirements.txt for the archivist package and requirements-dev.txt for the tools used to build, test and publish the archivist package.
To build the docker builder image:
task builderGenerate documentation:
task docsand point a browser to docs/_build/html/index.html.
Make a change to the code and validate the changes:
task checkIf ok run the unittests:
task unittestsIf you have access to an archivist instance then one can run functional tests. The URL and authtoken are required. The authtoken must be stored in a file in the credentials subdirectory credentials/authtoken (say).
These tests will create artefacts on the archivist instance so it is not recommended that they be run in a production environment.
Set 2 environment variables and execute:
export TEST_ARCHIVIST="https://app.rkvst.io"
export TEST_AUTHTOKEN_FILENAME=credentials/authtoken
task functestsTo build the docker builder image with default Python version 3.6:
task builderTo check the style
task checkTo run the unittests:
task unittestsTo build the docker builder image with Python 3.7:
task builder-3.7To check the style
task checkTo run the unittests:
task unittestsTo build the docker builder image with Python 3.7:
task builder-3.8To check the style
task checkTo run the unittests:
task unittestsTo build the docker builder image with Python 3.9:
task builder-3.9To check the style
task checkTo run the unittests:
task unittestsBring in latest changes from upstream:
git fetch upstream
git checkout main
git merge upstream/main
git checkout dev/githubUserHandle/some-proposed-fix
git rebase -i --autosquash mainEnsure that your email and name are correct:
git config user.name
git config user.emailAdd all changes to a commit using the example-commit file as a template for the commit message.
git add .
git commitPush the changes upstream(the set-upstream option is only required the first time this is executed):
git push --set-upstream origin dev/githubUserHandle/some-proposed-fixEnter the github ui at https://github.com/jitsuin-inc/archivist-python and generate a pull request.
Reviewers will be notified when a PR is generated and you will receive feedback. Reviewers will trigger QC checks on your code. Failure will result in automatic rejection.
If changes are requested push the changes as a fixup:
git add .
git commit --fixup HEAD
git pushEventually the reviewer(s) will approve your changes. At this point you must squash all your fixups after syncing upstream:
git fetch upstream
git checkout main
git merge upstream/main
git checkout dev/githubUserHandle/some-proposed-fix
git rebase -i --autosquash main
git push -fThe reviewer will then merge your PR into main.
At this point one must tidy up the local fork:
git fetch upstream
git checkout main
git merge upstream/main
git log
git branch -d dev/githubUserHandle/some-proposed-fix