Skip to content

Commit 93c1b94

Browse files
authored
Merge pull request #1351 from roboflow/develop
`supervision-0.22.0` release
2 parents e50c761 + 66d1f4c commit 93c1b94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+8947
-3232
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828

2929

3030
- repo: https://github.com/PyCQA/bandit
31-
rev: '1.7.8'
31+
rev: '1.7.9'
3232
hooks:
3333
- id: bandit
3434
args: ["-c", "pyproject.toml"]
@@ -45,7 +45,7 @@ repos:
4545

4646

4747
- repo: https://github.com/astral-sh/ruff-pre-commit
48-
rev: v0.4.7
48+
rev: v0.5.1
4949
hooks:
5050
- id: ruff
5151
args: [--fix, --exit-non-zero-on-fix]

CONTRIBUTING.md

Lines changed: 121 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ Thank you for your interest in contributing to Supervision!
44

55
We are actively improving this library to reduce the amount of work you need to do to solve common computer vision problems.
66

7+
## Code of Conduct
8+
9+
Please read and adhere to our [Code of Conduct](CODE_OF_CONDUCT.md). This document outlines the expected behavior for all participants in our project.
10+
11+
## Table of Contents
12+
13+
- [Contribution Guidelines](#contribution-guidelines)
14+
- [Contributing Features](#contributing-features-)
15+
- [How to Contribute Changes](#how-to-contribute-changes)
16+
- [Installation for Contributors](#installation-for-contributors)
17+
- [Code Style and Quality](#-code-style-and-quality)
18+
- [Pre-commit tool](#pre-commit-tool)
19+
- [Docstrings](#docstrings)
20+
- [Type checking](#type-checking)
21+
- [Documentation](#-documentation)
22+
- [Cookbooks](#-cookbooks)
23+
- [Tests](#-tests)
24+
- [License](#-license)
25+
726
## Contribution Guidelines
827

928
We welcome contributions to:
@@ -32,49 +51,49 @@ First, fork this repository to your own GitHub account. Click "fork" in the top
3251

3352
Then, run `git clone` to download the project code to your computer.
3453

35-
Move to a new branch using the `git checkout` command:
54+
You should also set up `roboflow/supervision` as an "upstream" remote (that is, tell git that the reference Supervision repository was the source of your fork of it):
3655

3756
```bash
38-
git checkout -b <your_branch_name>
57+
git remote add upstream https://github.com/roboflow/supervision.git
58+
git fetch upstream
3959
```
4060

41-
The name you choose for your branch should describe the change you want to make (i.e. `line-counter-docs`).
42-
43-
Make any changes you want to the project code, then run the following commands to commit your changes:
61+
Move to a new branch using the `git checkout` command:
4462

4563
```bash
46-
git add .
47-
git commit -m "Your commit message"
48-
git push -u origin main
64+
git checkout -b <scope>/<your_branch_name> upstream/develop
4965
```
5066

51-
## 🎨 Code quality
52-
53-
### Pre-commit tool
54-
55-
This project uses the [pre-commit](https://pre-commit.com/) tool to maintain code quality and consistency. Before submitting a pull request or making any commits, it is important to run the pre-commit tool to ensure that your changes meet the project's guidelines.
56-
57-
Furthermore, we have integrated a pre-commit GitHub Action into our workflow. This means that with every pull request opened, the pre-commit checks will be automatically enforced, streamlining the code review process and ensuring that all contributions adhere to our quality standards.
58-
59-
To run the pre-commit tool, follow these steps:
60-
61-
1. Install pre-commit by running the following command: `poetry install`. It will not only install pre-commit but also install all the deps and dev-deps of project
62-
63-
2. Once pre-commit is installed, navigate to the project's root directory.
64-
65-
3. Run the command `pre-commit run --all-files`. This will execute the pre-commit hooks configured for this project against the modified files. If any issues are found, the pre-commit tool will provide feedback on how to resolve them. Make the necessary changes and re-run the pre-commit command until all issues are resolved.
67+
The name you choose for your branch should describe the change you want to make and start with an appropriate prefix:
6668

67-
4. You can also install pre-commit as a git hook by execute `pre-commit install`. Every time you made `git commit` pre-commit run automatically for you.
69+
- `feat/`: for new features (e.g., `feat/line-counter`)
70+
- `fix/`: for bug fixes (e.g., `fix/memory-leak`)
71+
- `docs/`: for documentation changes (e.g., `docs/update-readme`)
72+
- `chore/`: for routine tasks, maintenance, or tooling changes (e.g., `chore/update-dependencies`)
73+
- `test/`: for adding or modifying tests (e.g., `test/add-unit-tests`)
74+
- `refactor/`: for code refactoring (e.g., `refactor/simplify-algorithm`)
6875

69-
### Docstrings
76+
Make any changes you want to the project code, then run the following commands to commit your changes:
7077

71-
All new functions and classes in `supervision` should include docstrings. This is a prerequisite for any new functions and classes to be added to the library.
78+
```bash
79+
git add -A
80+
git commit -m "feat: add line counter functionality"
81+
git push -u origin <your_branch_name>
82+
```
7283

73-
`supervision` adheres to the [Google Python docstring style](https://google.github.io/styleguide/pyguide.html#383-functions-and-methods). Please refer to the style guide while writing docstrings for your contribution.
84+
Use conventional commit messages to clearly describe your changes. The format is:
7485

75-
### Type checking
86+
<type>[optional scope]: <description>
7687

77-
So far, **there is no type checking with mypy**. See [issue](https://github.com/roboflow-ai/template-python/issues/4).
88+
Common types include:
89+
- feat: A new feature
90+
- fix: A bug fix
91+
- docs: Documentation only changes
92+
- style: Changes that do not affect the meaning of the code (white-space, formatting, etc)
93+
- refactor: A code change that neither fixes a bug nor adds a feature
94+
- perf: A code change that improves performance
95+
- test: Adding missing tests or correcting existing tests
96+
- chore: Changes to the build process or auxiliary tools and libraries
7897

7998
Then, go back to your fork of the `supervision` repository, click "Pull Requests", and click "New Pull Request".
8099

@@ -104,32 +123,100 @@ All pull requests will be reviewed by the maintainers of the project. We will pr
104123

105124
PRs must pass all tests and linting requirements before they can be merged.
106125

107-
## 📝 documentation
126+
## Installation for Contributors
127+
128+
Before starting your work on the project, set up your development environment:
129+
130+
1. Clone your fork of the project:
131+
```bash
132+
git clone https://github.com/YOUR_USERNAME/supervision.git
133+
cd supervision
134+
```
135+
Replace `YOUR_USERNAME` with your GitHub username.
136+
137+
2. Create and activate a virtual environment:
138+
```bash
139+
python3 -m venv .venv
140+
source .venv/bin/activate
141+
```
142+
143+
3. Install Poetry:
144+
145+
Using pip:
146+
```bash
147+
pip install -U pip setuptools
148+
pip install poetry
149+
```
150+
151+
Or using pipx (recommended for global installation):
152+
```bash
153+
pipx install poetry
154+
```
155+
156+
4. Install project dependencies:
157+
```bash
158+
poetry install
159+
```
160+
161+
5. Run pytest to verify the setup:
162+
```bash
163+
poetry run pytest
164+
```
165+
166+
## 🎨 Code Style and Quality
167+
168+
### Pre-commit tool
169+
170+
This project uses the [pre-commit](https://pre-commit.com/) tool to maintain code quality and consistency. Before submitting a pull request or making any commits, it is important to run the pre-commit tool to ensure that your changes meet the project's guidelines.
171+
172+
Furthermore, we have integrated a pre-commit GitHub Action into our workflow. This means that with every pull request opened, the pre-commit checks will be automatically enforced, streamlining the code review process and ensuring that all contributions adhere to our quality standards.
173+
174+
To run the pre-commit tool, follow these steps:
175+
176+
1. Install pre-commit by running the following command: `poetry install`. It will not only install pre-commit but also install all the deps and dev-deps of project
177+
178+
2. Once pre-commit is installed, navigate to the project's root directory.
179+
180+
3. Run the command `pre-commit run --all-files`. This will execute the pre-commit hooks configured for this project against the modified files. If any issues are found, the pre-commit tool will provide feedback on how to resolve them. Make the necessary changes and re-run the pre-commit command until all issues are resolved.
181+
182+
4. You can also install pre-commit as a git hook by executing `pre-commit install`. Every time you do a `git commit` pre-commit run automatically for you.
183+
184+
### Docstrings
185+
186+
All new functions and classes in `supervision` should include docstrings. This is a prerequisite for any new functions and classes to be added to the library.
187+
188+
`supervision` adheres to the [Google Python docstring style](https://google.github.io/styleguide/pyguide.html#383-functions-and-methods). Please refer to the style guide while writing docstrings for your contribution.
189+
190+
### Type checking
191+
192+
So far, **there is no type checking with mypy**. See [issue](https://github.com/roboflow-ai/template-python/issues/4).
193+
194+
## 📝 Documentation
108195

109196
The `supervision` documentation is stored in a folder called `docs`. The project documentation is built using `mkdocs`.
110197

111198
To run the documentation, install the project requirements with `poetry install --with dev`. Then, run `mkdocs serve` to start the documentation server.
112199

113200
You can learn more about mkdocs on the [mkdocs website](https://www.mkdocs.org/).
114201

115-
## 🧑‍🍳 cookbooks
202+
## 🧑‍🍳 Cookbooks
116203

117204
We are always looking for new examples and cookbooks to add to the `supervision`
118205
documentation. If you have a use case that you think would be helpful to others, please
119206
submit a PR with your example. Here are some guidelines for submitting a new example:
120207

121-
- Create a new notebook in the [`docs/nodebooks`](https://github.com/roboflow/supervision/tree/develop/docs/notebooks) folder.
208+
- Create a new notebook in the [`docs/notebooks`](https://github.com/roboflow/supervision/tree/develop/docs/notebooks) folder.
122209
- Add a link to the new notebook in [`docs/theme/cookbooks.html`](https://github.com/roboflow/supervision/blob/develop/docs/theme/cookbooks.html). Make sure to add the path to the new notebook, as well as a title, labels, author and supervision version.
123210
- Use the [Count Objects Crossing the Line](https://supervision.roboflow.com/develop/notebooks/count-objects-crossing-the-line/) example as a template for your new example.
124211
- Freeze the version of `supervision` you are using.
125212
- Place an appropriate Open in Colab button at the top of the notebook. You can find an example of such a button in the aforementioned `Count Objects Crossing the Line` cookbook.
126213
- Notebook should be self-contained. If you rely on external data ( videos, images, etc.) or libraries, include download and installation commands in the notebook.
127214
- Annotate the code with appropriate comments, including links to the documentation describing each of the tools you have used.
128215

129-
## 🧪 tests
216+
## 🧪 Tests
130217

131218
[`pytests`](https://docs.pytest.org/en/7.1.x/) is used to run our tests.
132219

133-
## 📄 license
220+
## 📄 License
134221

135222
By contributing, you agree that your contributions will be licensed under an [MIT license](https://github.com/roboflow/supervision/blob/develop/LICENSE.md).

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
**We write your reusable computer vision tools.** Whether you need to load your dataset from your hard drive, draw detections on an image or video, or count how many detections are in a zone. You can count on us! 🤝
3030

31-
[![supervision-hackfest](https://github.com/roboflow/supervision/assets/26109316/c05cc954-b9a6-4ed5-9a52-d0b4b619ff65)](https://github.com/orgs/roboflow/projects/10)
31+
[![supervision-hackfest](https://github.com/roboflow/supervision/assets/26109316/c05cc954-b9a6-4ed5-9a52-d0b4b619ff65)](https://github.com/orgs/roboflow/projects)
3232

3333
## 💻 install
3434

@@ -86,7 +86,7 @@ len(detections)
8686

8787
### annotators
8888

89-
Supervision offers a wide range of highly customizable [annotators](https://supervision.roboflow.com/latest/annotators/), allowing you to compose the perfect visualization for your use case.
89+
Supervision offers a wide range of highly customizable [annotators](https://supervision.roboflow.com/latest/detection/annotators/), allowing you to compose the perfect visualization for your use case.
9090

9191
```python
9292
import cv2
@@ -95,8 +95,8 @@ import supervision as sv
9595
image = cv2.imread(...)
9696
detections = sv.Detections(...)
9797

98-
bounding_box_annotator = sv.BoundingBoxAnnotator()
99-
annotated_frame = bounding_box_annotator.annotate(
98+
box_annotator = sv.BoxAnnotator()
99+
annotated_frame = box_annotator.annotate(
100100
scene=image.copy(),
101101
detections=detections
102102
)
@@ -106,7 +106,7 @@ https://github.com/roboflow/supervision/assets/26109316/691e219c-0565-4403-9218-
106106

107107
### datasets
108108

109-
Supervision provides a set of [utils](https://supervision.roboflow.com/latest/datasets/) that allow you to load, split, merge, and save datasets in one of the supported formats.
109+
Supervision provides a set of [utils](https://supervision.roboflow.com/latest/datasets/core/) that allow you to load, split, merge, and save datasets in one of the supported formats.
110110

111111
```python
112112
import supervision as sv
@@ -216,7 +216,7 @@ len(dataset)
216216

217217
## 🎬 tutorials
218218

219-
Want to learn how to use Supervision? Explore our [how-to guides](https://supervision.roboflow.com/develop/how_to/detect_and_annotate/), [end-to-end examples](https://github.com/roboflow/supervision/tree/develop/examples), and [cookbooks](https://supervision.roboflow.com/develop/cookbooks/)!
219+
Want to learn how to use Supervision? Explore our [how-to guides](https://supervision.roboflow.com/develop/how_to/detect_and_annotate/), [end-to-end examples](https://github.com/roboflow/supervision/tree/develop/examples), [cheatsheet](https://roboflow.github.io/cheatsheet-supervision/), and [cookbooks](https://supervision.roboflow.com/develop/cookbooks/)!
220220

221221
<br/>
222222

0 commit comments

Comments
 (0)