Skip to content

Commit

Permalink
Fix version switching (#590)
Browse files Browse the repository at this point in the history
* Fix version switching

* fix version number

* Update contributing guide

* Update conf.py
  • Loading branch information
nwlandry authored Sep 9, 2024
1 parent 5b08511 commit 112df1c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion HOW_TO_CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Please note we have a [code of conduct](/CODE_OF_CONDUCT.md), please follow it i

1. Make sure that the Github Actions workflow runs without any errors.
2. Using the `github-changelog` package (a dependency in the [release](requirements/release.txt) requirements file), run `changelog -m xgi-org xgi [last release tag]` to get the merged pull requests with their links. Paste this into the changelog file under a new heading and edit to make more legible. Associate a GitHub username with each pull request.
3. Increase the version number in [\_\_init\_\_.py](xgi/__init__.py.py) and [conf.py](docs/source/conf.py) to the new version agreed upon by the core developers. The versioning scheme we use is [SemVer](http://semver.org/).
3. Increase the version number in [\_\_init\_\_.py](xgi/__init__.py.py) to the new version agreed upon by the core developers. The versioning scheme we use is [SemVer](http://semver.org/).
4. Commit these changes.
5. Create a new release on GitHub by selecting "Releases", then clicking "Draft a new release". Click "Choose a tag" and type "v" followed by the version number and then click "Create new tag". The release title will be this same string. Paste the contents of the CHANGELOG into the "Describe this release" field. Click "Publish release".
6. Run `python -m build` from the main folder. This will create a zipped file to upload to PyPI and save it to the "dist" folder.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ html[data-theme="light"] table.data tbody tr:nth-child(even) {
}
/* Remove whitespace to the right of the xgi logo */
.bd-header .navbar-header-items__start {
width: 100px;
width: 130px;
}
4 changes: 2 additions & 2 deletions docs/source/_static/version_switcher.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"name": "latest",
"version": "latest",
"name": "dev",
"version": "dev",
"url": "https://xgi.readthedocs.io/en/latest/"
},
{
Expand Down
1 change: 1 addition & 0 deletions docs/source/_templates/navbar-version.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ version }}
33 changes: 25 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@

import requests

import xgi

sys.path.insert(0, os.path.abspath("."))
sys.path.append(os.path.join(os.path.dirname(__name__), "xgi"))


# -- Project information -----------------------------------------------------
project = "XGI"
copyright = f"2021-{date.today().year} XGI Developers"
release = "0.8.10"
version = release
version = xgi.__version__

# -- General configuration ---------------------------------------------------

Expand Down Expand Up @@ -173,12 +174,33 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the

version_match = os.environ.get("READTHEDOCS_VERSION")

# If READTHEDOCS_VERSION doesn't exist, we're not on RTD
if not version_match:
version_match = "dev"

# If it is an integer, we're in a PR build and the version isn't correct.
elif version_match.isdigit():
version_match = "dev"

# If it's "latest" → change to "dev" (that's what we want the switcher to call it)
elif version_match == "latest":
version_match = "dev"

else:
version_match = "stable"

if version_match == "dev":
version = "dev"

# documentation.
html_theme_options = {
"logo": {
"image_light": "../../logo/logo.svg",
"image_dark": "../../logo/logo_white.svg",
},
"navbar_start": ["navbar-logo", "navbar-version"],
"navbar_end": [
"theme-switcher",
"navbar-icon-links",
Expand All @@ -195,18 +217,13 @@
"url": "https://twitter.com/xginets",
"icon": "fab fa-twitter-square", # Font Awesome icon
},
{
"name": "Mastodon",
"url": "https://mathstodon.xyz/@xginets",
"icon": "fa-brands fa-mastodon", # Font Awesome icon
},
],
"header_links_before_dropdown": 4,
"switcher": {
"json_url": (
"https://xgi.readthedocs.io/en/latest/_static/version_switcher.json"
),
"version_match": "latest" if "dev" in version else version,
"version_match": version_match,
},
}

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ More information about the datasets and how to load them is in the `XGI-DATA men
Get involved
==================

To simply getting news and updates, you can sign up for our `mailing list <http://eepurl.com/igE6ez>`_ and follow XGI on `Twitter <https://twitter.com/xginets>`_ or `Mastodon <https://mathstodon.xyz/@xginets>`_!
To simply getting news and updates, you can sign up for our `mailing list <http://eepurl.com/igE6ez>`_ and follow XGI on `Twitter <https://twitter.com/xginets>`_!

If you want to contribute, even better! The XGI community always welcomes contributions, no matter how small.
For more information, see our `contribution guide <contribute.html>`_.
Expand Down

0 comments on commit 112df1c

Please sign in to comment.