Skip to content

Conversation

@AVDiv
Copy link
Contributor

@AVDiv AVDiv commented May 28, 2025

Description

Modified the documentation of the code as per #193, the following changes were done:

  • Make ResourceType and PortDirection list the possible values
  • Investigate why nothing from the symbolics module show up in the reference docs
  • Add any Raises sections missing from the docstrings
  • Change styling for class methods (such as to_qref in CompiledRoutine) as right now the header with the class name looks same as Parameters section below it which makes it harder to navigate.
  • Link all the objects mentioned in the docs. E.g. routine_to_qref mentions CompiledRoutine. It would be nice if CompiledRoutine would be actually a link one can click.

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.

Closes #193


Please verify that you have completed the following steps

  • I have self-reviewed my code.
  • I have updated documentation.

@cla-bot
Copy link

cla-bot bot commented May 28, 2025

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)

@mstechly mstechly self-requested a review May 28, 2025 13:48
@AVDiv AVDiv changed the title Improved the API Docs docs: Improved the API Docs May 28, 2025
Copy link
Contributor

@mstechly mstechly left a 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".
Screenshot 2025-05-28 at 3 49 40 PM

@mstechly
Copy link
Contributor

As per CLA – I know you've signed, I added you to the CLA-bot config.
I hope that when you push another MR it should trigger cla bot and make it work :)

@mstechly
Copy link
Contributor

@pqvr could you please take a look at why the lint job doesn't approve this? docs: prefix should be fine 🤔

@pqvr pqvr changed the title docs: Improved the API Docs docs: improve the API docs May 28, 2025
@pqvr
Copy link
Contributor

pqvr commented May 28, 2025

@pqvr could you please take a look at why the lint job doesn't approve this? docs: prefix should be fine 🤔

Yes, it seems that the conventional commit linter didn't like the capital letter in the word following the :. IOW, I changed the title from

docs: Improve the API Docs

to

docs: improve the API docs

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.

@cla-bot cla-bot bot added the cla-signed label May 28, 2025
Copy link
Contributor

@pqvr pqvr left a 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:

@mstechly mstechly mentioned this pull request May 28, 2025
5 tasks
@AVDiv AVDiv requested a review from mstechly May 28, 2025 18:36
Copy link
Contributor

@mstechly mstechly left a 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 :)

@mstechly
Copy link
Contributor

@AVDiv Also it seems that in order to claim bounty, you need to leave a comment in the original issue

@AVDiv AVDiv requested a review from mstechly May 29, 2025 15:27
Copy link
Contributor

@mstechly mstechly left a 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.


@overload
def postorder_transform(transform: RoutineTransform[T, P]) -> RoutineTransform[T, P]:
"""Transform a hierarchical routine graph in postorder fashion.
Copy link
Contributor

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.

  1. I don't think this affects what's displayed in the docs.
  2. This leads to unnecessary duplication, and sooner or later these docstrings will get out of sync in a confusing way.

Copy link
Contributor Author

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.

@mstechly
Copy link
Contributor

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.

Ok, team likes it!
Could you just make it explicit for mod -> module and meth -> method? func and attr can stay short.

@mstechly
Copy link
Contributor

Amazing, thank you so much!
If we ever meet in person, I owe you a beverage of your choice :)
I'll merge it in when you update to main.

@AVDiv
Copy link
Contributor Author

AVDiv commented Jun 1, 2025

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! 😄

@AVDiv
Copy link
Contributor Author

AVDiv commented Jun 1, 2025

Done with the update, guess it's good to go then.

@AVDiv AVDiv requested a review from mstechly June 1, 2025 14:15
@mstechly mstechly merged commit b0273a3 into PsiQ:main Jun 1, 2025
8 checks passed
Brendan-Reid1991 pushed a commit that referenced this pull request Jun 2, 2025
* 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
Brendan-Reid1991 pushed a commit that referenced this pull request Jun 2, 2025
* 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
Brendan-Reid1991 added a commit that referenced this pull request Jun 23, 2025
…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>
Brendan-Reid1991 added a commit that referenced this pull request Jun 30, 2025
* 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>
Brendan-Reid1991 added a commit that referenced this pull request Jul 2, 2025
…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>
Brendan-Reid1991 added a commit that referenced this pull request Jul 10, 2025
* 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>
Brendan-Reid1991 added a commit that referenced this pull request Jul 14, 2025
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Improvements to the API docs

4 participants