Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2025 The TensorFlow Quantum 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.
# ============================================================================

# Summary: configure clang-format for this project's style guidelines.
# This should be kept in sync with TensorFlow's .clang-format.

BasedOnStyle: Google
DerivePointerAlignment: false
23 changes: 8 additions & 15 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,15 @@
# 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.

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Common editor configurations for this project.
#
# EditorConfig is a file format for specifying some common style parameters.
# Many IDEs & editors read .editorconfig files, either natively or via plugins.
# We mostly follow Google's style guides (https://google.github.io/styleguide/)
# with only a few deviations for line length and indentation in some files.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ============================================================================

root = true

# IMPORTANT: some of the other config files (.markdownlintrc, .jsonlintrc.yaml,
# etc.) also have settings for indent and line length. When making changes to
# this file, make sure to update the other files to match.
# We follow the TensorFlow coding style
# https://www.tensorflow.org/community/contribute/code_style

# IMPORTANT: some of the other config files (.clang-format, etc.) also have
# the same settings and need to be updated if changes are made to this file.
[*]
charset = utf-8
indent_style = space
Expand All @@ -35,7 +28,7 @@ spelling_language = en-US
trim_trailing_whitespace = true
max_line_length = 80

[{BUILD,*.BUILD,*.bzl,*.bazel,.bazelrc}]
[{BUILD,*.BUILD,*.bzl,*.bazel,.bazelrc,WORKSPACE}]
indent_size = 4

[{*.cc,*.h}]
Expand All @@ -48,7 +41,7 @@ indent_size = 2
indent_size = 4

[*.sh]
indent_size = 4
indent_size = 2

[*.yml,*.yaml]
[{*.yaml,*.yml,*.cff}]
indent_size = 2
9 changes: 9 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Usage: run the following command to configure git to use this file:
#
# git config blame.ignoreRevsFile .git-blame-ignore-revs
#
# Summary: `git-blame` can be instructed to ignore certain commits. This is
# useful to do for commits that only involve large refactoring and reformatting
# operations. The format of this file is one full 40-character commit hash
# (SHA-1) per line. Blank lines and comments (such as this) are allowed.
# ==============================================================================
24 changes: 24 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2025 The TensorFlow Quantum 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.
# ============================================================================

# Include Markdown files in GitHub's file statistics for this repo.
*.md linguist-detectable

# Exclude config files from GitHub's file statistics. Most are YAML files and
# Linguist already treats .yaml files as data, so only add some exceptions.
.clang-format linguist-documentation
.editorconfig linguist-documentation
.markdownlintrc linguist-documentation
.shfmt linguist-documentation
26 changes: 26 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 The TensorFlow Probability 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.
# ============================================================================

# Summary: configure actionlint (https://github.com/rhysd/actionlint) to
# recognize action runner names/labels that we use.

self-hosted-runner:
labels:
# Google self-hosted runners defined in TensorFlow org.
- linux-x86-n2-32

# New from GitHub (late 2025) but currently not known by actionlint.
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners
- ubuntu-slim
25 changes: 23 additions & 2 deletions .github/problem-matchers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,26 @@ This directory contains Problem Matchers used by the GitHub Actions workflows in

The following problem matcher JSON files found in this directory were copied from the [Home Assistant](https://github.com/home-assistant/core) project on GitHub. The Home Assistant project is licensed under the Apache 2.0 open-source license. The version of the files at the time they were copied was 2025.1.2.

- [`pylint.json`](https://github.com/home-assistant/core/blob/dev/.github/workflows/matchers/pylint.json)
- [`yamllint.json`](https://github.com/home-assistant/core/blob/dev/.github/workflows/matchers/yamllint.json)
* [`pylint.json`](https://github.com/home-assistant/core/blob/dev/.github/workflows/matchers/pylint.json)
* [`yamllint.json`](https://github.com/home-assistant/core/blob/dev/.github/workflows/matchers/yamllint.json)

The Pytest problem matcher originally came from the
[gh-problem-matcher-wrap](https://github.com/liskin/gh-problem-matcher-wrap/tree/master/problem-matchers)
repository (copied 2025-03-04, version 3.0.0), and was subsequently modified by
Michael Hucka. The original JSON file is Copyright © 2020 Tomáš Janoušek and
made available under the terms of the MIT license.

* [`pytest.json`](https://github.com/liskin/gh-problem-matcher-wrap/blob/master/problem-matchers/pytest.json)

The following problem matcher for gcc came from the [Microsoft
vscode-cpptools](https://github.com/microsoft/vscode-cpptools) repository as it appeared on
2025-12-04. The last commit was by user michelleangela on 2020-01-09. The file is licensed under the
MIT license.

* [`gcc.json`](https://github.com/microsoft/vscode-cpptools/blob/acdd5ca9d21cb1dda535594bee461beb9e8a5f06/Extension/package.json)

The following problem matcher for yapf came from the [Google
SCAAML](https://github.com/google/scaaml) repository as it appeared on 2025-12-08. The last commit
was by user jmichelp on 2022-07-03. The file is licensed under the Apache 2.0 license.

* [`yapf.json`](https://github.com/google/scaaml/blob/6d9c3a42c527212ef77f2877419dd8f6e77eb442/.github/python_matcher.json)
17 changes: 17 additions & 0 deletions .github/problem-matchers/gcc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "gcc",
"pattern": [
{
"regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
}
16 changes: 16 additions & 0 deletions .github/problem-matchers/pytest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"problemMatcher": [
{
"owner": "pytest",
"severity": "error",
"pattern": [
{
"regexp": "^(\\S+):(\\d+): (.*)$",
"file": 1,
"line": 2,
"message": 3
}
]
}
]
}
22 changes: 22 additions & 0 deletions .github/problem-matchers/yapf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"problemMatcher": [
{
"owner": "yapf-diff",
"pattern": [
{
"regexp": "^---\\s*([^\\s]*)\\s*\\(original\\)$",
"file": 1
},
{
"regexp": "^\\+\\+\\+\\s*([^\\s]*)\\s*\\((.*)\\)$",
"message": 2
},
{
"regexp": "^@@\\s*-(\\d+),(\\d+)\\s*\\+(\\d+),(\\d+)\\s*@@$",
"line": 1
}
]
},
}
]
}
159 changes: 159 additions & 0 deletions .markdownlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{ // -*- jsonc -*-
//
// Copyright 2025 Google LLC
//
// 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.

// IMPORTANT: if you change values here, update .editorconfig to match.

// These settings try to stay close to the Google Markdown Style as
// described at https://google.github.io/styleguide/docguide/style.html
// with very few differences.

// Note: there are multiple programs programs named "markdownlint". We use
// https://github.com/igorshubovych/markdownlint-cli/, which is the one you
// get with "brew install markdownlint" on MacOS.
//
// For a list of possible configuration options, see the following page:
// https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
// (Beware that the above looks similar but is NOT the same as the page
// https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md.)

"$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json",

// Require ATX-style headings.
// https://google.github.io/styleguide/docguide/style.html#atx-style-headings
"headings": {
"style": "atx"
},

// Google style does not require that the first line of a file is a heading
// for the title; it only states that the first heading should be a level 1.
// https://google.github.io/styleguide/docguide/style.html#document-layout
"first-line-heading": false,

// The Google style does not define what to do about trailing punctuation in
// headings. The markdownlint default disallows exclamation points, which
// seems likely to be more annoying than useful – I have definitely seen
// people use exclamation points in headings in README files on GitHub.
// This setting removes exclamation point from the banned characters.
"no-trailing-punctuation": {
"punctuation": ".,;:。,;:"
},

// No trailing spaces.
// https://google.github.io/styleguide/docguide/style.html#trailing-whitespace
"whitespace": {
"br_spaces": 0
},

// Google style is 80 characters.
// Google style exempts some constructs from the line-length limit:
// https://google.github.io/styleguide/docguide/style.html#exceptions
"line-length": {
"line_length": 80,
"code_block_line_length": 80,
"heading_line_length": 80,
"code_blocks": false,
"headings": false,
"tables": false
},

// Google Markdown style specifies 2 spaces after item numbers, 3 spaces
// after bullets, so that the text itself is consistently indented 4 spaces.
// https://google.github.io/styleguide/docguide/style.html#nested-list-spacing
"list-marker-space": {
"ol_multi": 2,
"ol_single": 2,
"ul_multi": 3,
"ul_single": 3
},

"ul-indent": {
"indent": 4
},

// Bare URLs are allowed in GitHub-flavored Markdown and in Google’s style.
"no-bare-urls": false,

// Basic Markdown allows raw HTML. Both GitHub & PyPI support subsets of
// HTML, though it's unclear what subset PyPI supports. Google's style guide
// recommends against using raw HTML, but does allow it. (C.f. the bottom of
// https://google.github.io/styleguide/docguide/style.html) Google's in-house
// documentation system allows many inline and block-level tags, but strips
// others that can pose security risks (e.g., <object> and standalone <svg>).
// The list below tries to capture the intersection of what GitHub allows
// (c.f. https://github.com/github/markup/issues/245#issuecomment-682231577),
// what PyPI seems to allow, what Google allows, and what seems likely to be
// most useful in situations where someone needs to reach for HTML.
"html": {
"allowed_elements": [
"a",
"abbr",
"b",
"blockquote",
"br",
"caption",
"cite",
"code",
"dd",
"del",
"details",
"dfn",
"div",
"dl",
"dt",
"em",
"figcaption",
"figure",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"hr",
"i",
"img",
"ins",
"kbd",
"li",
"mark",
"ol",
"p",
"picture",
"pre",
"q",
"s",
"samp",
"small",
"span",
"strong",
"sub",
"summary",
"sup",
"table",
"tbody",
"td",
"tfoot",
"th",
"thead",
"time",
"tr",
"tt",
"ul",
"var",
"wbr"
]
}
}
15 changes: 15 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Copyright 2020 The TensorFlow Probability 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.
# ============================================================================

# Summary: TFQ config file for Pylint versions 3.0 and above.
# See https://pylint.readthedocs.io/ for info about options available.

Expand Down
Loading
Loading