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

2.0.0b1: Warning builder.script_files is deprecated. Please use app.add_js_file() instead #6088

Closed
terrisgit opened this issue Feb 18, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@terrisgit
Copy link

commented Feb 18, 2019

When building HTML documentation using Python 3.6, I get the warning :

.venv/lib/python3.7/site-packages/sphinx/builders/html.py:137: RemovedInSphinx30Warning: builder.script_files is deprecated. Please use app.add_js_file() instead.

Sphinx 2.0.0b1
sphinx-rtd-theme 0.4.3
sphinxcontrib-applehelp 1.0.1
sphinxcontrib-devhelp 1.0.1
sphinxcontrib-htmlhelp 1.0.1
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.1
sphinxcontrib-serializinghtml 1.1.1
sphinxcontrib-websupport 1.1.0

@terrisgit terrisgit added the bug label Feb 18, 2019

@tk0miya tk0miya added question and removed bug labels Feb 22, 2019

@tk0miya

This comment has been minimized.

Copy link
Member

commented Feb 22, 2019

This is not a bug. Since 1.6, appending script_files were deprecated. I guess your theme appends
a script via script_files like following:

{% set script_files = script_files + ['/path/to/script.js'] %}

There are two ways as an alternative.

  1. Insert a <script> tag directly in scripts block in your theme.

    {% block scripts %}
       <script type="text/script" src="/path/to/script.js"></script>
    {% endblock %}
    
  2. Use app.add_js_file() API on your conf.py.

    def setup(app):
        app.add_js_file('script.js')
    

    Note: script.js should be placed under html_static_path.

Both are okay.

@terrisgit

This comment has been minimized.

Copy link
Author

commented Feb 22, 2019

This is not in my code. Where would it be coming from? This is a new warning that only appears in 2.0 beta. Is this a problem with the rtd theme? I grepped my source dir and .venv and can’t find any usage of script_files

@tk0miya

This comment has been minimized.

Copy link
Member

commented Feb 22, 2019

Are you using sphinx-rtd-theme, right? If so, it should be fixed on the theme. Could you file a issue to thier project?
It seems they have still used deprecated API.
https://github.com/rtfd/sphinx_rtd_theme/blob/ecbc09f22a076b6ca985f6c5cab0967976dad12a/sphinx_rtd_theme/search.html#L12

@tk0miya

This comment has been minimized.

Copy link
Member

commented Feb 24, 2019

I just updated the warning message because of not understandable (see #6093).
I'm closing this now.

Thanks,

@tk0miya tk0miya closed this Feb 24, 2019

Blendify added a commit to rtfd/sphinx_rtd_theme that referenced this issue Feb 25, 2019

@Blendify

This comment has been minimized.

Copy link
Contributor

commented Feb 25, 2019

Hi I saw this from the mailing list, I opened a PR for our theme and waiting for an approval. See above for a link to the PR.

Blendify added a commit to rtfd/sphinx_rtd_theme that referenced this issue Apr 3, 2019

Remove deprecated use of script_files (#728)
* Remove deprecated use of script_files

Fixes sphinx-doc/sphinx#6088

* Add script block

* Fix build error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.