Skip to content

Commit

Permalink
Cleanup legacy code (#1)
Browse files Browse the repository at this point in the history
* clean up legacy code

* remove unused types

* recurse submodule

* test

* fix

* upload to codecov

* do not ignore video processor

* test

* ignore codecov

* remove inview old
  • Loading branch information
chanwutk authored Aug 7, 2023
1 parent c827e98 commit c537bb7
Show file tree
Hide file tree
Showing 33 changed files with 183 additions and 3,884 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/clean-up-and-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: ./scripts/commit-and-push.sh "[CI] cleanup python notebooks"

format:
name: Format and Lint
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -60,7 +60,3 @@ jobs:

- name: Commit formatted changes
run: ./scripts/commit-and-push.sh "[CI] format"

- name: Analyze the code with flake8
if: always()
run: python -m flake8 spatialyze --statistics
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint
on:
push:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT || github.token }}

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Dependencies
run: |
pip install --upgrade pip
pip install flake8
- name: Analyze the code with flake8
run: python -m flake8 spatialyze --statistics
80 changes: 0 additions & 80 deletions .github/workflows/test-video-processor.yml

This file was deleted.

148 changes: 140 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,89 @@ on:
push:

jobs:
test:
name: Test
test-video-processor:
name: Test Video Processor
runs-on: ubuntu-latest
services:
mobilitydb:
image: mobilitydb/mobilitydb:14-3.2-1
ports:
- 25440:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT || github.token }}
submodules: recursive

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
init-shell: none
cache-downloads: false

- name: Check Python Versions
shell: micromamba-shell {0}
run: |
python --version
python3 --version
which python
which python3
which pip
which pip3
which poetry
- name: Install Dependencies
shell: micromamba-shell {0}
run: poetry install --no-interaction --without dev --with test

- name: Install lap (Hack)
shell: micromamba-shell {0}
run: |
pip install --upgrade pip
pip install lap
- name: Check Installed Packages
shell: micromamba-shell {0}
run: pip list

- name: Extend MobilityDB with User-Defined functions
shell: micromamba-shell {0}
run: |
pushd scripts/pg-extender
python ../generate_pg_extender.py
cat install.sql
psql -h localhost -p 25440 -d mobilitydb -U docker -c "SET client_min_messages TO WARNING;" -c "\i install.sql;"
popd
env:
PGPASSWORD: docker

- name: Ingest data
shell: micromamba-shell {0}
run: |
python ./scripts/ingest_road.py
env:
AP_PORT: 25440

- name: Unit Test
shell: micromamba-shell {0}
run: pytest --cov=spatialyze --cov-report=xml tests/video_processor
env:
AP_PORT: 25440

- uses: actions/upload-artifact@v3
with:
name: video-processor-coverage
path: ./coverage.xml

test-engine-and-interface:
name: Test Engine and Interface
runs-on: ubuntu-latest
services:
mobilitydb:
Expand Down Expand Up @@ -131,9 +212,60 @@ jobs:
AP_PORT_RESET: 25443
AP_PORT_IMPORT: 25444
AP_PORT_SQL: 25445

- name: Upload coverage reports to Codecov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${{ secrets.CODECOV_TOKEN }}

- uses: actions/upload-artifact@v3
with:
name: engine-and-interface-coverage
path: ./coverage.xml

upload-coverage:
name: Upload Coverage
needs: [test-video-processor, test-engine-and-interface]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT || github.token }}

- name: Download Coverage
uses: actions/download-artifact@v3

- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
verbose: true

# - name: Download Coverage
# uses: actions/download-artifact@v3
# with:
# name: video-processor-coverage
# path: ./video-processor-coverage

# - name: Download Coverage
# uses: actions/download-artifact@v3
# with:
# name: engine-and-interface-coverage
# path: ./engine-and-interface-coverage

# - name: Combine Coverage
# shell: micromamba-shell {0}
# run: |
# pip install coverage
# coverage combine ./video-processor-coverage ./engine-and-interface-coverage
# coverage xml
# coverage report
# coverage html
# coverage-badge -o coverage.svg -f

# - name: Upload Coverage
# uses: actions/upload-artifact@v3
# with:
# name: coverage
# path: ./coverage.xml

# - name: Upload Coverage
# uses: actions/upload-artifact@v3
# with:
# name: coverage-badge
# path: ./coverage.svg
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
<p align="center">
<a href="https://github.com/apperception-db/spatialyze/actions/workflows/test.yml"><img
alt="Github Actions Test Status"
src="https://img.shields.io/github/actions/workflow/status/apperception-db/spatialyze/test.yml?label=Test&style=flat-square"
></a>
<a href="https://github.com/apperception-db/spatialyze/actions/workflows/test-video-processor.yml"><img
alt="Github Actions Test Video Processor Status"
src="https://img.shields.io/github/actions/workflow/status/apperception-db/spatialyze/test-video-processor.yml?label=Test%20Video%20Processor&style=flat-square"
src="https://img.shields.io/github/actions/workflow/status/apperception-db/spatialyze/test.yml?label=Test&style=for-the-badge"
></a>
<a href="https://github.com/apperception-db/spatialyze/actions/workflows/check.yml"><img
alt="Github Actions Type Check Status"
src="https://img.shields.io/github/actions/workflow/status/apperception-db/spatialyze/check.yml?label=Type%20Check&style=flat-square"
src="https://img.shields.io/github/actions/workflow/status/apperception-db/spatialyze/check.yml?label=Type%20Check&style=for-the-badge"
></a>
<a href="https://github.com/psf/black"><img
<a href="https://github.com/apperception-db/spatialyze/actions/workflows/lint.yml"><img
alt="Github Actions Type Check Status"
src="https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square"
src="https://img.shields.io/github/actions/workflow/status/apperception-db/spatialyze/lint.yml?label=Lint&style=for-the-badge"
></a>
<a href="https://codecov.io/gh/apperception-db/spatialyze"><img
alt="Codecov Coverage Status"
src="https://img.shields.io/codecov/c/github/apperception-db/spatialyze.svg?style=flat-square"
src="https://img.shields.io/codecov/c/github/apperception-db/spatialyze.svg?label=Coverage&style=for-the-badge"
></a>
<a href="https://github.com/psf/black"><img
alt="Github Actions Type Check Status"
src="https://img.shields.io/badge/black-000000.svg?label=Code%20style&style=for-the-badge"
></a>
</p>
Expand Down
9 changes: 7 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
ignore:
- "spatialyze/legacy"
- "spatialyze/video_processor"
- "spatialyze/video_processor/stages/detection_estimation"
- "spatialyze/video_processor/stages/segment_trajectory"
- "spatialyze/video_processor/stages/depth_estimation.py"
- "spatialyze/video_processor/stages/strongsort_with_skip.py"
- "spatialyze/video_processor/utils/preprocess.py"
- "spatialyze/video_processor/utils/process_pipeline.py"
- "spatialyze/video_processor/utils/query_analyzer.py"
- "**/__init__.py"
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ exclude = 'spatialyze/video_processor/modules'
[tool.pyright]
pythonVersion = '3.10'
ignore = [
'spatialyze/legacy/*',
'spatialyze/trackers/object_tracker_yolov4_deepsort.py',
'spatialyze/trackers/object_tracker_yolov5_deepsort.py',
'spatialyze/video_processor/modules',
'spatialyze/video_processor/stages/detection_estimation',
'spatialyze/video_processor/stages/segment_trajectory',
Expand Down
2 changes: 0 additions & 2 deletions spatialyze/data_types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from . import views
from .bounding_box import BoundingBox
from .box import Box
from .camera import Camera
Expand All @@ -14,6 +13,5 @@
"Camera",
"TrackedObject",
"Trajectory",
"views",
"FetchCameraTuple",
]
9 changes: 0 additions & 9 deletions spatialyze/data_types/views/__init__.py

This file was deleted.

21 changes: 0 additions & 21 deletions spatialyze/data_types/views/camera_view.py

This file was deleted.

11 changes: 0 additions & 11 deletions spatialyze/data_types/views/location_view.py

This file was deleted.

Loading

0 comments on commit c537bb7

Please sign in to comment.