Commit fde4c6d
committed
fix(build): read version statically from brainpy._version
PR #865 moved __version__ into brainpy/_version.py and made __init__ re-export
it. That broke static version resolution for consumers still pointing at
brainpy.__init__:
- pyproject.toml used `attr = "brainpy.__version__"`. setuptools reads attr via
AST only when it is a literal assignment; after the move __init__ exposes the
name through an ImportFrom, so setuptools falls back to importing the whole
brainpy package. In Publish.yml's isolated `python -m build` env (no jax /
brainstate) that import fails. Point the attr at brainpy._version.__version__,
which resolves statically without importing the package.
- docs/conf.py imported the full brainpy package solely to read
brainpy.__version__. Read it directly from brainpy._version instead.
brainpy/__init__.py keeps re-exporting __version__/__version_info__, so
bp.__version__ still works for users.1 parent ca1d233 commit fde4c6d
2 files changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 59 | + | |
62 | 60 | | |
63 | 61 | | |
64 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| |||
0 commit comments