Skip to content

Commit

Permalink
chore: Use standardized version metadata across python packages
Browse files Browse the repository at this point in the history
- Defining __version__ is a rejected PEP 396 standard.
- Define the version in setup.cfg like the other python packages
- Update the `update_version.sh` script to handle all the python packages the same
- For fetching the version from code, you should use importlib:
```
from importlib.metadata import version
print(version("deephaven-plugin-ui"))
```
  • Loading branch information
mofojed committed Mar 19, 2024
1 parent 19582de commit 7d87e6f
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 26 deletions.
2 changes: 1 addition & 1 deletion plugins/json/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = deephaven-plugin-json
description = Deephaven Plugin for json
long_description = file: README.md
long_description_content_type = text/markdown
version = attr:deephaven.plugin.json.__version__
version = 0.0.2.dev0
url = https://github.com/deephaven/deephaven-plugins
project_urls =
Source Code = https://github.com/deephaven/deephaven-plugins
Expand Down
2 changes: 0 additions & 2 deletions plugins/json/src/deephaven/plugin/json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

from deephaven.plugin import Registration, Callback, object_type

__version__ = "0.0.2.dev0"


class Node:
def __init__(self, object, is_ref=False, **kw) -> None:
Expand Down
2 changes: 1 addition & 1 deletion plugins/plotly/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = deephaven-plugin-plotly
description = Deephaven Plugin for Plotly
long_description = file: README.md
long_description_content_type = text/markdown
version = attr:deephaven.plugin.plotly.__version__
version = 0.3.0.dev0
url = https://github.com/deephaven/deephaven-plugins
project_urls =
Source Code = https://github.com/deephaven/deephaven-plugins
Expand Down
2 changes: 0 additions & 2 deletions plugins/plotly/src/deephaven/plugin/plotly/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from deephaven.plugin import Registration, Callback
from plotly import io as pio

__version__ = "0.3.0.dev0"


def _init_theme():
# Set the Deephaven style globally
Expand Down
22 changes: 2 additions & 20 deletions tools/update_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,8 @@ function update_file() {
extra=
[ "$dev" = true ] && extra=".dev0"
case "$package" in
json)
update_file json/src/deephaven/plugin/json/__init__.py '__version__ = "' '"' "$extra"
;;
matplotlib)
update_file matplotlib/setup.cfg 'version = ' '' "$extra"
;;
plotly)
update_file plotly/src/deephaven/plugin/plotly/__init__.py '__version__ = "' '"' "$extra"
;;
plotly-express)
update_file plotly-express/setup.cfg 'version = ' '' "$extra"
;;
ui)
update_file ui/setup.cfg 'version = ' '' "$extra"
;;
utilities)
update_file utilities/setup.cfg 'version = ' '' "$extra"
;;
packaging)
update_file packaging/setup.cfg 'version = ' '' "$extra"
json | matplotlib | plotly | plotly-express | ui | utilities | packaging)
update_file "${package}/setup.cfg" 'version = ' '' "$extra"
;;
auth-keycloak | dashboard-object-viewer | table-example)
# Packages that don't have any Python to publish, just ignore
Expand Down

0 comments on commit 7d87e6f

Please sign in to comment.