Skip to content

Commit b482784

Browse files
authored
Merge branch 'develop' into feature/fps
2 parents 3b00e04 + 6f30c87 commit b482784

50 files changed

Lines changed: 2432 additions & 247 deletions

Some content is hidden

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

.github/workflows/publish-test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Supervision Test Releases to PyPi
2+
on:
3+
push:
4+
tags:
5+
- '[0-9]+.[0-9]+[0-9]+.[0-9]+a[0-9]'
6+
- '[0-9]+.[0-9]+[0-9]+.[0-9]+b[0-9]'
7+
- '[0-9]+.[0-9]+[0-9]+.[0-9]+rc[0-9]'
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-n-publish:
14+
name: Build and publish to PyPI
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout source
19+
uses: actions/checkout@v3
20+
21+
- name: 🐍 Set up Python 3.8 environment for build
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: "3.8"
25+
26+
- name: 🏗️ Build source and wheel distributions
27+
run: |
28+
python -m pip install --upgrade build twine
29+
python -m build
30+
twine check --strict dist/*
31+
- name: 🚀 Publish distribution to PyPI
32+
uses: pypa/gh-action-pypi-publish@release/v1
33+
with:
34+
user: ${{ secrets.PYPI_USERNAME }}
35+
password: ${{ secrets.PYPI_PASSWORD }}
36+
- name: 🚀 Publish to Test-PyPi
37+
uses: pypa/gh-action-pypi-publish@release/v1
38+
with:
39+
repository-url: https://test.pypi.org/legacy/
40+
user: ${{ secrets.PYPI_TEST_USERNAME }}
41+
password: ${{ secrets.PYPI_TEST_PASSWORD }}

.github/workflows/publish.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
name: Publish WorkFlow
2-
1+
name: Supervision Releases to PyPi
32
on:
4-
release:
5-
types: [created]
3+
push:
4+
tags:
5+
- '[0-9]+.[0-9]+[0-9]+.[0-9]'
6+
- '[0-9]+.[0-9]+[0-9]+.[0-9]'
7+
- '[0-9]+.[0-9]+[0-9]+.[0-9]'
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
611

712
jobs:
813
build:
@@ -19,15 +24,6 @@ jobs:
1924
uses: actions/setup-python@v4
2025
with:
2126
python-version: ${{ matrix.python-version }}
22-
- name: 🦾 Install dependencies
23-
run: |
24-
python -m pip install --upgrade virtualenv
25-
python -m pip install --upgrade pip
26-
virtualenv venv
27-
source venv/bin/activate
28-
python -m pip install --upgrade pip
29-
python -m pip install --upgrade poetry
30-
poetry install
3127

3228
- name: 🏗️ Build source and wheel distributions
3329
run: |
@@ -43,5 +39,5 @@ jobs:
4339
uses: pypa/gh-action-pypi-publish@release/v1
4440
with:
4541
repository-url: https://test.pypi.org/legacy/
46-
user: ${{ secrets.PYPI_USERNAME }}
42+
user: ${{ secrets.PYPI_TEST_USERNAME }}
4743
password: ${{ secrets.PYPI_TEST_PASSWORD }}

.github/workflows/test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,5 @@ jobs:
2222
python -m pip install --upgrade pip
2323
pip install -e .
2424
pip install pytest
25-
pip install isort
26-
pip install flake8
27-
pip install "black==22.3.0"
2825
- name: 🧪 Test
2926
run: "python -m pytest ./test"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ coverage.xml
5454
*.py,cover
5555
.hypothesis/
5656
.pytest_cache/
57+
.ruff_cache/
5758

5859
# Translations
5960
*.mo

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ repos:
4040
name: Sort imports
4141

4242
- repo: https://github.com/PyCQA/flake8
43-
rev: 6.0.0
43+
rev: 6.1.0
4444
hooks:
4545
- id: flake8
4646
name: Flake8 Checks
47-
entry: pflake8
48-
additional_dependencies: [pyproject-flake8]
47+
entry: flake8
48+
additional_dependencies: [Flake8-pyproject]
4949

5050

5151
- repo: https://github.com/PyCQA/bandit
@@ -69,12 +69,12 @@ repos:
6969

7070

7171
- repo: https://github.com/psf/black
72-
rev: 23.7.0
72+
rev: 23.9.1
7373
hooks:
7474
- id: black
7575

7676
- repo: https://github.com/astral-sh/ruff-pre-commit
77-
rev: v0.0.280
77+
rev: v0.0.292
7878
hooks:
7979
- id: ruff
8080
args: [--fix, --exit-non-zero-on-fix]

CODE_OF_CONDUCT.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
2+
# Contributor Covenant Code of Conduct
3+
4+
## Our Pledge
5+
6+
We as members, contributors, and leaders pledge to make participation in our
7+
community a harassment-free experience for everyone, regardless of age, body
8+
size, visible or invisible disability, ethnicity, sex characteristics, gender
9+
identity and expression, level of experience, education, socio-economic status,
10+
nationality, personal appearance, race, caste, color, religion, or sexual
11+
identity and orientation.
12+
13+
We pledge to act and interact in ways that contribute to an open, welcoming,
14+
diverse, inclusive, and healthy community.
15+
16+
## Our Standards
17+
18+
Examples of behavior that contributes to a positive environment for our
19+
community include:
20+
21+
* Demonstrating empathy and kindness toward other people
22+
* Being respectful of differing opinions, viewpoints, and experiences
23+
* Giving and gracefully accepting constructive feedback
24+
* Accepting responsibility and apologizing to those affected by our mistakes,
25+
and learning from the experience
26+
* Focusing on what is best not just for us as individuals, but for the overall
27+
community
28+
29+
Examples of unacceptable behavior include:
30+
31+
* The use of sexualized language or imagery, and sexual attention or advances of
32+
any kind
33+
* Trolling, insulting or derogatory comments, and personal or political attacks
34+
* Public or private harassment
35+
* Publishing others' private information, such as a physical or email address,
36+
without their explicit permission
37+
* Other conduct which could reasonably be considered inappropriate in a
38+
professional setting
39+
40+
## Enforcement Responsibilities
41+
42+
Community leaders are responsible for clarifying and enforcing our standards of
43+
acceptable behavior and will take appropriate and fair corrective action in
44+
response to any behavior that they deem inappropriate, threatening, offensive,
45+
or harmful.
46+
47+
Community leaders have the right and responsibility to remove, edit, or reject
48+
comments, commits, code, wiki edits, issues, and other contributions that are
49+
not aligned to this Code of Conduct, and will communicate reasons for moderation
50+
decisions when appropriate.
51+
52+
## Scope
53+
54+
This Code of Conduct applies within all community spaces, and also applies when
55+
an individual is officially representing the community in public spaces.
56+
Examples of representing our community include using an official e-mail address,
57+
posting via an official social media account, or acting as an appointed
58+
representative at an online or offline event.
59+
60+
## Enforcement
61+
62+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
63+
reported to the community leaders responsible for enforcement at
64+
[INSERT CONTACT METHOD].
65+
All complaints will be reviewed and investigated promptly and fairly.
66+
67+
All community leaders are obligated to respect the privacy and security of the
68+
reporter of any incident.
69+
70+
## Enforcement Guidelines
71+
72+
Community leaders will follow these Community Impact Guidelines in determining
73+
the consequences for any action they deem in violation of this Code of Conduct:
74+
75+
### 1. Correction
76+
77+
**Community Impact**: Use of inappropriate language or other behavior deemed
78+
unprofessional or unwelcome in the community.
79+
80+
**Consequence**: A private, written warning from community leaders, providing
81+
clarity around the nature of the violation and an explanation of why the
82+
behavior was inappropriate. A public apology may be requested.
83+
84+
### 2. Warning
85+
86+
**Community Impact**: A violation through a single incident or series of
87+
actions.
88+
89+
**Consequence**: A warning with consequences for continued behavior. No
90+
interaction with the people involved, including unsolicited interaction with
91+
those enforcing the Code of Conduct, for a specified period of time. This
92+
includes avoiding interactions in community spaces as well as external channels
93+
like social media. Violating these terms may lead to a temporary or permanent
94+
ban.
95+
96+
### 3. Temporary Ban
97+
98+
**Community Impact**: A serious violation of community standards, including
99+
sustained inappropriate behavior.
100+
101+
**Consequence**: A temporary ban from any sort of interaction or public
102+
communication with the community for a specified period of time. No public or
103+
private interaction with the people involved, including unsolicited interaction
104+
with those enforcing the Code of Conduct, is allowed during this period.
105+
Violating these terms may lead to a permanent ban.
106+
107+
### 4. Permanent Ban
108+
109+
**Community Impact**: Demonstrating a pattern of violation of community
110+
standards, including sustained inappropriate behavior, harassment of an
111+
individual, or aggression toward or disparagement of classes of individuals.
112+
113+
**Consequence**: A permanent ban from any sort of public interaction within the
114+
community.
115+
116+
## Attribution
117+
118+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119+
version 2.1, available at
120+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121+
122+
Community Impact Guidelines were inspired by
123+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127+
[https://www.contributor-covenant.org/translations][translations].
128+
129+
[homepage]: https://www.contributor-covenant.org
130+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131+
[Mozilla CoC]: https://github.com/mozilla/diversity
132+
[FAQ]: https://www.contributor-covenant.org/faq
133+
[translations]: https://www.contributor-covenant.org/translations

CONTRIBUTING.md

Lines changed: 78 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ We welcome contributions to:
1414
4. Submit a request for a new feature.
1515
5. Improve our test coverage.
1616

17-
### Contributing Features
17+
### Contributing Features
1818

1919
Supervision is designed to provide generic utilities to solve problems. Thus, we focus on contributions that can have an impact on a wide range of projects.
2020

@@ -24,29 +24,99 @@ Before you contribute a new feature, consider submitting an Issue to discuss the
2424

2525
## How to Contribute Changes
2626

27-
First, fork this repository to your own GitHub account. Create a new branch that describes your changes (i.e. `line-counter-docs`). Push your changes to the branch on your fork and then submit a pull request to `develop` branch of this repository.
27+
First, fork this repository to your own GitHub account. Click "fork" in the top corner of the `supervision` repository to get started:
28+
29+
![Forking the repository](https://media.roboflow.com/fork.png)
30+
31+
![Creating a repository fork](https://media.roboflow.com/create_fork.png)
32+
33+
Then, run `git clone` to download the project code to your computer.
34+
35+
Move to a new branch using the `git checkout` command:
36+
37+
```bash
38+
git checkout -b <your_branch_name>
39+
```
40+
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:
44+
45+
```bash
46+
git add .
47+
git commit -m "Your commit message"
48+
git push -u origin main
49+
```
50+
51+
## 🎨 Code quality
52+
53+
### Pre-commit tool
54+
55+
This project utilizes 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.
66+
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.
68+
69+
### Docstrings
70+
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.
72+
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.
74+
75+
### Type checking
76+
77+
So far, **there is no type checking with mypy**. See [issue](https://github.com/roboflow-ai/template-python/issues/4).
78+
79+
80+
Then, go back to your fork of the `supervision` repository, click "Pull Requests", and click "New Pull Request".
81+
82+
![Opening a pull request](https://media.roboflow.com/open_pr.png)
83+
84+
Make sure the `base` branch is `develop` before submitting your PR.
85+
86+
On the next page, review your changes then click "Create pull request":
87+
88+
![Configuring a pull request](https://media.roboflow.com/create_pr_submit.png)
89+
90+
Next, write a description for your pull request, and click "Create pull request" again to submit it for review:
91+
92+
![Submitting a pull request](https://media.roboflow.com/write_pr.png)
2893

2994
When creating new functions, please ensure you have the following:
3095

3196
1. Docstrings for the function and all parameters.
3297
2. Unit tests for the function.
3398
3. Examples in the documentation for the function.
3499
4. Created an entry in our docs to autogenerate the documentation for the function.
35-
5. Please share google colab with minimal code to test new feature or reproduce PR whenever it is possible. Please ensure that google colab can be accessed without any issue.
100+
5. Please share a Google Colab with minimal code to test new feature or reproduce PR whenever it is possible. Please ensure that Google Colab can be accessed without any issue.
101+
102+
When you submit your Pull Request, you will be asked to sign a Contributor License Agreement (CLA) by the `cla-assistant` GitHub bot. We can only respond to PRs from contributors who have signed the project CLA.
36103

37104
All pull requests will be reviewed by the maintainers of the project. We will provide feedback and ask for changes if necessary.
38105

39106
PRs must pass all tests and linting requirements before they can be merged.
40107

41-
## 🧹 code quality
108+
## 📝 documentation
42109

43-
We provide two handy commands inside the `Makefile`, namely:
110+
The `supervision` documentation is stored in a folder called `docs`. The project documentation is built using `mkdocs`.
44111

45-
- `make style` to format the code
46-
- `make check_code_quality` to check code quality (PEP8 basically)
112+
To run the documentation, install the project requirements with `poetry install dev`. Then, run `mkdocs serve` to start the documentation server.
47113

48-
So far, **there is no types checking with mypy**. See [issue](https://github.com/roboflow-ai/template-python/issues/4).
114+
You can learn more about mkdocs on the [mkdocs website](https://www.mkdocs.org/).
49115

50116
## 🧪 tests
51117

52118
[`pytests`](https://docs.pytest.org/en/7.1.x/) is used to run our tests.
119+
120+
## 📄 license
121+
122+
By contributing, you agree that your contributions will be licensed under an [MIT license](https://github.com/roboflow/supervision/blob/develop/LICENSE.md).

0 commit comments

Comments
 (0)