Skip to content

feat: add type annotations to generated code #5008

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merging latest changes from master
  • Loading branch information
gvwilson committed Feb 11, 2025
commit 556dd53255eb0438421cb0d2a7c1b9c447d032dc
107 changes: 33 additions & 74 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ commands:
command: |
python -m venv venv
. venv/bin/activate
pip install --upgrade pip wheel
pip install -e .
pip install -r ./test_requirements/requirements_<<parameters.py>>_core.txt
- run:
name: Test core
command: |
. venv/bin/activate
pytest plotly/tests/test_core
pytest tests/test_core
no_output_timeout: 20m

test_optional:
Expand All @@ -41,7 +41,7 @@ commands:
command: |
python -m venv venv
. venv/bin/activate
pip install --upgrade pip wheel
pip install -e .
pip install -r ./test_requirements/requirements_<<parameters.py>>_optional.txt
cd js
npm ci
Expand All @@ -55,36 +55,36 @@ commands:
name: Test core
command: |
. venv/bin/activate
pytest plotly/tests/test_core
pytest tests/test_core
no_output_timeout: 20m
- run:
name: Test optional
command: |
. venv/bin/activate
pytest plotly/tests/test_optional
pytest tests/test_optional
no_output_timeout: 40m
- run:
name: Test utils
command: |
. venv/bin/activate
pytest _plotly_utils/tests/
pytest tests/test_plotly_utils/
no_output_timeout: 20m
- run:
name: Test io
command: |
. venv/bin/activate
pytest plotly/tests/test_io
pytest tests/test_io
no_output_timeout: 20m
- run:
name: Test dependencdies not imported
command: |
. venv/bin/activate
pytest -x test_init/test_dependencies_not_imported.py
python -m pytest -x test_init/test_dependencies_not_imported.py
- run:
name: Test lazy imports
command: |
. venv/bin/activate
pytest -x test_init/test_lazy_imports.py
python -m pytest -x test_init/test_lazy_imports.py
test_orca:
parameters:
py:
Expand All @@ -99,7 +99,6 @@ commands:
command: |
python -m venv venv
. venv/bin/activate
pip install --upgrade pip wheel
pip install -r ./test_requirements/requirements_<<parameters.py>>_optional.txt
- run:
name: Install plotly-geo
Expand All @@ -118,10 +117,10 @@ commands:
name: Test orca
command: |
. venv/bin/activate
pytest plotly/tests/test_orca
pytest tests/test_orca
no_output_timeout: 20m
- store_artifacts:
path: plotly/tests/test_orca/images/linux/failed
path: tests/test_orca/images/linux/failed

jobs:
check-code-formatting:
Expand Down Expand Up @@ -269,7 +268,6 @@ jobs:
command: |
python -m venv venv
. venv/bin/activate
pip install --upgrade pip wheel
pip install -e .
pip install plotly-geo
pip install -r test_requirements/requirements_39_pandas_2_optional.txt
Expand All @@ -278,28 +276,28 @@ jobs:
name: Build html figures (Pandas 2)
command: |
. venv/bin/activate
python test/percy/plotly-express.py
python tests/percy/plotly-express.py
- run:
name: Build html figures (Pandas 1) and compare
command: |
. venv/bin/activate
mkdir test/percy/pandas2
mv test/percy/*.html test/percy/pandas2/
mkdir tests/percy/pandas2
mv tests/percy/*.html tests/percy/pandas2/
# 1.1 is the earliest minor with Py3.9 wheels
pip install "pandas==1.1.5"
python test/percy/plotly-express.py
python test/percy/compare-pandas.py
rm -rf test/percy/pandas2
python tests/percy/plotly-express.py
python tests/percy/compare-pandas.py
rm -rf tests/percy/pandas2
- run:
name: Run percy snapshots
command: |
npm i @percy/cli
npx percy snapshot -c test/percy/snapshots.yml test/percy/
rm test/percy/*.html
npx percy snapshot -c tests/percy/snapshots.yml tests/percy/
rm tests/percy/*.html

plotlyjs_dev_build:
docker:
- image: cimg/python:3.8-node
- image: cimg/python:3.11-node
environment:
LANG: en_US.UTF-8
resource_class: large
Expand All @@ -311,25 +309,20 @@ jobs:
command: |
python -m venv venv
. venv/bin/activate
pip install --upgrade pip wheel
pip install -r ./test_requirements/requirements_38_core.txt black inflect
pip install -e .
pip install -r ./test_requirements/requirements_311_core.txt black inflect
pip install jupyterlab
- run:
name: Update jupyter widget plotly.js version
command: |
. venv/bin/activate
python setup.py updateplotlywidgetversion
- run:
name: Update plotly.js to dev
command: |
. venv/bin/activate
python setup.py updateplotlyjsdev
python commands.py updateplotlyjsdev
- run:
name: Test core
command: |
. venv/bin/activate
locale
pytest -k 'not nodev' plotly/tests/test_core
pytest -k 'not nodev' tests/test_core
no_output_timeout: 20m
- run:
name: Commit
Expand All @@ -343,36 +336,27 @@ jobs:
name: Build source distribution packages
command: |
. venv/bin/activate
python setup.py sdist
pip install build
python -m build --sdist --wheel -o dist
when: always
- store_artifacts:
path: dist/

full_build:
docker:
- image: continuumio/miniconda3:24.3.0-0
- image: cimg/python:3.11-node
environment:
LANG: en_US.UTF-8
resource_class: large

steps:
- checkout

- run:
name: Create conda environment
command: |
conda config --remove channels defaults
conda config --add channels conda-forge
conda create -n env --yes python=3.9 conda-build=3.28.4 conda-verify
conda install -n env -c conda-forge jupyterlab nodejs=16
conda init bash
mkdir output

- run:
name: initial NPM Build
command: |
eval "$(conda shell.bash hook)"
conda activate env
python -m venv venv
. venv/bin/activate
cd js
npm ci
npm run build
Expand All @@ -381,41 +365,17 @@ jobs:
- run:
name: PyPI Build
command: |
eval "$(conda shell.bash hook)"
conda activate env
python setup.py sdist bdist_wheel
cp -R dist output/dist
git status

- run:
name: Conda Build
command: |
eval "$(conda shell.bash hook)"
conda activate env
conda build recipe/
mv /opt/conda/envs/env/conda-bld/noarch/plotly*.tar.bz2 output/
. venv/bin/activate
pip install build
python -m build --sdist --wheel -o dist
cp -R dist output
git status

- run:
name: Build Widget javascript bundle
command: |
eval "$(conda shell.bash hook)"
conda activate env
cd js
npm ci
npm run build

- run:
name: Zip output
command: |
tar czf output.tgz output

- run:
name: Git Diff
command: |
git status
git diff

- store_artifacts:
path: output.tgz

Expand Down Expand Up @@ -445,7 +405,6 @@ jobs:
cd doc
python -m venv venv
. venv/bin/activate
pip install --upgrade pip wheel
pip uninstall -y plotly
pip install -r requirements.txt
if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then
Expand Down
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ below :-).

## Code PR

- [ ] I have read through the [contributing notes](https://github.com/plotly/plotly.py/blob/master/contributing.md) and understand the structure of the package. In particular, if my PR modifies code of `plotly.graph_objects`, my modifications concern the `codegen` files and not generated files.
- [ ] I have read through the [contributing notes](https://github.com/plotly/plotly.py/blob/master/CONTRIBUTING.md) and understand the structure of the package. In particular, if my PR modifies code of `plotly.graph_objects`, my modifications concern the `codegen` files and not generated files.
- [ ] I have added tests (if submitting a new feature or correcting a bug) or
modified existing tests.
- [ ] For a new feature, I have added documentation examples in an existing or
Expand Down
15 changes: 6 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
0
0.html
iframe_figures/
plotly/tests/test_orca/images/linux/failed/
tests/test_orca/images/linux/failed/

*.egg-info

Expand Down Expand Up @@ -49,20 +49,17 @@ plotly.egg-info/
# macOS utility file
**/.DS_Store

plotly/tests/test_orca/images/*/failed
plotly/tests/test_orca/images/*/tmp
/plotly-package/plotly/tests/test_core/test_offline/plotly.min.js
tests/test_orca/images/*/failed
tests/test_orca/images/*/tmp
tests/test_core/test_offline/plotly.min.js
temp-plot.html
.vscode
doc/python/.ipynb_checkpoints
doc/python/.mapbox_token
doc/.ipynb_checkpoints
tags
doc/check-or-enforce-order.py

jupyterlab_plotly/labextension/
jupyterlab_plotly/nbextension/index.js*
plotly/package_data/widgetbundle.js

test/percy/*.html
test/percy/pandas2/*.html
tests/percy/*.html
tests/percy/pandas2/*.html
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ This version includes several performance improvements ([#2368](https://github.c
- Introduce range breaks on date axes (for example, to remove week-ends) via `layout.xaxis.rangebreaks`
- Introduce a new unified x (or y) hovermode (`layout.hovermode="x unified"`), in which the hover box shows the information for all traces at a given x (or y) position
- Add `node.customdata` and `link.customdata` to sankey traces
- Updated [contributing notes](https://github.com/plotly/plotly.py/blob/master/contributing.md) for more explanations on how to contribute to plotly.py [#2290](https://github.com/plotly/plotly.py/pull/2290). Please give feedback on these notes!
- Updated [contributing notes](https://github.com/plotly/plotly.py/blob/master/CONTRIBUTING.md) for more explanations on how to contribute to plotly.py [#2290](https://github.com/plotly/plotly.py/pull/2290). Please give feedback on these notes!
- Updated documentation examples [#2325](https://github.com/plotly/plotly.py/pull/2325), and to show how to color links in Sankey diagrams [#2291](https://github.com/plotly/plotly.py/pull/2291).
- Special thanks to [@SylwiaOliwia2](https://github.com/SylwiaOliwia2) and [@dangercrow](https://github.com/dangercrow) for improving our documentation!

Expand Down Expand Up @@ -1738,7 +1738,7 @@ This is a major version with many exciting updates. See the [Introducing plotly.
- Error message for `plotly.figure_factory.create_choropleth` is now helpful to Anaconda users who do not have the correct modules installed for the County Choropleth figure factory.

### Changed / Deprecated
Please see the [migration guid](migration-guide.md) for a full list of the changes and deprecations in version 3.0.0
Please see the [migration guide](MIGRATION_GUIDE.md) for a full list of the changes and deprecations in version 3.0.0



Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.