-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add quil-plotting module #412
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
[project] | ||
name = "quil-plotting" | ||
version = "0.1.0" | ||
requires-python = ">=3.8" | ||
description = "A Python package for visualizing Quil programs." | ||
documentation = "https://rigetti.github.io/quil-rs/quil.html" | ||
readme = "README.md" | ||
license = { text = "Apache-2.0" } | ||
authors = [{ name = "Rigetti Computing", email = "softapps@rigetti.com" }] | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Operating System :: OS Independent", | ||
] | ||
dependencies = [ | ||
"numpy>=1.2.1", | ||
"plotly>=5.11", | ||
"kaleido==0.2.1", | ||
"pandas>=2.0" | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"ruff>=0.3.7", | ||
"maturin>=1.2.3", | ||
"mypy>=1.1.1", | ||
"pytest>=7.2.2", | ||
"pdoc>=14.1.0", | ||
"syrupy>=3.0.6" | ||
] | ||
|
||
# [build-system] | ||
# requires = ["setuptools>=61.0"] | ||
# build-backend = "setuptools.build_meta" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.ruff] | ||
exclude = [ | ||
".bzr", | ||
".direnv", | ||
".eggs", | ||
".git", | ||
".git-rewrite", | ||
".hg", | ||
".ipynb_checkpoints", | ||
".mypy_cache", | ||
".nox", | ||
".pants.d", | ||
".pyenv", | ||
".pytest_cache", | ||
".pytype", | ||
".ruff_cache", | ||
".svn", | ||
".tox", | ||
".venv", | ||
".vscode", | ||
"__pypackages__", | ||
"_build", | ||
"buck-out", | ||
"build", | ||
"dist", | ||
"node_modules", | ||
"site-packages", | ||
"venv", | ||
] | ||
line-length = 120 | ||
indent-width = 4 | ||
target-version = "py38" | ||
|
||
[tool.ruff.lint] | ||
select = ["D", "E4", "E7", "E9", "F", "I", "B", "S", "W"] | ||
ignore = [ | ||
"E741" # "Ambiguous" variable names like "I" aren't ambiguous in this contex. | ||
] | ||
fixable = ["ALL"] | ||
unfixable = [] | ||
# Allow unused variables when underscore-prefixed. | ||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
"quil/**/*.py" = [ | ||
"F403", # * imports allowed in extension module glue. | ||
"D100", # docstrings belong in type stubs | ||
"D104", | ||
] | ||
"test/**/*.py" = [ | ||
"D", # docstrings are not enforced in tests | ||
"S101", # asserts are allowed in tests | ||
"S301", # we need to test pickling | ||
] | ||
"make_docs.py" = [ "D" ] | ||
|
||
[tool.ruff.format] | ||
quote-style = "double" | ||
indent-style = "space" | ||
skip-magic-trailing-comma = false | ||
line-ending = "auto" | ||
|
||
[tool.ruff.lint.pydocstyle] | ||
convention = "google" | ||
|
||
[tool.pyright] | ||
# This diagnostic is raised when a type stub is found without a corresponding source file. This is | ||
# necessarily the case for a pure Rust pyo3 module, so disabling it. | ||
reportMissingModuleSource = false | ||
|
||
[tool.mypy] | ||
plugins = "numpy.typing.mypy_plugin" | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ | ||
"quil.quil", | ||
] | ||
ignore_missing_imports = true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
[project] | ||
name = "quil-plotting" | ||
version = "0.1.0" | ||
requires-python = ">=3.8" | ||
description = "A Python package for visualizing Quil programs." | ||
documentation = "https://rigetti.github.io/quil-rs/quil.html" | ||
readme = "README.md" | ||
license = { text = "Apache-2.0" } | ||
authors = [{ name = "Rigetti Computing", email = "softapps@rigetti.com" }] | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Operating System :: OS Independent", | ||
] | ||
dependencies = [ | ||
"numpy>=1.2.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the mistaken version of numpy, should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup |
||
"plotly>=5.11", | ||
"kaleido==0.2.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary to pin this at 0.2.1? Or can it have a floor of |
||
"pandas>=2.0" | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"ruff>=0.3.7", | ||
"maturin>=1.2.3", | ||
"mypy>=1.1.1", | ||
"pytest>=7.2.2", | ||
"pdoc>=14.1.0", | ||
"syrupy>=3.0.6" | ||
] | ||
|
||
# [build-system] | ||
# requires = ["setuptools>=61.0"] | ||
# build-backend = "setuptools.build_meta" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm good with using |
||
|
||
[tool.ruff] | ||
exclude = [ | ||
".bzr", | ||
".direnv", | ||
".eggs", | ||
".git", | ||
".git-rewrite", | ||
".hg", | ||
".ipynb_checkpoints", | ||
".mypy_cache", | ||
".nox", | ||
".pants.d", | ||
".pyenv", | ||
".pytest_cache", | ||
".pytype", | ||
".ruff_cache", | ||
".svn", | ||
".tox", | ||
".venv", | ||
".vscode", | ||
"__pypackages__", | ||
"_build", | ||
"buck-out", | ||
"build", | ||
"dist", | ||
"node_modules", | ||
"site-packages", | ||
"venv", | ||
] | ||
line-length = 120 | ||
indent-width = 4 | ||
target-version = "py38" | ||
|
||
[tool.ruff.lint] | ||
select = ["D", "E4", "E7", "E9", "F", "I", "B", "S", "W"] | ||
ignore = [ | ||
"E741" # "Ambiguous" variable names like "I" aren't ambiguous in this contex. | ||
] | ||
fixable = ["ALL"] | ||
unfixable = [] | ||
# Allow unused variables when underscore-prefixed. | ||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These per-file-ignores should be updated to reflect the structure of the package, or deleted. |
||
"quil/**/*.py" = [ | ||
"F403", # * imports allowed in extension module glue. | ||
"D100", # docstrings belong in type stubs | ||
"D104", | ||
] | ||
"test/**/*.py" = [ | ||
"D", # docstrings are not enforced in tests | ||
"S101", # asserts are allowed in tests | ||
"S301", # we need to test pickling | ||
] | ||
"make_docs.py" = [ "D" ] | ||
|
||
[tool.ruff.format] | ||
quote-style = "double" | ||
indent-style = "space" | ||
skip-magic-trailing-comma = false | ||
line-ending = "auto" | ||
|
||
[tool.ruff.lint.pydocstyle] | ||
convention = "google" | ||
|
||
[tool.pyright] | ||
# This diagnostic is raised when a type stub is found without a corresponding source file. This is | ||
# necessarily the case for a pure Rust pyo3 module, so disabling it. | ||
reportMissingModuleSource = false | ||
|
||
[tool.mypy] | ||
plugins = "numpy.typing.mypy_plugin" | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ | ||
"quil.quil", | ||
] | ||
ignore_missing_imports = true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""quil_plotting module | ||
-------------------- | ||
This module provides plotting utilties for quil programs. | ||
|
||
It's organized into two files. `dataframe.py` provides functions to construct a | ||
dataframe of IQ values from a quil program. It further contains a function to | ||
add visualization metadata to the dataframe such as color, and y-values. The dataframe | ||
is intended to be a format that is easy to plot for multiple backends. | ||
|
||
`plot.py` provides a reference implementation of schedule visualization using the plotly | ||
library. The figures are interactive and can be exported as pngs or svgs. | ||
""" | ||
|
||
from .dataframe import add_plot_metadata, program_to_dataframe | ||
from .plot import plot_schedule, plot_schedule_dataframe | ||
|
||
__all__ = ["plot_schedule", "plot_schedule_dataframe", "program_to_dataframe", "add_plot_metadata"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a README