Skip to content

Commit

Permalink
Update branch name reference from 'master' to 'main'
Browse files Browse the repository at this point in the history
Summary:
Step 1 to update Captum OSS default branch name from 'master' to 'main'.

- Context see T200490048
- Instructions see [wiki](https://www.internalfb.com/intern/wiki/Open_Source/Maintain_a_FB_OSS_Project/Default_Branch_Name_Change/#1-before-you-use-the-too)

TODO: update the OSS wiki accordingly

Differential Revision: D64430568
  • Loading branch information
DianjingLiu authored and facebook-github-bot committed Oct 15, 2024
1 parent 4cb2808 commit cc88299
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- master
- main

workflow_dispatch:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-conda-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- master
- main

workflow_dispatch:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pip-cpu-with-mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- master
- main

workflow_dispatch:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pip-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- master
- main

workflow_dispatch:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pip-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- master
- main

workflow_dispatch:

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy to GitHub Pages
on:
push:
branches:
- master
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ The following command will both build the docs and serve the site locally:
## Pull Requests
We actively welcome your pull requests.

1. Fork the repo and create your branch from `master`.
1. Fork the repo and create your branch from `main`.
2. If you have added code that should be tested, add unit tests.
In other words, add unit tests.
3. If you have changed APIs, update the documentation. Make sure the
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[![Conda Recipe](https://img.shields.io/static/v1?logo=conda-forge&style=flat&color=green&label=recipe&message=captum)][#conda-forge-feedstock]
[![Docs - GitHub.io](https://img.shields.io/static/v1?logo=captum&style=flat&color=pink&label=docs&message=captum)][#docs-package]

[#github-license]: https://github.com/pytorch/captum/blob/master/LICENSE
[#github-license]: https://github.com/pytorch/captum/blob/main/LICENSE
[#pypi-package]: https://pypi.org/project/captum/
[#conda-forge-package]: https://anaconda.org/conda-forge/captum
[#conda-forge-feedstock]: https://github.com/conda-forge/captum-feedstock
Expand Down Expand Up @@ -82,7 +82,7 @@ pip install captum

If you'd like to try our bleeding edge features (and don't mind potentially
running into the occasional bug here or there), you can install the latest
master directly from GitHub. For a basic install, run:
main directly from GitHub. For a basic install, run:
```bash
git clone https://github.com/pytorch/captum.git
cd captum
Expand Down
2 changes: 1 addition & 1 deletion docs/contribution_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Before contributing an algorithm to Captum, please review these guidelines and p

If you think that proposed algorithm/feature satisfies many of the above criteria, please open an issue on GitHub (https://github.com/pytorch/captum/issues) to discuss the method with the core Captum team members before submitting a pull request. If the method seems suitable for inclusion in Captum, we will generally request a design document or proposal, explaining the proposed API and structure for the new algorithm. An example of a design proposal for LIME and Kernel SHAP can be found here (https://github.com/pytorch/captum/issues/467).

If an algorithm or feature adds only marginal improvements or does not meet most the criteria described above, then we would suggest including it into our AWESOME_LIST.MD (https://github.com/pytorch/captum/blob/master/AWESOME_LIST.md) instead of adding it to the core Captum library. In the future, if the algorithm gains more popularity and acceptance in the model interpretability community, we would be happy to accept a PR to add it to the Captum core library.
If an algorithm or feature adds only marginal improvements or does not meet most the criteria described above, then we would suggest including it into our AWESOME_LIST.MD (https://github.com/pytorch/captum/blob/main/AWESOME_LIST.md) instead of adding it to the core Captum library. In the future, if the algorithm gains more popularity and acceptance in the model interpretability community, we would be happy to accept a PR to add it to the Captum core library.

*Note that we reserve the right to decide not to include any algorithms that meet the above criteria, but we are unable to support in the long run.*

Expand Down
4 changes: 2 additions & 2 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pip install captum
<!--END_DOCUSAURUS_CODE_TABS-->

For more detailed installation instructions, please see the
[Project Readme](https://github.com/pytorch/captum/blob/master/README.md)
[Project Readme](https://github.com/pytorch/captum/blob/main/README.md)
on GitHub.


Expand All @@ -50,5 +50,5 @@ For an in-depth reference of the various Captum internals, see our
## Contributing

You'd like to contribute to Captum? Great! Please see
[here](https://github.com/pytorch/captum/blob/master/CONTRIBUTING.md)
[here](https://github.com/pytorch/captum/blob/main/CONTRIBUTING.md)
for how to help out.
30 changes: 15 additions & 15 deletions scripts/publish_site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
WORK_DIR=$(mktemp -d)
cd "${WORK_DIR}" || exit

# Clone both master & gh-pages branches
git clone [email protected]:pytorch/captum.git captum-master
# Clone both main & gh-pages branches
git clone [email protected]:pytorch/captum.git captum-main
git clone --branch gh-pages [email protected]:pytorch/captum.git captum-gh-pages

# A few notes about the script below:
Expand Down Expand Up @@ -75,11 +75,11 @@ git clone --branch gh-pages [email protected]:pytorch/captum.git captum-gh-pages
# the site or the latest version. Instead, we determine this at runtime.
# We use what's on gh-pages in the versions subdirectory as the
# source of truth for available versions and use the latest tag on
# the master branch as the source of truth for the latest version.
# the main branch as the source of truth for the latest version.

if [[ $VERSION == false ]]; then
echo "-----------------------------------------"
echo "Updating latest (master) version of site "
echo "Updating latest (main) version of site "
echo "-----------------------------------------"

# Populate _versions.json from existing versions; this is used
Expand All @@ -89,12 +89,12 @@ if [[ $VERSION == false ]]; then
CMD="import os, json; "
CMD+="vs = [v for v in os.listdir('captum-gh-pages/versions') if v != 'latest' and not v.startswith('.')]; "
CMD+="print(json.dumps(vs))"
python3 -c "$CMD" > captum-master/website/_versions.json
python3 -c "$CMD" > captum-main/website/_versions.json

# Move versions.js to website subdirectory.
# This is the page you see when click on version in navbar.
cp captum-master/scripts/versions.js captum-master/website/pages/en/versions.js
cd captum-master/website || exit
cp captum-main/scripts/versions.js captum-main/website/pages/en/versions.js
cd captum-main/website || exit

# Build site, tagged with "latest" version; baseUrl set to /versions/latest/
yarn
Expand All @@ -112,7 +112,7 @@ if [[ $VERSION == false ]]; then
cd "${WORK_DIR}" || exit
cp captum-gh-pages/versions/latest/versions.html versions.html
rm -rf captum-gh-pages/versions/latest
mv captum-master/website/build/captum captum-gh-pages/versions/latest
mv captum-main/website/build/captum captum-gh-pages/versions/latest
# versions.html goes both in top-level and under en/ (default language)
cp versions.html captum-gh-pages/versions/latest/versions.html
cp versions.html captum-gh-pages/versions/latest/en/versions.html
Expand All @@ -128,8 +128,8 @@ else
echo "Building new version ($VERSION) of site "
echo "-----------------------------------------"

# Checkout master branch with specified tag
cd captum-master || exit
# Checkout main branch with specified tag
cd captum-main || exit
git fetch --tags
git checkout "${VERSION}"

Expand Down Expand Up @@ -160,15 +160,15 @@ else
# Move built site to new folder (new-site) & carry over old versions
# from existing gh-pages
cd "${WORK_DIR}" || exit
rm -rf captum-master/website/build/captum/docs/next # don't need this
mv captum-master/website/build/captum new-site
rm -rf captum-main/website/build/captum/docs/next # don't need this
mv captum-main/website/build/captum new-site
mv captum-gh-pages/versions new-site/versions

# Build new version of site (to be placed in versions/$VERSION/)
# the only thing that changes here is the baseUrl (for nav purposes)
# we build this now so that in the future, we can just bump version and not move
# previous stable to versions
cd captum-master/website || exit
cd captum-main/website || exit
sed -i '' "s/baseUrl = '\/'/baseUrl = '\/versions\/${VERSION}\/'/g" siteConfig.js

# disable search for non-stable version (can't use sed b/c of newline)
Expand All @@ -188,14 +188,14 @@ else
# newer versions. This is the only part of the old versions that
# needs to be updated when a new version is built.
cd "${WORK_DIR}" || exit
python3 captum-master/scripts/update_versions_html.py -p "${WORK_DIR}"
python3 captum-main/scripts/update_versions_html.py -p "${WORK_DIR}"

# Init as Git repo and push to gh-pages
cd new-site || exit
git init
git add --all
git commit -m "Publish version ${VERSION} of site"
git push --force "https://github.com/pytorch/captum" master:gh-pages
git push --force "https://github.com/pytorch/captum" main:gh-pages

fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/update_versions_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def updateVersionHTML(base_path, base_url=BASE_URL):
with open(base_path + "/captum-master/website/_versions.json", "rb") as infile:
with open(base_path + "/captum-main/website/_versions.json", "rb") as infile:
versions = json.loads(infile.read())

with open(base_path + "/new-site/versions.html", "rb") as infile:
Expand Down
2 changes: 1 addition & 1 deletion scripts/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function Versions(props) {
<tr>
<td>
{'latest'}
{' (master)'}
{' (main)'}
</td>
<td>
<code>
Expand Down
2 changes: 1 addition & 1 deletion website/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const siteConfig = {
docsSideNavCollapsible: false,

// URL for editing docs
editUrl: "https://github.com/pytorch/captum/edit/master/docs/",
editUrl: "https://github.com/pytorch/captum/edit/main/docs/",

// Disable logo text so we can just show the logo
disableHeaderTitle: true,
Expand Down

0 comments on commit cc88299

Please sign in to comment.