-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: add shortcut module optree.pytree
and optree.treespec
#189
Conversation
…from `ops` module
33b44be
to
22906dc
Compare
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.
Generally looks good with some nit suggestions. Thanks!
Co-authored-by: Xuehai Pan <XuehaiPan@outlook.com> Signed-off-by: Lanqing Huang <lqhuang@outlook.com>
Co-authored-by: Xuehai Pan <XuehaiPan@outlook.com> Signed-off-by: Lanqing Huang <lqhuang@outlook.com>
Co-authored-by: Xuehai Pan <XuehaiPan@outlook.com> Signed-off-by: Lanqing Huang <lqhuang@outlook.com>
Co-authored-by: Xuehai Pan <XuehaiPan@outlook.com> Signed-off-by: Lanqing Huang <lqhuang@outlook.com>
Co-authored-by: Xuehai Pan <XuehaiPan@outlook.com> Signed-off-by: Lanqing Huang <lqhuang@outlook.com>
The failing lint says there is a spelling error.
According to https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-versionadded, it's the right directive. |
You can add |
Failed again
Actually, I tried to run $ make pylint
/Users/lqhuang/Git/optree/.venv/bin/python3 -m pip show pylint &>/dev/null || (cd && /Users/lqhuang/Git/optree/.venv/bin/python3 -m pip install --upgrade pylint[spelling])
Collecting pylint[spelling]
Using cached pylint-3.3.4-py3-none-any.whl.metadata (12 kB)
Collecting dill>=0.3.6 (from pylint[spelling])
Using cached dill-0.3.9-py3-none-any.whl.metadata (10 kB)
Collecting platformdirs>=2.2.0 (from pylint[spelling])
Using cached platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: astroid<=3.4.0-dev0,>=3.3.8 in ./Git/optree/.venv/lib/python3.12/site-packages (from pylint[spelling]) (3.3.8)
Collecting isort!=5.13.0,<7,>=4.2.5 (from pylint[spelling])
Using cached isort-6.0.0-py3-none-any.whl.metadata (11 kB)
Collecting mccabe<0.8,>=0.6 (from pylint[spelling])
Using cached mccabe-0.7.0-py2.py3-none-any.whl.metadata (5.0 kB)
Collecting tomlkit>=0.10.1 (from pylint[spelling])
Using cached tomlkit-0.13.2-py3-none-any.whl.metadata (2.7 kB)
Requirement already satisfied: pyenchant~=3.2 in ./Git/optree/.venv/lib/python3.12/site-packages (from pylint[spelling]) (3.2.2)
Using cached dill-0.3.9-py3-none-any.whl (119 kB)
Using cached isort-6.0.0-py3-none-any.whl (94 kB)
Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB)
Using cached platformdirs-4.3.6-py3-none-any.whl (18 kB)
Using cached tomlkit-0.13.2-py3-none-any.whl (37 kB)
Using cached pylint-3.3.4-py3-none-any.whl (522 kB)
Installing collected packages: tomlkit, platformdirs, mccabe, isort, dill, pylint
Successfully installed dill-0.3.9 isort-6.0.0 mccabe-0.7.0 platformdirs-4.3.6 pylint-3.3.4 tomlkit-0.13.2
/Users/lqhuang/Git/optree/.venv/bin/python3 -m pip show pyenchant &>/dev/null || (cd && /Users/lqhuang/Git/optree/.venv/bin/python3 -m pip install --upgrade pyenchant)
/Users/lqhuang/Git/optree/.venv/bin/python3 -m pylint --version
pylint 3.3.4
astroid 3.3.8
Python 3.12.7 (main, Oct 16 2024, 07:12:08) [Clang 18.1.8 ]
/Users/lqhuang/Git/optree/.venv/bin/python3 -m pylint optree
usage: pylint [options]
pylint: error: argument --spelling-dict: invalid choice: 'en_US' (choose from '')
make: *** [pylint] Error 32 I searched the error, but google redirect me to an unsolved issue pylint-dev/pylint#5092 |
Run brew install enchant
pip3 install -U --pre pyenchant |
Doesn't work at all indeed without So the |
Oh man, it works. @XuehaiPan Please approve again, sorry for that. $ make pylint
/Users/lqhuang/Git/optree/.venv/bin/python3 -m pip show pylint &>/dev/null || (cd && /Users/lqhuang/Git/optree/.venv/bin/python3 -m pip install --upgrade pylint[spelling])
/Users/lqhuang/Git/optree/.venv/bin/python3 -m pip show pyenchant &>/dev/null || (cd && /Users/lqhuang/Git/optree/.venv/bin/python3 -m pip install --upgrade pyenchant)
/Users/lqhuang/Git/optree/.venv/bin/python3 -m pylint --version
pylint 3.3.4
astroid 3.3.8
Python 3.12.7 (main, Oct 16 2024, 07:12:08) [Clang 18.1.8 ]
/Users/lqhuang/Git/optree/.venv/bin/python3 -m pylint optree
-------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 9.95/10, +0.05) |
The patch is only included in the See also: |
optree.pytree
and optree.treespec
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #189 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 36 42 +6
Lines 3789 3945 +156
==========================================
+ Hits 3789 3945 +156
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9267dff
to
a65aecd
Compare
@lqhuang Thanks for the contribution! |
Seriously? You wake up at 6 a.m.? Never mind, |
A much simpler way to add new modules
pytree
andtreespec
.Check PR #186 for more history context and motivation.
The major difference between them:
tree
module andtreespec
module #186 has concrete and refined docs and migrate to new API design like whatjax
does.Merge of current PR will close #186