Skip to content
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

Fix for publishing prereleases #974

Merged
merged 1 commit into from Oct 4, 2022

Conversation

jarrodmillman
Copy link
Collaborator

@jarrodmillman jarrodmillman commented Oct 4, 2022

Fix #973.

This should fix https://github.com/pydata/pydata-sphinx-theme/actions/runs/3182801089.

I tested on my laptop and it works. I am not sure if the leading slash is ever needed. The tests pass when it is removed, but I am not sure why it was there to begin with.

In [1]: from pathlib import Path

In [2]: srcdir = '/home/jarrod/src/pydata-sphinx-theme'

In [3]: json_url = '/_static/switcher.json'

In [4]: Path(srcdir, json_url)
Out[4]: PosixPath('/_static/switcher.json')

In [5]: json_url = '_static/switcher.json'

In [6]: Path(srcdir, json_url)
Out[6]: PosixPath('/home/jarrod/src/pydata-sphinx-theme/_static/switcher.json')

The error is triggered in src/pydata_sphinx_theme/__init__.py here:

        if urlparse(json_url).scheme in ["http", "https"]:
            content = requests.get(json_url).text
        else:
            content = Path(env.srcdir, json_url).read_text()

when Path(env.srcdir, json_url).read_text() sets content to '/_static/switcher.json instead of something like /home/jarrod/src/pydata-sphinx-theme/_static/switcher.json.

@jarrodmillman jarrodmillman added this to the 0.11 milestone Oct 4, 2022
@jarrodmillman
Copy link
Collaborator Author

I will make 0.11rc2 if this fix looks good.

Copy link
Collaborator

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@choldgraf choldgraf merged commit b4d08d5 into pydata:main Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs] switcher.json isn't found on rc or dev versions of this theme
2 participants