-
Notifications
You must be signed in to change notification settings - Fork 24
docs: improve the API docs #209
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
Conversation
|
Thank you for your pull request! We require contributors to sign our Contributor License Agreement, and we don"t have one on file for you. In order for us to review and merge your code, please contact mstechly@psiquantum.com to get yourself added. (CLA has not been signed by @AVDiv) |
…irection` on docstring
mstechly
left a comment
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.
Amazing job!
I left some minor comments, but I hope these will be quick fixes :)
About the investigation of docs of the symbolics module, the problem is that the docs/concepts/symbolics.md file for symbolics is empty. So, I didn't make any changes to the file at the moment.
This is not the issue. I'm talking about the autogenerated section for the bartiq.symbolics module, which is empty, while other modules, e.g.: bartiq.errors are not, even though we never explicitly say "please render bartiq.errors in the docs".

|
As per CLA – I know you've signed, I added you to the CLA-bot config. |
|
@pqvr could you please take a look at why the lint job doesn't approve this? |
Yes, it seems that the conventional commit linter didn't like the capital letter in the word following the to The linter is quite pedantic in this way, and we could change the rule to be case-insensitive, but that may be a discussion for another time. In any case, this is now unblocked. |
pqvr
left a comment
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.
Looks like there might be some other docstrings to consider altering. Tagging @mstechly to see if these are sensible and within scope of the MR to alter/include:
-
Missing arguments in the docstring:
bartiq/src/bartiq/transform.py
Line 172 in adff76e
Args: -
Missing
backendargument:
bartiq/src/bartiq/transform.py
Line 154 in adff76e
aggregation_dict: The input aggregation dictionary. -
Should we clarify the return type here as an
AggregationDictinstead?
bartiq/src/bartiq/transform.py
Line 156 in adff76e
Dict[str, Dict[str, Any]]: The expanded aggregation dictionary. -
Should we use a link to
bartiq.CompiledRoutinehere?
bartiq/src/bartiq/transform.py
Line 80 in adff76e
"""Add aggregated resources to bartiq routine based on the aggregation dictionary. -
This returns a
CompiledRoutinewhich is distinct from aRoutine:
bartiq/src/bartiq/transform.py
Line 98 in adff76e
Routine: The program with aggregated resources. -
Is it possible for us to type-hint the argument and return type here?
bartiq/src/bartiq/transform.py
Line 45 in adff76e
def postorder_transform(transform): -
Missing "Returns" in docstring:
def aggregate_resources( -
Link to bartiq.Routine:
A routine with all the additive resources defined appropriately at all levels of the hierarchy. -
Link to bartiq.Routine:
A routine with the missing links added. -
Link to bartiq.Routine in both Args and Returns:
Args:
mstechly
left a comment
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.
Just one minor thing to fix (+ I see some style checks not passing) and it's good to go :)
|
@AVDiv Also it seems that in order to claim bounty, you need to leave a comment in the original issue |
… removed type hints for `postorder_transform`
…added submodule rendering and extra styling for documentation
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.
I left one comment.
I'll just discuss with the team whether the css is fine or if we want to change sth in the look, but these would be most likely small changes just in the css file.
src/bartiq/transform.py
Outdated
|
|
||
| @overload | ||
| def postorder_transform(transform: RoutineTransform[T, P]) -> RoutineTransform[T, P]: | ||
| """Transform a hierarchical routine graph in postorder fashion. |
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.
I think we don't want to have docstring for each overload.
- I don't think this affects what's displayed in the docs.
- This leads to unnecessary duplication, and sooner or later these docstrings will get out of sync in a confusing way.
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.
Ohh yeah, that's right. I'll get rid of that.
Ok, team likes it! |
|
Amazing, thank you so much! |
|
It was nice to work with you guys. If I'd ever get a chance to work with you guys, I'd take it again. Thank you! 😄 |
|
Done with the update, guess it's good to go then. |
* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs
* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs
…lass (#205) * chore: Added a comment about allow_transitive_resources to tutorial #1 * chore: added allow_transitive_resources=False; added quotes to Note about interactive tools * chore: updated tutorial 3 * chore: Added sentences about transitive compilation of resources * refactor: Created `CompilationFlags` enum * refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources * refactor: Added CompilationFlags to init * chore: Updated docstrings * chore: updating tests for CompilationFlags * chore: Modified tests to catch edge case errors (previously assertions) * refactor: Changed assertions into Exceptions * bugfix: Changed None -> CompilationsFlags(0) * chore: Updated compilation to discuss transitivity and compilation flags * chore: Updated tutorials with Compilation Flags * refactor: creating analysis submodule. * feat: Began work on sympy manipulator * feat: added instruction types enum; adding functionality to SM * refactor: split base class + sympyManipulator into separate modules * chore: removed generic types * refactor: Moved InstructionsType enum * feat: Added `focus` method. Generic types added * refactor: Renamed SympyManipulation -> SympyManipulator * fix: removed testing code * refactor: renamed analysis.py -> optimization.py * refactor: created analysis module * feat: created rewriters module * feat: added expressionwriter abc * feat: subclassed from expressionwriter * chore: improving typing * feat: Added basic tests for rewriters * chore: improved typing, added docstrings * feat: improved typing; added docstrings * chore: ran isort * chore: fixed typing issues * chore: added module level docstrings * chore: removed unused import * chore: erroneous line introduced * chore: added module level docstring * chore: improved typing in update_expression * chore: added module level docstring; removed return section of docstring and improved descriptions * chore: Type -> type * chore: made expression_rewriter.py public * refactor: renamed variables -> free_symbols * refactor: improved docstrings * chore: correcting imports * refactor: renamed test_variables, and improved it such that it will work for all backends * chore: added copyright message * refactor: renamed free_symbols_in -> free_symbols * chore: updated docstrings * chore: isort fix * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * chore: Added a comment about allow_transitive_resources to tutorial #1 * chore: added allow_transitive_resources=False; added quotes to Note about interactive tools * chore: updated tutorial 3 * chore: Added sentences about transitive compilation of resources * refactor: Created `CompilationFlags` enum * refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources * chore: Updated docstrings * chore: updating tests for CompilationFlags * chore: Modified tests to catch edge case errors (previously assertions) * chore: Updated tutorials with Compilation Flags * refactor: creating analysis submodule. * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * chore: resolving conflicts * chore: free_symbols_in -> free_symbols * chore: free_symbols_in -> free_symbols * Resolving conflicts * began typing fixes * Removed expression getter/setter. Updated typing * Removed commented out code * feat: added treemap visualisation class (#216) * Added GSE prototype * Trialling a decorator function * Added warning if no update applied; added methods to isolate functions and their arguments * Minor fix * Removed userwarning due to bug * Added catch for top level expression * Added better support for parsing assumptions and redefining symbols * Potential bugfix; Symbols now updated correctly * Improved logic parsing * bug fix * Improved detection of nonzero Symbols * Added warning if an expression does not change * defaulting suppress_warnings to true; still experimental * Updated check_expression_update to catch edge cases * bug fix: when parsing known symbols with reference values!=0 * Undoing code removal * Minor change for readaility * more bug fixes * More bug fixes * Hopefully the last bug fix * tbd * tbd * Updated imports after merge * Minor improvements * Added ability to evaluate gnarly * Attempting to fix evaluation bug * bug fix * bug found on substitute * Removed unused import * Added fix to allow substitute to refer to symbols rather than symbol names * Removed unnecessary print statement * Bandaid fix for minor bug * Small fix * fix: proper detection for zero arguments * Upgraded grammar and text in alias-sampling * Only minor changes to the third tutorial * Typo fix. * Added visualisations module; needs depth parameter. * scratch notebook * Pausing work; creating issue in bartiq. * feat: visualisation improvement cleanup * feat: visualisation improvement cleanup * feat: create a method that can handle dataframe with redundant names * test: test the new method * chore: linting * chore: include pandas and plotly in dependencies * Update src/bartiq/visualisations.py Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: file removal and renaming from review * feat: added is_numeric method and visualization input validation check logic * test: added compiled routine is_numeric tests and input validation for visualization * chore: remove scale_to * chore: delete changes to sympy backend * chore: private function instead of classmethod * chore: reset advanced example * chore: validation checking invalid resource to plot * chore: avoid duplication of strings when calling px.treemap * test: output data frame is as expected * test: test plot output type * chore: adjust docstring and test function signatures * chore: linting * chore: linting * chore: address review comments * chore: address review comment --------- Co-authored-by: brendan reid <brendan.reid1991@gmail.com> Co-authored-by: Brendan Reid <breid@psiquantum.com> Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * Removed reference to ._expr * improved typing * Modifying Basic -> Expr as generic type. * Modified fixture * improved typing * Moved expand test to be sympy specific * changed fixture scope from 'class' to 'function' * renamed as_individual_terms - > individual_terms * Renamed property; ran isort * renamed as_individual_terms -> individual_terms * typo fix * Removed fixtures from tests and restructured them * chore: update poetry.lock file for dependabot (#227) * chore: update poetry.lock file for dependabot * chore: update lock file * chore: remove h11 as transient dependency * chore: update poetry lock * refactor: made pandas and plotly optional installs (#226) * refactor: made pandas and plotly optional installs * Added checks to ensure tests do not fail unexpectedly * ran isort * Added .venv to .gitignore * Addition of pandas stubs changed behaviour of scipy stubs; quick fix * renamed visualization->interactive * updated extras flag * renamed vis->viz * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * added plotly-stubs; may revert * Removed type: ignore * removed type: ignore; updated error message * fixing plotly-stubs install * Removed plotly-stubs entirely. * added pytest.importorskip to module * Added noqa to pass flake8 * Ran isort * isort versioning mismatch * Streamlined some aspects of the TreeMap class; removed unnecessary checks * Removing unused imports * fix: Fix typing in analysis module --------- Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com> * updated substitute function to account for symbols with assumptions on them * attempting to consolidate the typing * Added sequence of commands as a test * removing unused import * Updating typing * Implementing Konrads changes * remove trailing whitespace * added return statement * minor changes to typing * removing sequence of commands test * fixing linting; temporary fix --------- Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com> Co-authored-by: antalszava <antalszava@gmail.com> Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
* chore: Added a comment about allow_transitive_resources to tutorial #1 * chore: added allow_transitive_resources=False; added quotes to Note about interactive tools * chore: updated tutorial 3 * chore: Added sentences about transitive compilation of resources * refactor: Created `CompilationFlags` enum * refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources * refactor: Added CompilationFlags to init * chore: Updated docstrings * chore: updating tests for CompilationFlags * chore: Modified tests to catch edge case errors (previously assertions) * refactor: Changed assertions into Exceptions * bugfix: Changed None -> CompilationsFlags(0) * chore: Updated compilation to discuss transitivity and compilation flags * chore: Updated tutorials with Compilation Flags * refactor: creating analysis submodule. * feat: Began work on sympy manipulator * feat: added instruction types enum; adding functionality to SM * refactor: split base class + sympyManipulator into separate modules * chore: removed generic types * refactor: Moved InstructionsType enum * feat: Added `focus` method. Generic types added * refactor: Renamed SympyManipulation -> SympyManipulator * fix: removed testing code * refactor: renamed analysis.py -> optimization.py * refactor: created analysis module * feat: created rewriters module * feat: added expressionwriter abc * feat: subclassed from expressionwriter * chore: improving typing * feat: Added basic tests for rewriters * chore: improved typing, added docstrings * feat: improved typing; added docstrings * chore: ran isort * chore: fixed typing issues * chore: added module level docstrings * chore: removed unused import * chore: erroneous line introduced * chore: added module level docstring * chore: improved typing in update_expression * chore: added module level docstring; removed return section of docstring and improved descriptions * chore: Type -> type * chore: made expression_rewriter.py public * refactor: renamed variables -> free_symbols * refactor: improved docstrings * chore: correcting imports * refactor: renamed test_variables, and improved it such that it will work for all backends * chore: added copyright message * refactor: renamed free_symbols_in -> free_symbols * chore: updated docstrings * chore: isort fix * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * feat: began development on assumptions * chore: Added a comment about allow_transitive_resources to tutorial #1 * chore: added allow_transitive_resources=False; added quotes to Note about interactive tools * chore: updated tutorial 3 * chore: Added sentences about transitive compilation of resources * refactor: Created `CompilationFlags` enum * refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources * chore: Updated docstrings * chore: updating tests for CompilationFlags * chore: Modified tests to catch edge case errors (previously assertions) * chore: Updated tutorials with Compilation Flags * refactor: creating analysis submodule. * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * chore: resolving conflicts * chore: free_symbols_in -> free_symbols * chore: free_symbols_in -> free_symbols * Resolving conflicts * Improving assumptions handling * began typing fixes * Removed expression getter/setter. Updated typing * Removed commented out code * feat: added treemap visualisation class (#216) * Added GSE prototype * Trialling a decorator function * Added warning if no update applied; added methods to isolate functions and their arguments * Minor fix * Removed userwarning due to bug * Added catch for top level expression * Added better support for parsing assumptions and redefining symbols * Potential bugfix; Symbols now updated correctly * Improved logic parsing * bug fix * Improved detection of nonzero Symbols * Added warning if an expression does not change * defaulting suppress_warnings to true; still experimental * Updated check_expression_update to catch edge cases * bug fix: when parsing known symbols with reference values!=0 * Undoing code removal * Minor change for readaility * more bug fixes * More bug fixes * Hopefully the last bug fix * tbd * tbd * Updated imports after merge * Minor improvements * Added ability to evaluate gnarly * Attempting to fix evaluation bug * bug fix * bug found on substitute * Removed unused import * Added fix to allow substitute to refer to symbols rather than symbol names * Removed unnecessary print statement * Bandaid fix for minor bug * Small fix * fix: proper detection for zero arguments * Upgraded grammar and text in alias-sampling * Only minor changes to the third tutorial * Typo fix. * Added visualisations module; needs depth parameter. * scratch notebook * Pausing work; creating issue in bartiq. * feat: visualisation improvement cleanup * feat: visualisation improvement cleanup * feat: create a method that can handle dataframe with redundant names * test: test the new method * chore: linting * chore: include pandas and plotly in dependencies * Update src/bartiq/visualisations.py Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: file removal and renaming from review * feat: added is_numeric method and visualization input validation check logic * test: added compiled routine is_numeric tests and input validation for visualization * chore: remove scale_to * chore: delete changes to sympy backend * chore: private function instead of classmethod * chore: reset advanced example * chore: validation checking invalid resource to plot * chore: avoid duplication of strings when calling px.treemap * test: output data frame is as expected * test: test plot output type * chore: adjust docstring and test function signatures * chore: linting * chore: linting * chore: address review comments * chore: address review comment --------- Co-authored-by: brendan reid <brendan.reid1991@gmail.com> Co-authored-by: Brendan Reid <breid@psiquantum.com> Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * Removed reference to ._expr * improved typing * Modifying Basic -> Expr as generic type. * Modified fixture * improved typing * Moved expand test to be sympy specific * changed fixture scope from 'class' to 'function' * renamed as_individual_terms - > individual_terms * Renamed property; ran isort * renamed as_individual_terms -> individual_terms * typo fix * Removed fixtures from tests and restructured them * chore: update poetry.lock file for dependabot (#227) * chore: update poetry.lock file for dependabot * chore: update lock file * chore: remove h11 as transient dependency * chore: update poetry lock * refactor: made pandas and plotly optional installs (#226) * refactor: made pandas and plotly optional installs * Added checks to ensure tests do not fail unexpectedly * ran isort * Added .venv to .gitignore * Addition of pandas stubs changed behaviour of scipy stubs; quick fix * renamed visualization->interactive * updated extras flag * renamed vis->viz * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * added plotly-stubs; may revert * Removed type: ignore * removed type: ignore; updated error message * fixing plotly-stubs install * Removed plotly-stubs entirely. * added pytest.importorskip to module * Added noqa to pass flake8 * Ran isort * isort versioning mismatch * Streamlined some aspects of the TreeMap class; removed unnecessary checks * Removing unused imports * fix: Fix typing in analysis module --------- Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com> * updated substitute function to account for symbols with assumptions on them * attempting to consolidate the typing * Added sequence of commands as a test * removing unused import * Updating typing * Implementing Konrads changes * remove trailing whitespace * added return statement * reimplementing lost changes * Implementing SympyAssumption * made it so child classes of ExpressionRewriters do not need the decorator * moved evaluation check into Assumptions _post_init_ * started assumptions tracking * quick fix for custom max problem * improved docstrings and added comments * added reapply_all_assumptions * formatting * improving properties dict * isort * formatting * began tests * updated properties dict * added tests * formatting * added comment on _add_assumption * deleted test file * fixing mypy issues * fixing mypy issues * fixing import for py3.10 * isort * minor typo fix * added hash to assumptions * added decorator to override custom max * minor refactor after removing custom max * began improving tests * added classmethod to sympy_backend * added classmethod to sympy_backend * added tests for .with_sympy_max * rename Relationals -> Comparators * rename relationship->comparator * minor typo fix * re-adding assumptions after mistaken deletion * changed from using float to literal_eval * added more tests for assumptions * minor fixes * improved typehinting * improved tracking of assumptions * improved tracking of assumptions * streamlined dataclass interactions * deleting test file * bug fixes * change from all caps to snake case * moving some assumptions tests into basic tests * fixing docstring inconsistencies * quick fixes from michals review * Removed classmethod; moved logic to `parse_to_sympy` * modified interpreter to override certain functions * modified rewriter backend def * removed test until we settle on impl * bug fixes, test fixes * deleted unwanted file * mypy fix * added function_overrides to sympyinterpreter * updated sympybackend with new properties * updated rewriter after changes to sympy backend * modified backend after changes to interpreter * removing unnecessary kwargs * improved docstrings * added tests for sympy_backend when using sympy max * rename assume->assumption * fix typing error * test renaming * renaming assumption->assume * typo * another typo * renamed kwarg to assumption --------- Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com> Co-authored-by: antalszava <antalszava@gmail.com> Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
…ory tracking (#237) * chore: Added a comment about allow_transitive_resources to tutorial #1 * chore: added allow_transitive_resources=False; added quotes to Note about interactive tools * chore: updated tutorial 3 * chore: Added sentences about transitive compilation of resources * refactor: Created `CompilationFlags` enum * refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources * refactor: Added CompilationFlags to init * chore: Updated docstrings * chore: updating tests for CompilationFlags * chore: Modified tests to catch edge case errors (previously assertions) * refactor: Changed assertions into Exceptions * bugfix: Changed None -> CompilationsFlags(0) * chore: Updated compilation to discuss transitivity and compilation flags * chore: Updated tutorials with Compilation Flags * refactor: creating analysis submodule. * feat: Began work on sympy manipulator * feat: added instruction types enum; adding functionality to SM * refactor: split base class + sympyManipulator into separate modules * chore: removed generic types * refactor: Moved InstructionsType enum * feat: Added `focus` method. Generic types added * refactor: Renamed SympyManipulation -> SympyManipulator * fix: removed testing code * refactor: renamed analysis.py -> optimization.py * refactor: created analysis module * feat: created rewriters module * feat: added expressionwriter abc * feat: subclassed from expressionwriter * chore: improving typing * feat: Added basic tests for rewriters * chore: improved typing, added docstrings * feat: improved typing; added docstrings * chore: ran isort * chore: fixed typing issues * chore: added module level docstrings * chore: removed unused import * chore: erroneous line introduced * chore: added module level docstring * chore: improved typing in update_expression * chore: added module level docstring; removed return section of docstring and improved descriptions * chore: Type -> type * chore: made expression_rewriter.py public * refactor: renamed variables -> free_symbols * refactor: improved docstrings * chore: correcting imports * refactor: renamed test_variables, and improved it such that it will work for all backends * chore: added copyright message * refactor: renamed free_symbols_in -> free_symbols * chore: updated docstrings * chore: isort fix * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * feat: began development on assumptions * chore: Added a comment about allow_transitive_resources to tutorial #1 * chore: added allow_transitive_resources=False; added quotes to Note about interactive tools * chore: updated tutorial 3 * chore: Added sentences about transitive compilation of resources * refactor: Created `CompilationFlags` enum * refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources * chore: Updated docstrings * chore: updating tests for CompilationFlags * chore: Modified tests to catch edge case errors (previously assertions) * chore: Updated tutorials with Compilation Flags * refactor: creating analysis submodule. * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * chore: resolving conflicts * chore: free_symbols_in -> free_symbols * chore: free_symbols_in -> free_symbols * Resolving conflicts * Improving assumptions handling * began typing fixes * Removed expression getter/setter. Updated typing * Removed commented out code * feat: added treemap visualisation class (#216) * Added GSE prototype * Trialling a decorator function * Added warning if no update applied; added methods to isolate functions and their arguments * Minor fix * Removed userwarning due to bug * Added catch for top level expression * Added better support for parsing assumptions and redefining symbols * Potential bugfix; Symbols now updated correctly * Improved logic parsing * bug fix * Improved detection of nonzero Symbols * Added warning if an expression does not change * defaulting suppress_warnings to true; still experimental * Updated check_expression_update to catch edge cases * bug fix: when parsing known symbols with reference values!=0 * Undoing code removal * Minor change for readaility * more bug fixes * More bug fixes * Hopefully the last bug fix * tbd * tbd * Updated imports after merge * Minor improvements * Added ability to evaluate gnarly * Attempting to fix evaluation bug * bug fix * bug found on substitute * Removed unused import * Added fix to allow substitute to refer to symbols rather than symbol names * Removed unnecessary print statement * Bandaid fix for minor bug * Small fix * fix: proper detection for zero arguments * Upgraded grammar and text in alias-sampling * Only minor changes to the third tutorial * Typo fix. * Added visualisations module; needs depth parameter. * scratch notebook * Pausing work; creating issue in bartiq. * feat: visualisation improvement cleanup * feat: visualisation improvement cleanup * feat: create a method that can handle dataframe with redundant names * test: test the new method * chore: linting * chore: include pandas and plotly in dependencies * Update src/bartiq/visualisations.py Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: file removal and renaming from review * feat: added is_numeric method and visualization input validation check logic * test: added compiled routine is_numeric tests and input validation for visualization * chore: remove scale_to * chore: delete changes to sympy backend * chore: private function instead of classmethod * chore: reset advanced example * chore: validation checking invalid resource to plot * chore: avoid duplication of strings when calling px.treemap * test: output data frame is as expected * test: test plot output type * chore: adjust docstring and test function signatures * chore: linting * chore: linting * chore: address review comments * chore: address review comment --------- Co-authored-by: brendan reid <brendan.reid1991@gmail.com> Co-authored-by: Brendan Reid <breid@psiquantum.com> Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * Removed reference to ._expr * improved typing * Modifying Basic -> Expr as generic type. * Modified fixture * improved typing * Moved expand test to be sympy specific * changed fixture scope from 'class' to 'function' * renamed as_individual_terms - > individual_terms * Renamed property; ran isort * renamed as_individual_terms -> individual_terms * typo fix * Removed fixtures from tests and restructured them * chore: update poetry.lock file for dependabot (#227) * chore: update poetry.lock file for dependabot * chore: update lock file * chore: remove h11 as transient dependency * chore: update poetry lock * refactor: made pandas and plotly optional installs (#226) * refactor: made pandas and plotly optional installs * Added checks to ensure tests do not fail unexpectedly * ran isort * Added .venv to .gitignore * Addition of pandas stubs changed behaviour of scipy stubs; quick fix * renamed visualization->interactive * updated extras flag * renamed vis->viz * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * added plotly-stubs; may revert * Removed type: ignore * removed type: ignore; updated error message * fixing plotly-stubs install * Removed plotly-stubs entirely. * added pytest.importorskip to module * Added noqa to pass flake8 * Ran isort * isort versioning mismatch * Streamlined some aspects of the TreeMap class; removed unnecessary checks * Removing unused imports * fix: Fix typing in analysis module --------- Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com> * updated substitute function to account for symbols with assumptions on them * attempting to consolidate the typing * Added sequence of commands as a test * removing unused import * Updating typing * Implementing Konrads changes * remove trailing whitespace * added return statement * reimplementing lost changes * Implementing SympyAssumption * made it so child classes of ExpressionRewriters do not need the decorator * moved evaluation check into Assumptions _post_init_ * started assumptions tracking * quick fix for custom max problem * improved docstrings and added comments * added reapply_all_assumptions * formatting * improving properties dict * isort * formatting * began tests * updated properties dict * added tests * formatting * added comment on _add_assumption * deleted test file * fixing mypy issues * fixing mypy issues * fixing import for py3.10 * isort * minor typo fix * Added substitution methods * implemented sympy substitutions,including wildcards * modified substitute to allow arbitrary substitutions" * improvements to wildcard subs * fixed final bug in wildcard subs * added hash to assumptions * minor refactor * added decorator to override custom max * minor refactor after removing custom max * began improving tests * added classmethod to sympy_backend * added classmethod to sympy_backend * added tests for .with_sympy_max * rename Relationals -> Comparators * rename relationship->comparator * minor typo fix * re-adding assumptions after mistaken deletion * changed from using float to literal_eval * added more tests for assumptions * minor fixes * mypy fixes * docstring updates;mypy fixes;wildcard improvements * mypy fixes * improved typehinting * improved tracking of assumptions * improved tracking of assumptions * updating evaluate from main * minor fixes * gave _substitute default behaviour * streamlined dataclass interactions * deleting test file * added_named_tuple * bug fixes * change from all caps to snake case * minor refactor * started testing substitutions * moving some assumptions tests into basic tests * updated focus + substitution logic * added tests * fixing docstring inconsistencies * quick fixes from michals review * Removed classmethod; moved logic to `parse_to_sympy` * modified interpreter to override certain functions * modified rewriter backend def * removed test until we settle on impl * bug fixes, test fixes * deleted unwanted file * mypy fix * minor change * refactor * added function_overrides to sympyinterpreter * updated sympybackend with new properties * updated rewriter after changes to sympy backend * modified backend after changes to interpreter * removing unnecessary kwargs * improved docstrings * added tests for sympy_backend when using sympy max * rename assume->assumption * fix typing error * test renaming * refactored into dataclasses * removing tests from downstream branch * added instruction set * renaming assumption->assume * typo * another typo * renamed kwarg to assumption * fixing typing & usability * updated tests to pass * fixing imports * deleted erroneous line * added tests for history tracking * deleted duplicate fn * removed revert_to in favour of undo_previous; renamed show_history; improved docstrings * fixed implementation error in reapply_all_assumptions * fixed implementation error in focus * added original; hardcoded sympy backend to prevent reinstantiation * modified history methods; updated tests * reverting change to sympy_backend --------- Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com> Co-authored-by: antalszava <antalszava@gmail.com> Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
* chore: Updated tutorials with Compilation Flags * refactor: creating analysis submodule. * feat: Began work on sympy manipulator * feat: added instruction types enum; adding functionality to SM * refactor: split base class + sympyManipulator into separate modules * chore: removed generic types * refactor: Moved InstructionsType enum * feat: Added `focus` method. Generic types added * refactor: Renamed SympyManipulation -> SympyManipulator * fix: removed testing code * refactor: renamed analysis.py -> optimization.py * refactor: created analysis module * feat: created rewriters module * feat: added expressionwriter abc * feat: subclassed from expressionwriter * chore: improving typing * feat: Added basic tests for rewriters * chore: improved typing, added docstrings * feat: improved typing; added docstrings * chore: ran isort * chore: fixed typing issues * chore: added module level docstrings * chore: removed unused import * chore: erroneous line introduced * chore: added module level docstring * chore: improved typing in update_expression * chore: added module level docstring; removed return section of docstring and improved descriptions * chore: Type -> type * chore: made expression_rewriter.py public * refactor: renamed variables -> free_symbols * refactor: improved docstrings * chore: correcting imports * refactor: renamed test_variables, and improved it such that it will work for all backends * chore: added copyright message * refactor: renamed free_symbols_in -> free_symbols * chore: updated docstrings * chore: isort fix * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * feat: began development on assumptions * chore: Added a comment about allow_transitive_resources to tutorial #1 * chore: added allow_transitive_resources=False; added quotes to Note about interactive tools * chore: updated tutorial 3 * chore: Added sentences about transitive compilation of resources * refactor: Created `CompilationFlags` enum * refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources * chore: Updated docstrings * chore: updating tests for CompilationFlags * chore: Modified tests to catch edge case errors (previously assertions) * chore: Updated tutorials with Compilation Flags * refactor: creating analysis submodule. * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * chore: resolving conflicts * chore: free_symbols_in -> free_symbols * chore: free_symbols_in -> free_symbols * Resolving conflicts * Improving assumptions handling * began typing fixes * Removed expression getter/setter. Updated typing * Removed commented out code * feat: added treemap visualisation class (#216) * Added GSE prototype * Trialling a decorator function * Added warning if no update applied; added methods to isolate functions and their arguments * Minor fix * Removed userwarning due to bug * Added catch for top level expression * Added better support for parsing assumptions and redefining symbols * Potential bugfix; Symbols now updated correctly * Improved logic parsing * bug fix * Improved detection of nonzero Symbols * Added warning if an expression does not change * defaulting suppress_warnings to true; still experimental * Updated check_expression_update to catch edge cases * bug fix: when parsing known symbols with reference values!=0 * Undoing code removal * Minor change for readaility * more bug fixes * More bug fixes * Hopefully the last bug fix * tbd * tbd * Updated imports after merge * Minor improvements * Added ability to evaluate gnarly * Attempting to fix evaluation bug * bug fix * bug found on substitute * Removed unused import * Added fix to allow substitute to refer to symbols rather than symbol names * Removed unnecessary print statement * Bandaid fix for minor bug * Small fix * fix: proper detection for zero arguments * Upgraded grammar and text in alias-sampling * Only minor changes to the third tutorial * Typo fix. * Added visualisations module; needs depth parameter. * scratch notebook * Pausing work; creating issue in bartiq. * feat: visualisation improvement cleanup * feat: visualisation improvement cleanup * feat: create a method that can handle dataframe with redundant names * test: test the new method * chore: linting * chore: include pandas and plotly in dependencies * Update src/bartiq/visualisations.py Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: file removal and renaming from review * feat: added is_numeric method and visualization input validation check logic * test: added compiled routine is_numeric tests and input validation for visualization * chore: remove scale_to * chore: delete changes to sympy backend * chore: private function instead of classmethod * chore: reset advanced example * chore: validation checking invalid resource to plot * chore: avoid duplication of strings when calling px.treemap * test: output data frame is as expected * test: test plot output type * chore: adjust docstring and test function signatures * chore: linting * chore: linting * chore: address review comments * chore: address review comment --------- Co-authored-by: brendan reid <brendan.reid1991@gmail.com> Co-authored-by: Brendan Reid <breid@psiquantum.com> Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * Removed reference to ._expr * improved typing * Modifying Basic -> Expr as generic type. * Modified fixture * improved typing * Moved expand test to be sympy specific * changed fixture scope from 'class' to 'function' * renamed as_individual_terms - > individual_terms * Renamed property; ran isort * renamed as_individual_terms -> individual_terms * typo fix * Removed fixtures from tests and restructured them * chore: update poetry.lock file for dependabot (#227) * chore: update poetry.lock file for dependabot * chore: update lock file * chore: remove h11 as transient dependency * chore: update poetry lock * refactor: made pandas and plotly optional installs (#226) * refactor: made pandas and plotly optional installs * Added checks to ensure tests do not fail unexpectedly * ran isort * Added .venv to .gitignore * Addition of pandas stubs changed behaviour of scipy stubs; quick fix * renamed visualization->interactive * updated extras flag * renamed vis->viz * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * added plotly-stubs; may revert * Removed type: ignore * removed type: ignore; updated error message * fixing plotly-stubs install * Removed plotly-stubs entirely. * added pytest.importorskip to module * Added noqa to pass flake8 * Ran isort * isort versioning mismatch * Streamlined some aspects of the TreeMap class; removed unnecessary checks * Removing unused imports * fix: Fix typing in analysis module --------- Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com> * updated substitute function to account for symbols with assumptions on them * attempting to consolidate the typing * Added sequence of commands as a test * removing unused import * Updating typing * Implementing Konrads changes * remove trailing whitespace * added return statement * reimplementing lost changes * Implementing SympyAssumption * made it so child classes of ExpressionRewriters do not need the decorator * moved evaluation check into Assumptions _post_init_ * started assumptions tracking * quick fix for custom max problem * improved docstrings and added comments * added reapply_all_assumptions * formatting * improving properties dict * isort * formatting * began tests * updated properties dict * added tests * formatting * added comment on _add_assumption * deleted test file * fixing mypy issues * fixing mypy issues * fixing import for py3.10 * isort * minor typo fix * Added substitution methods * implemented sympy substitutions,including wildcards * modified substitute to allow arbitrary substitutions" * improvements to wildcard subs * fixed final bug in wildcard subs * added hash to assumptions * minor refactor * added decorator to override custom max * minor refactor after removing custom max * began improving tests * added classmethod to sympy_backend * added classmethod to sympy_backend * added tests for .with_sympy_max * rename Relationals -> Comparators * rename relationship->comparator * minor typo fix * re-adding assumptions after mistaken deletion * changed from using float to literal_eval * added more tests for assumptions * minor fixes * mypy fixes * docstring updates;mypy fixes;wildcard improvements * mypy fixes * improved typehinting * improved tracking of assumptions * improved tracking of assumptions * updating evaluate from main * minor fixes * gave _substitute default behaviour * streamlined dataclass interactions * deleting test file * added_named_tuple * bug fixes * change from all caps to snake case * minor refactor * started testing substitutions * moving some assumptions tests into basic tests * updated focus + substitution logic * added tests * fixing docstring inconsistencies * quick fixes from michals review * Removed classmethod; moved logic to `parse_to_sympy` * modified interpreter to override certain functions * modified rewriter backend def * removed test until we settle on impl * bug fixes, test fixes * deleted unwanted file * mypy fix * minor change * refactor * added function_overrides to sympyinterpreter * updated sympybackend with new properties * updated rewriter after changes to sympy backend * modified backend after changes to interpreter * removing unnecessary kwargs * improved docstrings * added tests for sympy_backend when using sympy max * rename assume->assumption * fix typing error * test renaming * typing fixes * refactored into dataclasses * removing tests from downstream branch * added instruction set * renaming assumption->assume * typo * another typo * renamed kwarg to assumption * fixing typing & usability * updated tests to pass * fixing imports * deleted erroneous line * added tests for history tracking * fixing mypy issues * refactored instructions * refactored assumptions as child of dummy class * modified tests after refactor * made rewriters public * made rewriters public * deleting files * exposed rewriter factory * modified how substitutions are added * minor refactor on substitutions; added factory method * improved logic on linked parameters * updated tests after refactor * added new ignore code to flake8 * remove unnecessary guards * improving docstrings * improving tests * tighting typing * added tests for linked parameters in focus * added per-file ignore code for lambdas * made wild chars stored in tuples rather than list * removed None type from original_expression * removed noqa * simplified logic after Konrads comments * minor typing typo (typ-o) * fixing typos in docstring * updating docstrings * minor factor on substitutions * updating tests * fixing attr error * fixing tests * removed testig code * updated assumption properties derivation; improved docstrings * updated tests * missing word in docstring --------- Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com> Co-authored-by: antalszava <antalszava@gmail.com> Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
…ines (#239) * chore: added module level docstrings * chore: removed unused import * chore: erroneous line introduced * chore: added module level docstring * chore: improved typing in update_expression * chore: added module level docstring; removed return section of docstring and improved descriptions * chore: Type -> type * chore: made expression_rewriter.py public * refactor: renamed variables -> free_symbols * refactor: improved docstrings * chore: correcting imports * refactor: renamed test_variables, and improved it such that it will work for all backends * chore: added copyright message * refactor: renamed free_symbols_in -> free_symbols * chore: updated docstrings * chore: isort fix * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * feat: began development on assumptions * chore: Added a comment about allow_transitive_resources to tutorial #1 * chore: added allow_transitive_resources=False; added quotes to Note about interactive tools * chore: updated tutorial 3 * chore: Added sentences about transitive compilation of resources * refactor: Created `CompilationFlags` enum * refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources * chore: Updated docstrings * chore: updating tests for CompilationFlags * chore: Modified tests to catch edge case errors (previously assertions) * chore: Updated tutorials with Compilation Flags * refactor: creating analysis submodule. * docs: improve the API docs (#209) * docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring * docs: Added missing `Raises` sections in existing docstrings * docs: Improved styling of function segments in docs for easy navigation * docs: Added clickable reference links to parts of documentations in doc strings * fix: Fixed the formatting and lint issues * fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py` * fix: Exposed `SymbolicBackend` through `bartiq.symbolics` * fix: Exposed `Port` at top level (`bartiq.Port`) * docs: Adding doc-string for `Port` class * fix(docs): Added missing Args, and references in modified docs * fix(docs): Added External references * fix(docs): Fixed issues of long `Return` descriptions * fix(docs): Reverting `symbolics` concept markdown content * fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform` * fix(docs): Fixed a formatting issue in the module doc-string * fix(docs): Removed `SymbolicBackend` from exposing to top-level, and added submodule rendering and extra styling for documentation * fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function * fix(docs): Extended `module` & `method` annotations in docs * chore: resolving conflicts * chore: free_symbols_in -> free_symbols * chore: free_symbols_in -> free_symbols * Resolving conflicts * Improving assumptions handling * began typing fixes * Removed expression getter/setter. Updated typing * Removed commented out code * feat: added treemap visualisation class (#216) * Added GSE prototype * Trialling a decorator function * Added warning if no update applied; added methods to isolate functions and their arguments * Minor fix * Removed userwarning due to bug * Added catch for top level expression * Added better support for parsing assumptions and redefining symbols * Potential bugfix; Symbols now updated correctly * Improved logic parsing * bug fix * Improved detection of nonzero Symbols * Added warning if an expression does not change * defaulting suppress_warnings to true; still experimental * Updated check_expression_update to catch edge cases * bug fix: when parsing known symbols with reference values!=0 * Undoing code removal * Minor change for readaility * more bug fixes * More bug fixes * Hopefully the last bug fix * tbd * tbd * Updated imports after merge * Minor improvements * Added ability to evaluate gnarly * Attempting to fix evaluation bug * bug fix * bug found on substitute * Removed unused import * Added fix to allow substitute to refer to symbols rather than symbol names * Removed unnecessary print statement * Bandaid fix for minor bug * Small fix * fix: proper detection for zero arguments * Upgraded grammar and text in alias-sampling * Only minor changes to the third tutorial * Typo fix. * Added visualisations module; needs depth parameter. * scratch notebook * Pausing work; creating issue in bartiq. * feat: visualisation improvement cleanup * feat: visualisation improvement cleanup * feat: create a method that can handle dataframe with redundant names * test: test the new method * chore: linting * chore: include pandas and plotly in dependencies * Update src/bartiq/visualisations.py Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: file removal and renaming from review * feat: added is_numeric method and visualization input validation check logic * test: added compiled routine is_numeric tests and input validation for visualization * chore: remove scale_to * chore: delete changes to sympy backend * chore: private function instead of classmethod * chore: reset advanced example * chore: validation checking invalid resource to plot * chore: avoid duplication of strings when calling px.treemap * test: output data frame is as expected * test: test plot output type * chore: adjust docstring and test function signatures * chore: linting * chore: linting * chore: address review comments * chore: address review comment --------- Co-authored-by: brendan reid <brendan.reid1991@gmail.com> Co-authored-by: Brendan Reid <breid@psiquantum.com> Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com> * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * Removed reference to ._expr * improved typing * Modifying Basic -> Expr as generic type. * Modified fixture * improved typing * Moved expand test to be sympy specific * changed fixture scope from 'class' to 'function' * renamed as_individual_terms - > individual_terms * Renamed property; ran isort * renamed as_individual_terms -> individual_terms * typo fix * Removed fixtures from tests and restructured them * chore: update poetry.lock file for dependabot (#227) * chore: update poetry.lock file for dependabot * chore: update lock file * chore: remove h11 as transient dependency * chore: update poetry lock * refactor: made pandas and plotly optional installs (#226) * refactor: made pandas and plotly optional installs * Added checks to ensure tests do not fail unexpectedly * ran isort * Added .venv to .gitignore * Addition of pandas stubs changed behaviour of scipy stubs; quick fix * renamed visualization->interactive * updated extras flag * renamed vis->viz * chore: rename nlz to ntz (#225) * chore: rename nlz to ntz * chore: add deprecated class alias. * fix: test and linter * added plotly-stubs; may revert * Removed type: ignore * removed type: ignore; updated error message * fixing plotly-stubs install * Removed plotly-stubs entirely. * added pytest.importorskip to module * Added noqa to pass flake8 * Ran isort * isort versioning mismatch * Streamlined some aspects of the TreeMap class; removed unnecessary checks * Removing unused imports * fix: Fix typing in analysis module --------- Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com> * updated substitute function to account for symbols with assumptions on them * attempting to consolidate the typing * Added sequence of commands as a test * removing unused import * Updating typing * Implementing Konrads changes * remove trailing whitespace * added return statement * reimplementing lost changes * Implementing SympyAssumption * made it so child classes of ExpressionRewriters do not need the decorator * moved evaluation check into Assumptions _post_init_ * started assumptions tracking * quick fix for custom max problem * improved docstrings and added comments * added reapply_all_assumptions * formatting * improving properties dict * isort * formatting * began tests * updated properties dict * added tests * formatting * added comment on _add_assumption * deleted test file * fixing mypy issues * fixing mypy issues * fixing import for py3.10 * isort * minor typo fix * Added substitution methods * implemented sympy substitutions,including wildcards * modified substitute to allow arbitrary substitutions" * improvements to wildcard subs * fixed final bug in wildcard subs * added hash to assumptions * minor refactor * added decorator to override custom max * minor refactor after removing custom max * began improving tests * added classmethod to sympy_backend * added classmethod to sympy_backend * added tests for .with_sympy_max * rename Relationals -> Comparators * rename relationship->comparator * minor typo fix * re-adding assumptions after mistaken deletion * changed from using float to literal_eval * added more tests for assumptions * minor fixes * mypy fixes * docstring updates;mypy fixes;wildcard improvements * mypy fixes * improved typehinting * improved tracking of assumptions * improved tracking of assumptions * updating evaluate from main * minor fixes * gave _substitute default behaviour * streamlined dataclass interactions * deleting test file * added_named_tuple * bug fixes * change from all caps to snake case * minor refactor * started testing substitutions * moving some assumptions tests into basic tests * updated focus + substitution logic * added tests * fixing docstring inconsistencies * quick fixes from michals review * Removed classmethod; moved logic to `parse_to_sympy` * modified interpreter to override certain functions * modified rewriter backend def * removed test until we settle on impl * bug fixes, test fixes * deleted unwanted file * mypy fix * minor change * refactor * added function_overrides to sympyinterpreter * updated sympybackend with new properties * updated rewriter after changes to sympy backend * modified backend after changes to interpreter * removing unnecessary kwargs * improved docstrings * added tests for sympy_backend when using sympy max * rename assume->assumption * fix typing error * test renaming * typing fixes * refactored into dataclasses * removing tests from downstream branch * added instruction set * renaming assumption->assume * typo * another typo * renamed kwarg to assumption * fixing typing & usability * updated tests to pass * fixing imports * deleted erroneous line * added tests for history tracking * fixing mypy issues * refactored instructions * refactored assumptions as child of dummy class * modified tests after refactor * made rewriters public * made rewriters public * deleting files * exposed rewriter factory * modified how substitutions are added * minor refactor on substitutions; added factory method * improved logic on linked parameters * updated tests after refactor * added new ignore code to flake8 * remove unnecessary guards * improving docstrings * improving tests * tighting typing * added tests for linked parameters in focus * added per-file ignore code for lambdas * made wild chars stored in tuples rather than list * removed None type from original_expression * removed noqa * simplified logic after Konrads comments * minor typing typo (typ-o) * fixing typos in docstring * removed rewriter suffix from filename * added rewriter instance for routines * tightend up symbol retrieval logic * improved docstrings * fixing imports * fixing imports * clarified docstring * removed guard on sympy type * removed guard * renamed routine.py > resources.py * tidied docstring * added tests * added guard * removed Generic parent class from ResourceRewriter * fixing mypy * updating docstrings * minor factor on substitutions * updating tests * fixing attr error * fixing tests * once more * previous commit was made in err * removed testig code * michals comments * updated assumption properties derivation; improved docstrings * updated tests * updated apply_to_whole_routine and tests --------- Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com> Co-authored-by: antalszava <antalszava@gmail.com> Co-authored-by: pqvr <work.vrpq@gmail.com> Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
Description
Modified the documentation of the code as per #193, the following changes were done:
ResourceTypeandPortDirectionlist the possible valuessymbolicsmodule show up in the reference docsRaisessections missing from the docstringsto_qrefinCompiledRoutine) as right now the header with the class name looks same asParameterssection below it which makes it harder to navigate.routine_to_qrefmentionsCompiledRoutine. It would be nice ifCompiledRoutinewould be actually a link one can click.About the investigation of docs of the
symbolicsmodule, the problem is that thedocs/concepts/symbolics.mdfile for symbolics is empty. So, I didn't make any changes to the file at the moment.Closes #193
Please verify that you have completed the following steps