Skip to content

Commit

Permalink
Create operational resources
Browse files Browse the repository at this point in the history
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
LukeWood committed Nov 9, 2021
1 parent c83f94b commit 404f686
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/actions.yml
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
27 changes: 27 additions & 0 deletions .gitignore
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
61 changes: 61 additions & 0 deletions setup.py
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",)),
)
4 changes: 4 additions & 0 deletions shell/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
isort --sl .
black --line-length 85 .

27 changes: 27 additions & 0 deletions shell/lint.sh
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

0 comments on commit 404f686

Please sign in to comment.