Skip to content

Commit

Permalink
adding repo and branch options to updateplotlyjsdev
Browse files Browse the repository at this point in the history
  • Loading branch information
zouhairm committed Apr 2, 2020
1 parent 4ef310f commit ac834bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
22 changes: 15 additions & 7 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Contributing

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

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

## Code of Conduct

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

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

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

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

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

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

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

## Setup a Development Environment

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

```bash
$ cd packages/python/plotly
$ python setup.py updateplotlyjs
```

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

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:

```bash
$ cd packages/python/plotly
$ python setup.py updateplotlyjsdev --devbranch pull/555
```

## Testing

We take advantage of two tools to run tests:
Expand Down
20 changes: 12 additions & 8 deletions packages/python/plotly/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ def request_json(url):
return json.loads(req.content.decode("utf-8"))


def get_latest_publish_build_info(branch):
def get_latest_publish_build_info(repo, branch):

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

branch_jobs = request_json(url)

Expand Down Expand Up @@ -344,8 +344,8 @@ def finalize_options(self):
pass

def run(self):
branch = "master"
build_info = get_latest_publish_build_info(branch)
branch = self.dev_branch
build_info = get_latest_publish_build_info(self.dev_repo, branch)

archive_url, bundle_url, schema_url = get_bundle_schema_urls(
build_info["build_num"]
Expand All @@ -370,16 +370,20 @@ def run(self):
# update plotly.js version in _plotlyjs_version
rev = build_info["vcs_revision"]
date = build_info["committer_date"]
version = "_".join([branch, date[:10], rev[:8]])
version = "_".join([self.dev_repo, branch, date[:10], rev[:8]])
overwrite_plotlyjs_version_file(version)


class UpdatePlotlyJsDevCommand(Command):
description = "Update project to a new development version of plotly.js"
user_options = []
user_options = [
("dev_repo=", None, "Repository name"),
("dev_branch=", None, "branch or pull/number"),
]

def initialize_options(self):
pass
self.dev_repo = "plotly/plotly.js"
self.dev_branch = "master"

def finalize_options(self):
pass
Expand Down

0 comments on commit ac834bb

Please sign in to comment.