The GHASToolkit project is an open-source library and CLI for working with the different features of GitHub Advance Security. We welcome contributions from the community! Here are some guidelines to help you get started.
The easiest way to contribute is to report issues. If you find a bug or have a feature request, please open an issue on the GitHub repository.
python
3.10 or higheruv
GHASToolkit needs to be able to run on all supported versions of Python. Please make sure to test your changes on all supported versions.
To build the project, you just need to run the following command:
uv build
If you are having issues building / running the project, you might need to set the PYTHONPATH
environment variable to the root of the project. You can do this by running the following command:
export PYTHONPATH=$PWD/src
GHASToolkit uses black
for code formatting. To format the code, you can use the following command:
uv run black .
GHASToolkit uses unittest
for testing. To run the tests, you can use the following command:
uv run python -m unittest discover -v -s ./tests -p 'test_*.py'
When writing tests for API requests, please make sure to use the responses
library along with the utils
module to mock the requests.
This is important to ensure that the tests are not dependent on the actual API responses and can be run in isolation.
Example:
import responses
import utils
class TestMyClass(unittest.TestCase):
@responses.activate
def test_my_method(self):
# This will add all the mocked
utils.loadResponses('mytests', 'my_method')
# Call the method
result = utils.my_method()
# Assert the result
self.assertEqual(result, {'key': 'value'})
To run the CLI, you can use the following command:
uv run python -m ghastoolkit --help
GHASToolkit uses sphinx
for documentation. To build the documentation, run the following command:
uv run sphinx-build -b html ./docs ./public
Note: This might change in the future, but for now, the documentation is built using sphinx
and hosted on GitHub Pages. You can find the documentation at https://ghastoolkit.github.io/.