-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit begins implementing the operational pieces of the keras-cv repo. This includes a setup.py package, a github action to lint, and scripts to complete linting.
- Loading branch information
Showing
5 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
release: | ||
types: [created] | ||
jobs: | ||
format: | ||
name: Check the code format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Get pip cache dir | ||
id: pip-cache | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
echo "::set-output name=dir::$(pip cache dir)" | ||
- name: pip cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
pip install tensorflow | ||
pip install -e ".[tests]" --progress-bar off --upgrade | ||
- name: Lint | ||
run: bash shell/lint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
keras_cv.egg-info/ | ||
*.swp | ||
.idea | ||
*.pyc | ||
.pytest_cache | ||
*.egg-info | ||
|
||
#VS Code files and container | ||
.vscode/ | ||
.devcontainer/ | ||
|
||
build/ | ||
dist/ | ||
bigquery/ | ||
export/ | ||
logs/ | ||
Keras_Tuner.egg-info/ | ||
results/ | ||
tmp/ | ||
.ipynb_checkpoints/ | ||
*_tutorial_results/ | ||
tmp.py | ||
.coverage | ||
.coverage.* | ||
htmlcov | ||
old_code/ | ||
docs/sources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright 2019 The KerasCV Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Setup script.""" | ||
|
||
from setuptools import find_packages | ||
from setuptools import setup | ||
|
||
setup( | ||
name="keras-cv", | ||
description="Computer Vision extensions for Keras.", | ||
url="https://github.com/keras-team/keras-cv", | ||
author="The KerasCV authors", | ||
author_email="keras-cv@google.com", | ||
license="Apache License 2.0", | ||
# tensorflow isn't a dependency because it would force the | ||
# download of the gpu version or the cpu version. | ||
# users should install it manually. | ||
install_requires=[ | ||
"packaging", | ||
"numpy", | ||
"requests", | ||
"scipy", | ||
"tensorboard", | ||
"ipython", | ||
"kt-legacy", | ||
], | ||
extras_require={ | ||
"tests": [ | ||
"pytest", | ||
"flake8", | ||
"isort", | ||
"black", | ||
"portpicker", | ||
"pytest-xdist", | ||
"pytest-cov", | ||
], | ||
}, | ||
classifiers=[ | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.7", | ||
"Operating System :: Unix", | ||
"Operating System :: Microsoft :: Windows", | ||
"Operating System :: MacOS", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Software Development", | ||
], | ||
packages=find_packages(exclude=("tests",)), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
isort --sl . | ||
black --line-length 85 . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
isort --sl -c . | ||
if ! [ $? -eq 0 ] | ||
then | ||
echo "Please run \"sh shell/format.sh\" to format the code." | ||
exit 1 | ||
fi | ||
flake8 . | ||
if ! [ $? -eq 0 ] | ||
then | ||
echo "Please fix the code style issue." | ||
exit 1 | ||
fi | ||
black --check --line-length 85 . | ||
if ! [ $? -eq 0 ] | ||
then | ||
echo "Please run \"sh shell/format.sh\" to format the code." | ||
exit 1 | ||
fi | ||
for i in $(find keras_cv tests -name '*.py') # or whatever other pattern... | ||
do | ||
if ! grep -q Copyright $i | ||
then | ||
echo "Please run \"sh shell/format.sh\" to format the code." | ||
exit 1 | ||
fi | ||
done |