This is a guide for developers to contribute to the codebase
March 4, 2024 ยท View on GitHub
Configure the package for local development
New way (poetry)
Install needed packages and GPTSwarm into the current environment.
poetry install
Install needed and uninstall not listed packages:
poetry install --sync
If dev packages not installed for some reason:
poetry install --with=dev --sync
Old way (setuptools)
The following command installs the gptswarm package as a symbolic link to the current github repo clone. All edits to the repo will be immediately reflected in the "installed" package.
pip insall -e .
To install the package along with the developer's tools:
pip install -e .[dev]
How to run tests
Quick no-API test without logging output:
pytest -m mock_llm test/
Quick no-API test with logging output:
pytest -s -m mock_llm test/
Without logging output:
pytest test/
With logging output:
pytest -s test/
Test specific function:
pytest -s test/swarm/graph/test_swarm.py -k 'test_raises'
Running any of the above commands with poetry will auto activate the virtual environment:
poetry run pytest -m mock_llm
Run code coverage
coverage erase
coverage run --source=. -m pytest .
coverage html -i
open htmlcov/index.html
Working with git LFS
The instructions to work with git LFS (large file storage) can be found here.
Working with submodules
The instructions to work with git submodules can be found here.
Packaging instructions
https://packaging.python.org/en/latest/tutorials/packaging-projects/
Poetry
poetry config pypi-token.pypi "<your-token>"
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi "<your-token>"
poetry version prerelease
poetry build
poetry publish -r test-pypi
poetry publish
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple gptswarm==0.1.3a1
More see here.