Skip to content

Commit

Permalink
Merge pull request #64 from CQCL/develop
Browse files Browse the repository at this point in the history
Check formatting
  • Loading branch information
SamDuffield authored Feb 1, 2023
2 parents 2dc1668 + a06f347 commit 22c605c
Show file tree
Hide file tree
Showing 18 changed files with 854 additions and 487 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
33 changes: 33 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Lint python projects

on:
pull_request:
branches:
- main
- develop
push:
branches:
- main
- develop

jobs:
lint:

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Update pip
run: pip install --upgrade pip
- name: Install black and pylint
run: pip install black pylint
- name: Check files are formatted with black
run: |
black --check .
- name: Run pylint
run: |
pylint */
53 changes: 53 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[MASTER]
output-format=colorized
disable=all
enable=
anomalous-backslash-in-string,
assert-on-tuple,
bad-indentation,
bad-option-value,
bad-reversed-sequence,
bad-super-call,
consider-merging-isinstance,
continue-in-finally,
dangerous-default-value,
duplicate-argument-name,
expression-not-assigned,
function-redefined,
inconsistent-mro,
init-is-generator,
line-too-long,
lost-exception,
missing-kwoa,
mixed-line-endings,
not-callable,
no-value-for-parameter,
nonexistent-operator,
not-in-loop,
pointless-statement,
redefined-builtin,
return-arg-in-generator,
return-in-init,
return-outside-function,
simplifiable-if-statement,
syntax-error,
too-many-function-args,
trailing-whitespace,
undefined-variable,
unexpected-keyword-arg,
unhashable-dict-key,
unnecessary-pass,
unreachable,
unrecognized-inline-option,
unused-import,
unnecessary-semicolon,
unused-variable,
unused-wildcard-import,
wildcard-import,
wrong-import-order,
wrong-import-position,
yield-outside-function


# Ignore long lines containing URLs or pylint.
ignore-long-lines=^(.*#\w*pylint: disable.*|\s*(# )?<?https?://\S+>?)$
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ Pull requests are welcomed!
2. Add your code.
3. Add your tests.
4. Update the documentation if required.
5. Issue a pull request into [`develop`](https://github.com/CQCL/qujax/tree/develop).
5. Check the code lints (run `black . --check` and `pylint */`)
6. Issue a pull request into [`develop`](https://github.com/CQCL/qujax/tree/develop).

New commits on [`develop`](https://github.com/CQCL/qujax/tree/develop) will then be merged into
[`main`](https://github.com/CQCL/qujax/tree/main) on the next release.
Expand Down
32 changes: 18 additions & 14 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
import os
import sys

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath("..")) # pylint: disable=wrong-import-position

from qujax.version import __version__

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'qujax'
copyright = '2022, Sam Duffield'
author = 'Sam Duffield'
project = "qujax"
project_copyright = "2022, Sam Duffield"
author = "Sam Duffield"
version = __version__
release = __version__

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['sphinx.ext.autodoc', 'sphinx_rtd_theme', 'sphinx.ext.napoleon', 'sphinx.ext.mathjax']
extensions = [
"sphinx.ext.autodoc",
"sphinx_rtd_theme",
"sphinx.ext.napoleon",
"sphinx.ext.mathjax",
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

autodoc_typehints = "description"

html4_writer = True

autodoc_type_aliases = {
'jnp.ndarray': 'ndarray',
'random.PRNGKeyArray': 'jax.random.PRNGKeyArray',
'UnionCallableOptionalArray': 'Union[Callable[[ndarray, Optional[ndarray]], ndarray], '
'Callable[[Optional[ndarray]], ndarray]]'

"jnp.ndarray": "ndarray",
"random.PRNGKeyArray": "jax.random.PRNGKeyArray",
"UnionCallableOptionalArray": "Union[Callable[[ndarray, Optional[ndarray]], ndarray], "
"Callable[[Optional[ndarray]], ndarray]]",
}

latex_engine = 'pdflatex'
latex_engine = "pdflatex"
7 changes: 6 additions & 1 deletion qujax/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
Simulating quantum circuits with JAX
"""


from qujax.version import __version__

from qujax import gates
Expand Down Expand Up @@ -32,10 +37,10 @@
from qujax.utils import sample_bitstrings
from qujax.utils import statetensor_to_densitytensor

# pylint: disable=undefined-variable
del version
del statetensor
del statetensor_observable
del densitytensor
del densitytensor_observable
del utils

Loading

0 comments on commit 22c605c

Please sign in to comment.