my sphinx rtd themed documentation builds locally, fails building when posting to rtd? - python-sphinx

OH GEEZ
the extension is "myst**_**parser" and the library is myst-parser. The only thing better would be if somewhere else I had written mystParser...
Thank you
Steve - I don't use StackOverflow a lot. Is there something I need to do to recognize? that you provided the answer?
Add myst_parser to reqirements.txt. –
Steve Piercy
5 hours ago
sphinx-autobuild works great locally. I send my project to github with sphinx documentation (as .md files) within the /docs folder. Post to RTD web site. Fails. myst-parser is in requirements.txt.?
sphinx.errors.ExtensionError: Could not import extension myst_parser (exception: No module named 'myst_parser')
.readthedocs.yaml
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.9"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
# golang: "1.17"
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf
# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
reqirements.txt
alabaster==0.7.12
Babel==2.11.0
bleach==5.0.1
build==0.9.0
certifi==2022.9.24
cffi==1.15.1
charset-normalizer==2.1.1
colorama==0.4.6
commonmark==0.9.1
cryptography==38.0.4
docopt==0.6.2
docutils==0.17.1
idna==3.4
imagesize==1.4.1
importlib-metadata==5.1.0
influxdb==5.3.1
jaraco.classes==3.2.3
jeepney==0.8.0
Jinja2==3.1.2
keyring==23.11.0
livereload==2.6.3
markdown-it-py==2.1.0
MarkupSafe==2.1.1
mccabe==0.7.0
mdit-py-plugins==0.3.1
mdurl==0.1.2
more-itertools==9.0.0
msgpack==1.0.4
myst-parser==0.18.1
packaging==21.3
paho-mqtt==1.6.1
pep517==0.13.0
pipreqs==0.4.11
pkginfo==1.9.1
pycodestyle==2.10.0
pycparser==2.21
pyflakes==3.0.1
Pygments==2.13.0
pyparsing==3.0.9
python-dateutil==2.8.2
pytz==2022.6
PyYAML==6.0
readme-renderer==37.3
requests==2.28.1
requests-toolbelt==0.10.1
rfc3986==2.0.0
rich==12.6.0
SecretStorage==3.3.3
six==1.16.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-autobuild==2021.3.14
sphinx-rtd-theme==1.1.1
sphinx_design==0.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==2.0.1
tornado==6.2
twine==4.0.1
typing_extensions==4.4.0
urllib3==1.26.13
webencodings==0.5.1
yarg==0.1.9
zipp==3.11.0
conf.py
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import os
import sys
# Add the code path
sys.path.insert(0, os.path.abspath('../code'))
project = 'GrowBuddies'
copyright = '2022, HappyDay'
author = 'HappyDay'
release = '2022.12.0'
# ignore files
exclude_patterns = ["py_env/*", '**/_*']
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = ['sphinx.ext.autodoc', 'myst-parser', 'sphinx.ext.autosectionlabel', 'sphinx_design']
# Make sure the target is unique
autosectionlabel_prefix_document = True
# Include methods that start with an _
napoleon_include_private_with_doc = True
# Add Myst extensions
myst_enable_extensions = ["colon_fence", "html_image"]
# Needed for font awesome support using the sphinx-design extension.
html_css_files = [
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
]
# Ignore documentating these files.
autodoc_mock_imports = ['influxdb', 'paho']
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']

myst-parser is the name of the Python package. However, the name of the Python module once installed is myst_parser. You need to specify myst_parser in conf.py (not myst-parser).

Related

readthedocs build fails to produce sphinx documentation with shields.io svg badges

My latest Sphinx documentaion fails when trying to build it with readthedocs. It has apperently something to do with the fact that I am trying to incorporate some badges from https://shields.io/. These badges are .svg graphic files.
I probably need to do some tweaking in my conf.py file?
On my local machine, I am able to produce the Sphinx documentation and all HTML files do look OK.
Here's an excerpt of my conf.py file:
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"nbsphinx",
"numpydoc",
"sphinx.ext.autodoc",
"sphinx_copybutton",
"sphinx.ext.napoleon",
]
napoleon_google_docstring = False
napoleon_numpy_docstring = True
numpy_validation_checks = {all}
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
Here's the text output: https://readthedocs.org/api/v2/build/17082650.txt
Although you may have disabled the epub and PDF builds in the RTD UI, you must take note in the RTD UI under Advanced Settings > Default settings:
These settings can be configured using a configuration file. That's the recommended way to set up your project. Settings listed here are ignored when using a configuration file.
Therefore you must be using a configuration file that enables both pdf and epub builds. Lo and behold:
https://github.com/andreas-vester/df2img/blame/3ba6e046c8d30ab3896b23835513740bd5aa97fa/.readthedocs.yaml#L12-L14
formats:
- pdf
- epub

Unable to authenticate with Confluence server for Sphinx documentation

I am using sphinx for building documentation in confluence.I am able to make html file using sphinx. But when I am trying to connect confluence using the "make confluence" command it's throwing an error
I checked by changing the confluence password and checked using API token still getting the error and unable to connect with confluence.
Ref link-
https://github.com/Shravankumarhiregoudar/sphinxDocumentation
conf.py file:
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.append('/home/4px/sphinx/scripts/')
# -- Project information -----------------------------------------------------
project = 'sites'
copyright = '2021, divyank'
author = 'divyank'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinxcontrib.confluencebuilder'
]
confluence_publish = True
confluence_space_name = 'Documentation'
##confluence_ask_password = True
#confluence_parent_name = 'API Documentation'
# (for Confluence Cloud)
confluence_server_url = 'https://<....>.atlassian.net/wiki/spaces'
confluence_server_user = '<....>'
confluence_server_pass = '<.......>'
# (or, for Confluence Server)
#confluence_server_url = 'https://intranet-wiki.example.com/'
#confluence_server_user = 'myawesomeuser'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns=[]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'default'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
'preamble': '',
# Latex figure (float) alignment
'figure_align': 'htbp',
}
Error:
WARNING: normalizing confluence url from https://<......>.atlassian.net/wiki/ to https://<.......>.atlassian.net/wiki/
sphinxcontrib.confluencebuilder error:
---
Unable to authenticate with the Confluence server.
Ensure your username and password are correct. If your username and password is correct, you may need to unlock your Confluence account be re-logging in with your browser or asking your Confluence administrator for help.
---
make: *** [confluence] Error 2
I am able to resolve this issue using API token in the confluence password field in conf.py file.
How to generate API token-
Manage API tokens for your Atlassian account
Ref link-
Unable to authenticate with the Confluence server using sphinxcontrib.confluencebuilder

How to import Markdown with Sphinx and myst-parser into Readthedocs?

In my docs/source/conf.py I have this code:
extensions = [
"sphinx.ext.autodoc",
"myst_parser",
]
source_suffix = ['.rst', '.md']
All my files are in Markdown, not in reStructuredText.
On ReadTheDocs, the initial build was successful technically, only until the modules page was "not found" and the index page is completely blank.
My .readthedocs.yaml:
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
# Optionally build your docs in additional formats such as PDF
formats: all
# Optionally set the version of Python and requirements required to build your docs
python:
version: "3.8"
install:
- method: pip
path: .
extra_requirements:
- docs
My setup.cfg contains this:
[options.extras_require]
docs =
sphinx
myst-parser
Of course, doing make clean html in docs/ works completely fine. Not sure why ReadTheDocs cannot properly link to the rest of the.md files from index.md.
I solved it. I checked the build logs, turns out I have some syntax errors (I did list[str] not List[str] with from typing import List)

"There was a YAML syntax error"... "mapping values are not allowed in this context"

There are so many posts describing this same error, and I have tried to read them all to find out exactly what is causing my error.
I have tried mangling this file eleven different ways, even reverting it back to the original file - still no luck. What am I missing?
The error is supposedly on "line 3 column 22" - which does not exist. I have no jekyll parser on the client side, everything is being handled through GitHub Pages.
https://github.com/drovani/drovani.github.io/commits/master/_config.yml
#
# This file contains configuration flags to customize your site
#
# Name of your site (displayed in the header)
name: "Rovani in C#"
# Short bio or description (displayed in the header)
description: "Ostinato, Pensato, Scordatura"
# URL of your avatar or profile pic (you could use your GitHub profile pic)
avatar: https://avatars3.githubusercontent.com/u/898478
#
# Flags below are optional
#
# Includes an icon in the footer for each username you enter
footer-links:
dribbble:
email: dev#rovani.net
facebook:
flickr:
github: drovani
instagram:
linkedin:
pinterest:
rss: # just type anything here for a working RSS icon
twitter: davidrovani
stackoverflow: "users/28310/drovani"
youtube: # channel/<your_long_string> or user/<user-name>
googleplus: # anything in your profile username that comes after plus.google.com/
# Enter your Disqus shortname (not your username) to enable commenting on posts
# You can find your shortname on the Settings page of your Disqus account
disqus: drovani
# Enter your Google Analytics web tracking code (e.g. UA-2110908-2) to activate tracking
google_analytics: UA-82341148-1
# Your website URL (e.g. http://barryclark.github.io or http://www.barryclark.co)
# Used for Sitemap.xml and your RSS feed
url:
# If you're hosting your site at a Project repository on GitHub pages
# (http://yourusername.github.io/repository-name)
# and NOT your User repository (http://yourusername.github.io)
# then add in the baseurl here, like this: "/repository-name"
baseurl: ""
#
# !! You don't need to change any of the configuration flags below !!
#
permalink: /:title/
# The release of Jekyll Now that you're using
version: v1.2.0
# Jekyll 3 now only supports Kramdown for Markdown
kramdown:
# Use GitHub flavored markdown, including triple backtick fenced code blocks
input: GFM
# Jekyll 3 and GitHub Pages now only support rouge for syntax highlighting
syntax_highlighter: rouge
syntax_highlighter_opts:
# Use existing pygments syntax highlighting css
css_class: 'highlight'
# Set the Sass partials directory, as we're using #imports
sass:
style: :expanded # You might prefer to minify using :compressed
# Use the following plug-ins
gems:
- jekyll-sitemap # Create a sitemap using the official Jekyll sitemap gem
- jekyll-feed # Create an Atom feed using the official Jekyll feed gem
# Exclude these files from your production _site
exclude:
- Gemfile
- Gemfile.lock
- LICENSE
- README.md
- CNAME
Instead of the issue being in the _config.yml file, it was in a completely different file altogether. So, if you get this error message from building a github-pages Jekyll page, don't assume that it is in the only "YAML" file. Search any new file that you have added for a Line 3 Column 22 and that will track down the error.
In my case, it was a title for a post in the front matter had a colon with a space after it - which I needed to put double-quotes around.

JRUBY - RAILS 3 - TOMCAT 7 Deploy failed

I have my rails 3 app. This work fine in netbeans with webrick.
I create this application with:
Jruby jruby 1.6.5.1 (ruby-1.8.7-p330)
Rails 3.1.3
My bundle work fine.
Mi gemfile:
gem 'rails', '3.1.3'
gem 'dynamic_form'
gem 'activerecord-jdbcmysql-adapter'
gem 'jruby-openssl'
gem 'json'
group :assets do
gem 'sass', '~> 3.1.12'
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
For create .war file from application, I have installed with bundle all gem required.
I have installed wrable and run
wrable config
and then
wrable
This create the .war file.
I put this file on the webapps tomcat7 directory and start the server.
Server starting fine, catalina.out logs no errors but...
When I try to go at the address when tomcat manager says is my application, I have more time to attendo for view just a withe page. the application name is "cameraAccreditiGiornalisti". So, the address is localhost:8080/cameraAccreditiGiornalisti => white page!
I read all guides in the web but I not say where is the problem!! Not have a log to look and the white page... no error!
Please help!
I have the same problem, I found out that war file does not include web.xml file, which is necessary for Tomcat to start up the webapp. I did not found any info why warble does not generate that file, as it should.
my problem solved... I read a wrong log file.... Maybe for your problem check the file warble.rb in projectdirectory/config. This is my and work:
# Disable Rake-environment-task framework detection by uncommenting/setting to false
# Warbler.framework_detection = false
# Warbler web application assembly configuration file
Warbler::Config.new do |config|
# Features: additional options controlling how the jar is built.
# Currently the following features are supported:
# - gemjar: package the gem repository in a jar file in WEB-INF/lib
# - executable: embed a web server and make the war executable
# - compiled: compile .rb files to .class files
# config.features = %w(gemjar)
# Application directories to be included in the webapp.
config.dirs = %w(app config lib log vendor tmp)
# Additional files/directories to include, above those in config.dirs
# config.includes = FileList["db"]
# Additional files/directories to exclude
# config.excludes = FileList["lib/tasks/*"]
# Additional Java .jar files to include. Note that if .jar files are placed
# in lib (and not otherwise excluded) then they need not be mentioned here.
# JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
# own versions if you directly set the value
# config.java_libs += FileList["lib/java/*.jar"]
# Loose Java classes and miscellaneous files to be included.
# config.java_classes = FileList["target/classes/**.*"]
#config.java_classes = FileList["log4j.properties"]
# One or more pathmaps defining how the java classes should be copied into
# the archive. The example pathmap below accompanies the java_classes
# configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
# for details of how to specify a pathmap.
# config.pathmaps.java_classes << "%{target/classes/,}p"
# Bundler support is built-in. If Warbler finds a Gemfile in the
# project directory, it will be used to collect the gems to bundle
# in your application. If you wish to explicitly disable this
# functionality, uncomment here.
# config.bundler = false
# An array of Bundler groups to avoid including in the war file.
# Defaults to ["development", "test"].
# config.bundle_without = []
# Other gems to be included. If you don't use Bundler or a gemspec
# file, you need to tell Warbler which gems your application needs
# so that they can be packaged in the archive.
# For Rails applications, the Rails gems are included by default
# unless the vendor/rails directory is present.
# config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
# config.gems << "tzinfo"
config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
# Uncomment this if you don't want to package rails gem.
# config.gems -= ["rails"]
# The most recent versions of gems are used.
# You can specify versions of gems by using a hash assignment:
#
config.gems["rails"] = "3.2.1"
# You can also use regexps or Gem::Dependency objects for flexibility or
# finer-grained control.
# config.gems << /^merb-/
# config.gems << Gem::Dependency.new("merb-core", "= 0.9.3")
# Include gem dependencies not mentioned specifically. Default is
# true, uncomment to turn off.
# config.gem_dependencies = false
# Array of regular expressions matching relative paths in gems to be
# excluded from the war. Defaults to empty, but you can set it like
# below, which excludes test files.
# config.gem_excludes = [/^(test|spec)\//]
# Pathmaps for controlling how application files are copied into the archive
# config.pathmaps.application = ["WEB-INF/%p"]
# Name of the archive (without the extension). Defaults to the basename
# of the project directory.
# config.jar_name = "mywar"
# Name of the MANIFEST.MF template for the war file. Defaults to a simple
# MANIFEST.MF that contains the version of Warbler used to create the war file.
# config.manifest_file = "config/MANIFEST.MF"
# When using the 'compiled' feature and specified, only these Ruby
# files will be compiled. Default is to compile all \.rb files in
# the application.
# config.compiled_ruby_files = FileList['app/**/*.rb']
# === War files only below here ===
# Path to the pre-bundled gem directory inside the war file. Default
# is 'WEB-INF/gems'. Specify path if gems are already bundled
# before running Warbler. This also sets 'gem.path' inside web.xml.
# config.gem_path = "WEB-INF/vendor/bundler_gems"
# Files for WEB-INF directory (next to web.xml). This contains
# web.xml by default. If there is an .erb-File it will be processed
# with webxml-config. You may want to exclude this file via
# config.excludes.
# config.webinf_files += FileList["jboss-web.xml"]
# Files to be included in the root of the webapp. Note that files in public
# will have the leading 'public/' part of the path stripped during staging.
# config.public_html = FileList["public/**/*", "doc/**/*"]
# Pathmaps for controlling how public HTML files are copied into the .war
# config.pathmaps.public_html = ["%{public/,}p"]
# Value of RAILS_ENV for the webapp -- default as shown below
config.webxml.rails.env = ENV['RAILS_ENV'] || 'production'
# Application booter to use, one of :rack, :rails, or :merb (autodetected by default)
# config.webxml.booter = :rails
# Set JRuby to run in 1.9 mode.
# config.webxml.jruby.compat.version = "1.9"
# When using the :rack booter, "Rackup" script to use.
# - For 'rackup.path', the value points to the location of the rackup
# script in the web archive file. You need to make sure this file
# gets included in the war, possibly by adding it to config.includes
# or config.webinf_files above.
# - For 'rackup', the rackup script you provide as an inline string
# is simply embedded in web.xml.
# The script is evaluated in a Rack::Builder to load the application.
# Examples:
# config.webxml.rackup.path = 'WEB-INF/hello.ru'
# config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
# config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
# Control the pool of Rails runtimes. Leaving unspecified means
# the pool will grow as needed to service requests. It is recommended
# that you fix these values when running a production server!
# config.webxml.jruby.min.runtimes = 2
# config.webxml.jruby.max.runtimes = 4
config.webxml.jruby.min.runtimes = 2
config.webxml.jruby.max.runtimes = 4
# JNDI data source name
# config.webxml.jndi = 'jdbc/rails'
end

Resources