Skip to content

Commit

Permalink
chore: squash commits for release
Browse files Browse the repository at this point in the history
  • Loading branch information
amitkparekh committed Dec 8, 2023
0 parents commit 03539cc
Show file tree
Hide file tree
Showing 339 changed files with 733,154 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
storage/
!storage/constants/
tests/
demos/
logs/
notebooks/
scripts/
**/*_*cache*_*
/.*
*.lock
*.ini
*.toml
*.md
!pyproject.toml
!poetry.lock
!README.md
Dockerfile
34 changes: 34 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 2

# YAML doesn't support hard tabs
# Templates that will be weird with hard tabs in the website editor
[*.{yml,yaml,md}]
indent_style = space
indent_size = 2

# Force python to be as python demands
[*.{py,ipynb}]
indent_size = 4
indent_style = space

[{**.*sh}]
indent_size = 2
indent_style = tab

shell_variant = bash
binary_next_line = false # like -bn
switch_case_indent = true # like -ci
space_redirects = true # like -sr
keep_padding = false # like -kp
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
130 changes: 130 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
[flake8]
extend-ignore =
# Allow function call as argument default
B008,
# Do not enforce trailing comma (lets Black decide what is best)
C812,C813,C814,C815,C816,C818,C819,
# Don't ask for docstring at top of module --- put it in the functions/classes
D100,
# Do not check for docstring within __init__ method
D107,
# Ignore whitespace before ';'
E203,
# Don't ask about line length, Black recommends using bugbear B950 instead
E501,
# Stop finding commented out code because it's mistaking shape annotations for code
E800,
# Let pre-commit complain about sorting
I,
# Don't complain about asserts
S101,
# Stop complaining about using functions from random
S311,
# Ignore errors for internal mypy traceback, stderr output, or an unmatched line.
T499,
# Do not complain about line-break before binary operator (caused by Black)
W503,
# Do not warn on too many imports.
WPS201,
# Do not warn on too many module members
WPS202,
# Do not warn when too many arguments in functions
WPS211,
# Do not warn on too many methods
WPS214,
# Allow lots of importing from the same module --- it can happen and thats okay!
WPS235,
# Do not warn on complex f-string
WPS237,
# Allow relative module references
WPS300,
# Allow f-strings
WPS305,
# Do not force base classes to inherit object
WPS306,
# Allow return statement that simply returns a prior statement
WPS331,
# Allow new lines to start with a dot (caused by Black)
WPS348,
# Allow logic in __init__ modules
WPS412,
# Google Python style is not RST until after processed by Napoleon
# See https://github.com/peterjc/flake8-rst-docstrings/issues/17
RST201,RST203,RST301,
# It happens too often
C416, C419,
# This is new and cba to change the repo
S113
extend-select =
# Should raise AssertionError instead of assert False
B011,
# Use of break, continue or return in finally blocks will silence exceptions.
B012,
# Redundant exception types in except
B014,
# Pointless comparisons
B015,
# Cannot raise a literal
B016,
# Do not use `self.assertRaises(Exception)`
B017,
# Find useless expressions
B018,
# Use namedtuple instead of dataclass when only `__init__` attributes are set
B903,
# Within an except clause, raise exceptions with `raise ... from err` or `raise ...
# from None` to distinguish them from errors in exception handling
B904,
# Counterpart to W503, enforce having the operator at the start of a new line.
W504,

max-line-length = 99
max-complexity = 18
max-methods = 10
max-line-complexity = 18
max-local-variables = 20
max-expressions = 20
max-function-expressions = 10
max-module-expressions = 20
max-string-usages = 10
max-annotation-complexity = 4
min-name-length = 1
max-try-body-length = 2
exps-for-one-empty-line = 1
show-violation-links = true
format = wemake

# Black enforces double quotes.
inline-quotes = double

docstring-convention = google

# Darglint
docstring_style = google
strictness = long

nested-classes-whitelist =
Meta
Params
Config

allowed-domain-names =
data
utils
util
obj
params

per-file-ignores =
src/*/_version.py:WPS410
src/**/__init__.py:D,F401,WPS436
tests/*:D,F401,WPS118,WPS202,WPS204,WPS214,WPS218,WPS226,WPS231,WPS232,WPS235,WPS301,WPS432,WPS437,WPS442,S101
scripts/update_torch_cuda.py:S404,S603,S607,WPS323,WPS333,WPS432,WPS433,WPS459

extend-exclude=
.venv/,
*_cache/,
.cache/,
logs/,
storage/,
docs/
90 changes: 90 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
# Labels names are important as they are used by Release Drafter to decide
# regarding where to record them in changelog or if to skip them.
#
# The repository labels will be automatically configured using this file and
# the GitHub Action https://github.com/marketplace/actions/github-labeler.
## more info https://github.com/crazy-max/ghaction-github-labeler

# ------------------------- Conventional Commit types ------------------------ #
# From https://github.com/commitizen/conventional-commit-types/blob/master/index.json

- name: feature
description: A new enhancement or feature
color: 0A8844
from_name: "enhancement"

- name: fix
description: A bug fix
color: d23832
from_name: "bug"

- name: documentation
description: Documentation changes only
color: F695C4

- name: style
description: Changes that do not affect meaning of code (formatting, etc.)
color: FBCA0C

- name: refactor
description: Code change that neither fixes a bug nor adds a feature
color: FBCA0C
from_name: refactoring

- name: performance
description: Code change that improves performance
color: F2A33C

- name: test
description: Adding missing tests or correcting existing tests
color: EE328E

- name: build
description: Changes that affect the build system or external dependencies
color: 962EDD

- name: continuous integration
description: Changes to CI configuration and scripts
color: FCBFE3

- name: chore
description: Other changes that don't modify src or test files
color: A8D8F0

- name: revert
description: Revert a previous commit
color: A8D8F0

- name: backwards incompatible
description: incompatible changes to how the application works
color: AB2232

- name: question
description: Further information is requested
color: EE328E

# ------------------------------- Dependencies ------------------------------- #
- name: dependencies
description: Pull requests that update dependencies
color: 0366d6

# ------------------------------ Utility labels ------------------------------ #
- name: automerge
color: "ffffff"
description: "Automerge this PR"

- name: "stale"
color: "ffffff"
description: ""
# - name: duplicate
# description: This issue or pull request already exists
# color: ffffff

# - name: invalid
# description: This doesn't seem right
# color: ffffff

# - name: wontfix
# description: This will not be worked on
# color: ffffff
68 changes: 68 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build and push images

on:
workflow_call:
workflow_dispatch:
release:
types: [published]

env:
PYTHON_VERSION: 3.9
REGISTRY: ghcr.io
BASE_IMAGE: emma-heriot-watt/base:latest
BUILDER_IMAGE: emma-heriot-watt/builder:latest
REPOSITORY: emma-heriot-watt/policy

jobs:
build_image:
name: Build and push image
runs-on: ubuntu-latest
strategy:
matrix:
torch_version_suffix: ["", "+cu113"]

permissions:
contents: read
packages: write

steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Define image suffix
id: image-tag
env:
TORCH_VERSION_SUFFIX: ${{ matrix.torch_version_suffix }}
run: |
if [ -z "$TORCH_VERSION_SUFFIX" ]; then
TORCH_VERSION_SUFFIX="+cpu"
fi
IMAGE_TAG=$(echo "$TORCH_VERSION_SUFFIX" | tr -d "+")
echo "tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}
tags: |
${{ steps.image-tag.outputs.tag }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.BASE_IMAGE }}
BUILDER_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.BUILDER_IMAGE }}
TORCH_VERSION_SUFFIX=${{ matrix.torch_version_suffix }}
Loading

0 comments on commit 03539cc

Please sign in to comment.