Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Refactored package for incoming v0.2 #138

Merged
merged 27 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d6d2d72
ci: Revamped CI
frgfm May 19, 2022
1dbc3c7
style: Added quality tool configs
frgfm May 19, 2022
83b802f
refactor: Moved test to tests
frgfm May 19, 2022
fe70a09
style: Reordered imports
frgfm May 19, 2022
5a0263f
chore: Updated torch & torchvision requirements
frgfm May 19, 2022
bebd786
docs: Added code of conduct and makefile
frgfm May 19, 2022
c923a1d
refactor: Removed nn module
frgfm May 19, 2022
5436793
refactor: Removed old models
frgfm May 19, 2022
60be626
refactor: Removed unused ref
frgfm May 19, 2022
0a4cc86
refactor: Revamped datasets and models
frgfm May 19, 2022
9b23919
test: Switched unittest to pytest
frgfm May 19, 2022
d49376c
chore: Updated requirements
frgfm May 19, 2022
fb39248
style: Updated mypy config
frgfm May 19, 2022
55bcc80
refactor: Refactored classification training script
frgfm May 19, 2022
ff06893
fix: Fixed training script
frgfm May 19, 2022
ea89931
docs: Fixed documentation
frgfm May 19, 2022
180a69c
chore: Updated training requirements
frgfm May 19, 2022
e6ade3c
fix: Added back docker
frgfm May 19, 2022
241548b
ci: Fixed ci jobs
frgfm May 19, 2022
2329700
fix: Added missing imports
frgfm May 19, 2022
1b4b889
chore: Fixed doc deps
frgfm May 19, 2022
8f75756
chore: Fixed __init__
frgfm May 19, 2022
24fbfb1
docs: Fixed docstring
frgfm May 19, 2022
5fc20d7
chore: Fixed import
frgfm May 19, 2022
ad09bd2
docs: Fixed README usage instruction
frgfm May 19, 2022
f64c677
test: Added test flexibility
frgfm May 19, 2022
244952c
style: Fixed typing
frgfm May 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[flake8]
max-line-length = 120
ignore = F401, E402, E265, F403, W503, W504, F821
exclude = venv*, .circleci, .git, docs
ignore = E402, E265, F403, W503, W504, E731
exclude = .github, .git, venv*, docs, build
per-file-ignores = **/__init__.py:F401
54 changes: 0 additions & 54 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

64 changes: 64 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 🐛 Bug report
description: Create a report to help us improve the library
labels: bug
assignees: frgfm

body:
- type: markdown
attributes:
value: >
#### Before reporting a bug, please check that the issue hasn't already been addressed in [the existing and past issues](https://github.com/pyronear/pyro-vision/issues?q=is%3Aissue).
- type: textarea
attributes:
label: Bug description
description: |
A clear and concise description of what the bug is.

Please explain the result you observed and the behavior you were expecting.
placeholder: |
A clear and concise description of what the bug is.
validations:
required: true

- type: textarea
attributes:
label: Code snippet to reproduce the bug
description: |
Sample code to reproduce the problem.

Please wrap your code snippet with ```` ```triple quotes blocks``` ```` for readability.
placeholder: |
```python
Sample code to reproduce the problem
```
validations:
required: true
- type: textarea
attributes:
label: Error traceback
description: |
The error message you received running the code snippet, with the full traceback.

Please wrap your error message with ```` ```triple quotes blocks``` ```` for readability.
placeholder: |
```
The error message you got, with the full traceback.
```
validations:
required: true
- type: textarea
attributes:
label: Environment
description: |
Please run the following command and paste the output below.
```sh
wget https://raw.githubusercontent.com/pyronear/pyro-vision/master/scripts/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
```
validations:
required: true
- type: markdown
attributes:
value: >
Thanks for helping us improve the library!
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Usage questions
url: https://github.com/pyronear/pyro-vision/discussions
about: Ask questions and discuss with other Pyronear community members
27 changes: 0 additions & 27 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 🚀 Feature request
description: Submit a proposal/request for a new feature for pyrovision
labels: enhancement
assignees: frgfm

body:
- type: textarea
attributes:
label: 🚀 Feature
description: >
A clear and concise description of the feature proposal
validations:
required: true
- type: textarea
attributes:
label: Motivation & pitch
description: >
Please outline the motivation for the proposal. Is your feature request related to a specific problem? e.g., *"I'm working on X and would like Y to be possible"*. If this is related to another GitHub issue, please link here too.
validations:
required: true
- type: textarea
attributes:
label: Alternatives
description: >
A description of any alternative solutions or features you've considered, if any.
- type: textarea
attributes:
label: Additional context
description: >
Add any other context or screenshots about the feature request.
- type: markdown
attributes:
value: >
Thanks for contributing 🎉
64 changes: 64 additions & 0 deletions .github/validate_deps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
from pathlib import Path

import requirements
from requirements.requirement import Requirement

# Deps that won't have a specific requirements.txt
IGNORE = ["flake8", "isort", "mypy", "pydocstyle"]
# All req files to check
REQ_FILES = ["requirements.txt", "tests/requirements.txt", "docs/requirements.txt"]


def main():

# Collect the deps from all requirements.txt
folder = Path(__file__).parent.parent.absolute()
req_deps = {}
for file in REQ_FILES:
with open(folder.joinpath(file), 'r') as f:
_deps = [(req.name, req.specs) for req in requirements.parse(f)]

for _dep in _deps:
lib, specs = _dep
assert req_deps.get(lib, specs) == specs, f"conflicting deps for {lib}"
req_deps[lib] = specs

# Collect the one from setup.py
setup_deps = {}
with open(folder.joinpath("setup.py"), 'r') as f:
setup = f.readlines()
lines = setup[setup.index("_deps = [\n") + 1:]
lines = [_dep.strip() for _dep in lines[:lines.index("]\n")]]
lines = [_dep.split('"')[1] for _dep in lines if _dep.startswith('"')]
_reqs = [Requirement.parse(_line) for _line in lines]
_deps = [(req.name, req.specs) for req in _reqs]
for _dep in _deps:
lib, specs = _dep
assert setup_deps.get(lib) is None, f"conflicting deps for {lib}"
setup_deps[lib] = specs

# Remove ignores
for k in IGNORE:
if isinstance(req_deps.get(k), list):
del req_deps[k]
if isinstance(setup_deps.get(k), list):
del setup_deps[k]

# Compare them
assert len(req_deps) == len(setup_deps)
mismatches = []
for k, v in setup_deps.items():
assert isinstance(req_deps.get(k), list)
if req_deps[k] != v:
mismatches.append((k, v, req_deps[k]))

if len(mismatches) > 0:
mismatch_str = "version specifiers mismatches:\n"
mismatch_str += '\n'.join(
f"- {lib}: {setup} (from setup.py) | {reqs} (from requirements)"
for lib, setup, reqs in mismatches
)
raise AssertionError(mismatch_str)

if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion .github/validate_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


IGNORED_FILES = ["version.py", "__init__.py"]
FOLDERS = ["pyrovision", "scripts", "references"]
FOLDERS = ["pyrovision", "scripts"]


def main():
Expand All @@ -54,6 +54,7 @@ def main():
for option in HEADERS
):
invalid_files.append(source_path)

if len(invalid_files) > 0:
invalid_str = "\n- " + "\n- ".join(map(str, invalid_files))
raise AssertionError(f"Invalid header in the following files:{invalid_str}")
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: [3.7, 3.8, 3.9]
python: [3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -28,9 +28,6 @@ jobs:
key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('**/*.py') }}
restore-keys: |
${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}-
${{ runner.os }}-pkg-deps-${{ matrix.python }}-
${{ runner.os }}-pkg-deps-
${{ runner.os }}-
- name: Install package
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:
branches: master

jobs:
docker-ready:
docker-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build docker image
run: docker build . -t pyrovision-py3.8.1-torch1.7-slim
run: docker build . -t pyrovision:latest-py3.8.1-slim
- name: Run docker container
run: docker run pyrovision-py3.8.1-torch1.7-slim python -c "import pyrovision; print(pyrovision.__version__)"
run: docker run pyrovision:latest-py3.8.1-slim python -c 'import pyrovision'
6 changes: 1 addition & 5 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ jobs:
restore-keys: |
${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('docs/requirements.txt') }}-
${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}-
${{ runner.os }}-pkg-deps-${{ matrix.python }}-
${{ runner.os }}-pkg-deps-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r docs/requirements.txt
pip install -e ".[docs]"

- name: Build documentation
run: sphinx-build docs/source docs/build -a -v
Expand Down
Loading