Skip to content

Commit 289fb7b

Browse files
committed
adding repo and branch options to updateplotlyjsdev
1 parent e273882 commit 289fb7b

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

Diff for: contributing.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Contributing
22

33
Thank you for contributing to plotly.py! We are actively looking for
4-
diverse contributors, with diverse background and skills.
4+
diverse contributors, with diverse background and skills.
55

66
This guide start by a general description of the different ways to contribute
77
to plotly.py, then we explain some technical aspects of preparing your
8-
contribution.
8+
contribution.
99

1010
## Code of Conduct
1111

12-
Please check out the [Code of Conduct](CODE_OF_CONDUCT.md). Don't tl:dr; it,
12+
Please check out the [Code of Conduct](CODE_OF_CONDUCT.md). Don't tl:dr; it,
1313
but the general idea is to be nice.
1414

1515
## What are the different ways to contribute?
@@ -37,7 +37,7 @@ the structure of the code and of the repository.
3737
- the `plotly.figure_factory` module provides Python "recipes" for building
3838
advanced visualizations, such as Gantt charts, annotated heatmaps, etc.
3939
Figure factories are one of the easiest entry points into plotly.py, since
40-
they consist of Python-only code, with standalone, well-separated functions.
40+
they consist of Python-only code, with standalone, well-separated functions.
4141
However, please note that some of the figure factories become less relevant
4242
as we are introducing more features into `plotly.express`. Some issues in the
4343
tracker are labeled "figure_factory" and can be good issues to work on. More
@@ -70,14 +70,14 @@ also contribute to the project by
7070
- reporting bugs (see below).
7171

7272
- submitting feature requests (maybe we'll convince you to contribute it as a
73-
pull request!).
73+
pull request!).
7474

7575
- helping other users on the [community forum](https://community.plot.ly/).
7676
Join the list of [nice people](https://community.plot.ly/u) helping other
7777
plotly users :-).
7878

7979
We also recommend reading the great
80-
[how to contribute to open source](https://opensource.guide/how-to-contribute/)
80+
[how to contribute to open source](https://opensource.guide/how-to-contribute/)
8181
guide.
8282

8383
## Have a Bug Report?
@@ -98,7 +98,7 @@ Below we explain the technical aspects of contributing. It is not strictly neces
9898

9999
Note that if you are modifying a single documentation page, you can do it
100100
directly on Github by clicking on the "Edit this page on GitHub" link, without
101-
cloning the repository.
101+
cloning the repository.
102102

103103
## Setup a Development Environment
104104

@@ -206,6 +206,7 @@ First update the version of the `plotly.js` dependency in `packages/javascript/p
206206
Then run the `updateplotlyjs` command with:
207207

208208
```bash
209+
$ cd packages/python/plotly
209210
$ python setup.py updateplotlyjs
210211
```
211212

@@ -214,6 +215,13 @@ the `plotly/plotly.js` GitHub repository (and place them in
214215
`plotly/package_data`). It will then regenerate all of the `graph_objs`
215216
classes based on the new schema.
216217

218+
For dev branches, it is also possible to use `updateplotlyjsdev --devrepo reponame --devbranch branchname` to update to development versions of `plotly.js`. This will fetch the `plotly.js` in the CircleCI artifact of the branch `branchname` of the repo `reponame`. If `--devrepo` or `--devbranch` are omitted, `updateplotlyjsdev` defaults using `plotly/plotly.js` and `master` respectively. For example, to update to a version from a pull request to the `plotly/plotly.js` repo that is numbered 555, run:
219+
220+
```bash
221+
$ cd packages/python/plotly
222+
$ python setup.py updateplotlyjsdev --devbranch pull/555
223+
```
224+
217225
## Testing
218226

219227
We take advantage of two tools to run tests:

Diff for: packages/python/plotly/setup.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,12 @@ def request_json(url):
232232
return json.loads(req.content.decode("utf-8"))
233233

234234

235-
def get_latest_publish_build_info(branch):
235+
def get_latest_publish_build_info(repo, branch):
236236

237237
url = (
238238
r"https://circleci.com/api/v1.1/project/github/"
239-
r"plotly/plotly.js/tree/{branch}?limit=10000\&filter=completed"
240-
).format(branch=branch)
239+
r"{repo}/tree/{branch}?limit=10000\&filter=completed"
240+
).format(repo=repo, branch=branch)
241241

242242
branch_jobs = request_json(url)
243243

@@ -338,14 +338,15 @@ class UpdateBundleSchemaDevCommand(Command):
338338
user_options = []
339339

340340
def initialize_options(self):
341-
pass
341+
self.devrepo = None
342+
self.devbranch = None
342343

343344
def finalize_options(self):
344-
pass
345+
self.set_undefined_options("updateplotlyjsdev", ("devrepo", "devrepo"))
346+
self.set_undefined_options("updateplotlyjsdev", ("devbranch", "devbranch"))
345347

346348
def run(self):
347-
branch = "master"
348-
build_info = get_latest_publish_build_info(branch)
349+
build_info = get_latest_publish_build_info(self.devrepo, self.devbranch)
349350

350351
archive_url, bundle_url, schema_url = get_bundle_schema_urls(
351352
build_info["build_num"]
@@ -370,16 +371,20 @@ def run(self):
370371
# update plotly.js version in _plotlyjs_version
371372
rev = build_info["vcs_revision"]
372373
date = build_info["committer_date"]
373-
version = "_".join([branch, date[:10], rev[:8]])
374+
version = "_".join([self.devrepo, self.devbranch, date[:10], rev[:8]])
374375
overwrite_plotlyjs_version_file(version)
375376

376377

377378
class UpdatePlotlyJsDevCommand(Command):
378379
description = "Update project to a new development version of plotly.js"
379-
user_options = []
380+
user_options = [
381+
("devrepo=", None, "Repository name"),
382+
("devbranch=", None, "branch or pull/number"),
383+
]
380384

381385
def initialize_options(self):
382-
pass
386+
self.devrepo = "plotly/plotly.js"
387+
self.devbranch = "master"
383388

384389
def finalize_options(self):
385390
pass

0 commit comments

Comments
 (0)