-
-
Notifications
You must be signed in to change notification settings - Fork 137
Contribute
GreedyBear welcomes contributors from anywhere and from any kind of education or skill level. We strive to create a community of developers that is welcoming, friendly and right.
For this reason it is important to follow some easy rules based on a simple but important concept: Respect.
-
Before starting to work on an issue, you need to get the approval of one of the maintainers. Therefore please ask to be assigned to an issue. If you do not do that but you still raise a PR for that issue, your PR can be rejected. This is a form of respect for both the maintainers and the other contributors who could have already started to work on the same problem.
-
When you ask to be assigned to an issue, it means that you are ready to work on it. When you get assigned, take the lock and then you disappear, you are not respecting the maintainers and the other contributors who could be able to work on that. So, after having been assigned, you have a week of time to deliver your first draft PR. After that time has passed without any notice, you will be unassigned.
-
Before asking questions regarding how the project works, please read through all the documentation and install the project on your own local machine to try it and understand how it basically works. This is a form of respect to the maintainers.
-
Once you started working on an issue and you have some work to share and discuss with us, please raise a draft PR early with incomplete changes. This way you can continue working on the same and we can track your progress and actively review and help. This is a form of respect to you and to the maintainers.
-
When creating a PR, please read through the sections that you will find in the PR template and compile it appropriately. If you do not, your PR can be rejected. This is a form of respect to the maintainers.
-
Use AI tools appropriately. If we find that you abuse those tools and you just copy/paste without even checking what you are pushing in a PR, we will automatically reject your PR and your future PRs. This is a form of respect to the maintainers.
Keeping to a consistent code style throughout the project makes it easier to contribute and collaborate. We use Ruff as our all-in-one linter and formatter, which provides:
-
Code Formatting: Replaces
blackwith fast, compatible formatting -
Import Sorting: Replaces
isortwith automatic import organization -
Linting: Replaces
flake8with 100+ rule sets including:- pycodestyle (E/W) - PEP 8 style enforcement
- pep8-naming (N) - Naming convention checks
- pyupgrade (UP) - Modern Python syntax suggestions
- flake8-bugbear (B) - Common bug detection
- flake8-comprehensions (C4) - List/dict comprehension improvements
- flake8-django (DJ) - Django-specific best practices
To start with the development setup, make sure you go through all the steps in Installation Guide and properly installed it.
If you don't have a T-Pot, you can make GreedyBear spin up its own local ElasticSearch instance. (Note: This option would require enough RAM to run the additional containers. Suggested is >=16GB).
# Development with local Elasticsearch
./gbctl init --dev --elastic-localPlease create a new branch based on the develop branch that contains the most recent changes. This is mandatory.
git checkout -b myfeature develop
Install the python project manager uv.
Then we strongly suggest to configure pre-commit to force linters on every commit you perform:
# from the project base directory
uvx pre-commit install -c .github/.pre-commit-config.yamlOnce configured, Ruff will automatically run on every commit. If you want to manually run Ruff before committing, you can use:
# Format and fix auto-fixable issues
uvx pre-commit run ruff --all-files -c .github/.pre-commit-config.yaml
# Or run Ruff directly
uvx ruff check . # Check for linting issues
uvx ruff check . --fix # Auto-fix issues
uvx ruff format . # Format codeRemember that whenever you make changes, you need to rebuild the docker image to see the reflected changes.
To start the frontend in "develop" mode, you can execute the startup npm script within the folder frontend:
cd frontend/
# Install
npm i
# Start
npm startIf you get "Invalid Host header" errors when proxying API requests, set server.allowedHosts in vite.config.js.
Most of the time you would need to test the changes you made together with the backend. In that case, you would need to run the backend locally too:
docker compose up
The GreedyBear Frontend is tightly linked to the certego-ui library. Most of the React components are imported from there. Because of this, it may happen that, during development, you would need to work on that library too.
To install the certego-ui library, please take a look at npm link and remember to start certego-ui without installing peer dependencies (to avoid conflicts with GreedyBear dependencies):
git clone https://github.com/certego/certego-ui.git
# change directory to the folder where you have the cloned the library
cd certego-ui/
# install, without peer deps (to use packages of GreedyBear)
npm i --legacy-peer-deps
# create link to the project (this will globally install this package)
sudo npm link
# compile the library
npm startThen, open another command line tab, create a link in the frontend to the certego-ui and re-install and re-start the frontend application (see previous section):
cd frontend/
npm link @certego/certego-uiThis trick will allow you to see reflected every change you make in the certego-ui directly in the running frontend application.
The certego-ui application comes with an example project that showcases the components that you can re-use and import to other projects, like GreedyBear:
# To have the Example application working correctly, be sure to have installed `certego-ui` *without* the `--legacy-peer-deps` option and having it started in another command line
cd certego-ui/
npm i
npm start
# go to another tab
cd certego-ui/example/
npm i
npm startPlease create pull requests only for the branch develop. That code will be pushed to master only on a new release.
Also remember to pull the most recent changes available in the develop branch before submitting your PR. If your PR has merge conflicts caused by this behavior, it won't be accepted.
You have to install pre-commit to have your code adjusted and fixed with the available linters:
uvx pre-commit install -c .github/.pre-commit-config.yaml
Once that is done, you won't have to think about linters anymore.
docker exec greedybear_app python3 manage.py test
All the frontend tests must be run from the folder frontend.
The tests can contain log messages, you can suppress them with the environment variable SUPPRESS_JEST_LOG=True.
npm test
npm test -- -t <componentPath>
// example
npm test tests/components/auth/Login.test.jsx
npm test -- -t '<describeString> <testString>'
// example
npm test -- -t "Login component User login"
If you get any errors, fix them. Once you make sure that everything is working fine, please squash all of your commits into a single one and finally create a pull request.
This is the GreedyBear Wiki. Wiki Home