In most cases to contribute you will need a GitHub account.
Suspected issues with stream-zip can be submitted at the stream-unzip Issues page.
An issue that contains a minimal, reproducible example stands the best chance of being resolved. However, it is understood that this is not possible in all circumstances.
A feature request can be submitted using the Ideas category in the stream-zip discussions.
To contribute changes to documentation or code, you will need the source of stream-unzip locally. The instructions for this depend on if you are a member of the uktrade GitHub organisation. In both cases, experience of working with source code, working on the command line, and working with git is helpful.
-
Clone the repository
git clone git@github.com:uktrade/stream-zip.git cd stream-zup
You should not fork the repository if you're a member of uktrade.
-
Fork the repository. Make a note of the "Owner" that you fork to. This is usually your username.
There is more documentation on forking in GitHub's guide on contributing to projects.
-
Clone the forked repository. In the following, replace
my-username
with the owner that you forked to in step 2.git clone git@github.com:my-username/stream-zip.git cd stream-zup
The source of the documentation is in the docs/ directory of the source code, and is written using Material for mkdocs.
Changes are then submitted via a Pull Request (PR). To do this:
-
Decide on a short hyphen-separated descriptive name for your change, prefixed with
docs/
for exampledocs/add-django-recipe
. -
Make a branch using this descriptive name.
git checkout -b docs/add-django-recipe cd stream-zip
-
Make your changes in a text editor.
-
Preview your changes locally.
pip install -r requirements-docs.txt # Only needed once mkdocs serve
-
Commit your change and push to your fork. Ideally the commit message will follow the Conventional Commit specification.
git add docs/recipies.md # Repeat for each file changed git commit -m "docs: added a Django recipe" gir push origin docs/add-django-recipe
-
Raise a PR at https://github.com/uktrade/stream-zip/pulls against the
main
branch in stream-zip. -
Wait for the PR to be approved and merged, and respond to any questions or suggested changes.
When the PR is merged, the documentation is deployed automatically to https://stream-zip.docs.trade.gov.uk/.
To contribute most code changes:
-
Knowledge of Python is required. Python iterables, and specifically generators, are used heavily in stream-zip.
-
Understanding the low-level properties of the ZIP file format is required. These are covered in detail in the specification of the ZIP file format, known as APPNOTE.
APPNOTE can be difficult to read, and contains a lot of information that isn't needed for stream-zip. A more concise introduction is in the Wikipedia page on the ZIP file format. However the Wikipedia page is less authoritative.
In both APPNOTE and the Wikipedia page, the most relevant parts are about the "local file header" and the "data descriptor". These are sections of metadata that go before and after the contents of each file respectively.
Changes are then submitted via a Pull Request (PR). To do this:
-
Decide on a short hyphen-separated descriptive name for your change, prefixed with the type of change. For example
fix/the-bug-description
. -
Make a branch using this descriptive name.
git checkout -b fix-a-bug-description
-
Make sure you can run existing tests locally
./install-libarachive.sh # Only needed once pip install -r requirements-dev.txt # Only needed once pytest
-
Make your changes in a text editor. In the cases of changing behaviour, this would usually include changing or adding at least one test in test_stream_zip.py, and running them.
pytest
-
Commit your changes and push to your fork. Ideally the commit message will follow the Conventional Commit specification.
git add stream_zip.py # Repeat for each file changed git commit -m "feat: the bug description" gir push origin fix/the-bug-description
-
Raise a PR at https://github.com/uktrade/stream-zip/pulls against the
main
branch in stream-zip. -
Wait for the PR to be approved and merged, and respond to any questions or suggested changes.