Skip to content

Commit

Permalink
feat: updated project
Browse files Browse the repository at this point in the history
  • Loading branch information
Mah Neh committed Sep 19, 2024
1 parent 417e5b5 commit 993d464
Show file tree
Hide file tree
Showing 139 changed files with 1,458 additions and 1,371 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM mcr.microsoft.com/vscode/devcontainers/python:3.10
FROM mcr.microsoft.com/devcontainers/python:3.11
COPY setup.sh /setup.sh
17 changes: 9 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
{
"name":"keras-tuner-python",
"dockerFile": "Dockerfile",
"postCreateCommand": "sh /setup.sh",
"customizations": {
"vscode": {
"settings": {
"python.analysis.typeCheckingMode": "standard",
"python.analysis.autoFormatStrings": true,
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.pylintEnabled": false,
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
"editor.defaultFormatter": "charliermarsh.ruff"
},
"editor.rulers": [
80
]
},
"extensions": [
"ms-python.python",
"ms-python.isort",
"ms-python.flake8",
"ms-python.black-formatter"
"ms-pyright.pyright",
"charliermarsh.ruff",
"streetsidesoftware.code-spell-checker"
]
}
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
}
}
}
5 changes: 2 additions & 3 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sudo pip install --upgrade pip
sudo pip install -e ".[tensorflow-cpu,tests]"
echo "sh shell/lint.sh" > .git/hooks/pre-commit
chmod a+x .git/hooks/pre-commit
sudo pip install -e ".[tensorflow-cpu,dev]"
pre-commit install
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ labels: ''
assignees: ''

---


99 changes: 33 additions & 66 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Tests

on:
push:
branches: [ master ]
branches: [master]
pull_request:
release:
types: [created]
Expand All @@ -11,35 +11,33 @@ permissions:
contents: read

jobs:
build:
name: Test the code with tf.keras
build: # builds, caches the packages, runs tests.
name: Test the code with keras
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.11"
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade pip setuptools build
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
pip install -e ".[tests]" --progress-bar off --upgrade
pip install tensorflow-cpu==2.14.0
pip install jax[cpu]
pip install -e ".[dev, backends]" --progress-bar off --upgrade
- name: Test with pytest
run: |
pytest --cov=keras_tuner --cov-report xml:coverage.xml
- name: Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
multibackend:
name: Test the code with Keras Core
strategy:
Expand All @@ -49,27 +47,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.11"
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install --upgrade pip setuptools
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
- name: Install dependencies
run: |
pip install -e ".[tests]" --progress-bar off --upgrade
pip install torch>=2.0.1+cpu --progress-bar off
pip install jax[cpu] --progress-bar off
pip uninstall keras -y
pip install tensorflow==2.16.0rc0
pip install -e ".[dev,backends]" --progress-bar off --upgrade
- name: Test with pytest
env:
KERAS_BACKEND: ${{ matrix.backend }}
Expand All @@ -82,78 +76,51 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.11"
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install --upgrade pip setuptools
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
pip install -e ".[tensorflow-cpu,tests]" --progress-bar off --upgrade
pip install -e ".[tensorflow>=2.17,dev]" --progress-bar off --upgrade
- name: Lint
run: bash shell/lint.sh
guides:
name: Run the keras.io guides
run: bash shell/lint_format.sh
deploy:
needs: [build, format, multibackend]
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.11"
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install --upgrade pip setuptools
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
pip install -e ".[tensorflow-cpu,tests]" --progress-bar off --upgrade
- name: Run the guides
run: bash shell/run_guides.sh
deploy:
needs: [build, format,multibackend]
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install --upgrade pip setuptools
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel twine
pip install -e ".[build]" --progress-bar off --upgrade
- name: Build a binary wheel and a source tarball
run: >-
python pip_build.py
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_PASSWORD }}
python -m pip install --upgrade pip build setuptools wheel twine
- name: Build a binary wheel and a source tarball
run: python -m build
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_PASSWORD }}
13 changes: 13 additions & 0 deletions .github/workflows/git-cliff-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v3
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}
35 changes: 0 additions & 35 deletions .github/workflows/integration_tests.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ tmp.py
htmlcov
old_code/
docs/sources
.venv
dist
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0 # Use the ref you want to point at
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
- id: mixed-line-ending
- id: end-of-file-fixer
- id: trailing-whitespace
- id: name-tests-test
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.5
hooks:
# Run the linter.
- id: ruff
args: [check, --select, I, --fix]
# Run the formatter.
- id: ruff-format
# args: [--config, format.line-ending = 'lf']
Loading

0 comments on commit 993d464

Please sign in to comment.