Skip to content

Add support for autodoc in develop2 #2492

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

Merged
merged 15 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM python:slim
FROM conanio/ci-docs

COPY requirements.txt /tmp/

RUN apt-get update \
&& apt-get install -y enchant-2 git make latexmk texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra \
&& pip3 install --requirement /tmp/requirements.txt
RUN pip3 install --requirement /tmp/requirements.txt

18 changes: 15 additions & 3 deletions .ci/test.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
node('Linux') {
String alphaReleaseBranch = 'release/2.0.0-alpha'
boolean publishDocs = env.BRANCH_NAME == alphaReleaseBranch
def targetBranch = env.CHANGE_BRANCH

// We also have to clone conan sources for the sphinx autodoc extension
def conanBranch = (targetBranch == alphaReleaseBranch) ? 'release/2.0-alpha' : 'develop2'
def conan_repo_url = 'https://github.com/conan-io/conan.git'
echo "Docs target branch: ${targetBranch}"
echo "Conan target branch: ${conanBranch}"

stage('Clone sources') {
checkout scm
def cloneConan = "git clone --single-branch -b ${conanBranch} --depth 1 ${conan_repo_url} conan_sources"
sh(script: cloneConan)
}

def image = null
Expand All @@ -16,17 +25,20 @@ node('Linux') {
stage('Test build') {
parallel html: {
image.inside {
sh 'make html'
// for some reason even adding this to autodoc_mock_imports
// does not work, se we have to install the real dependency
sh(script: 'pip3 install colorama')
sh(script: 'make html')
}
},
pdf: {
image.inside {
sh 'make latex'
sh(script: 'make latex')
}
},
spelling: {
image.inside {
sh 'make spelling'
sh(script: 'make spelling')
}
},
linkcheck: {
Expand Down
27 changes: 20 additions & 7 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@
from shutil import copyfile
import json

# path to the conan_sources, they must be cloned to the branch
# that we are building the docs for
# if building the docs in local, point this to the local conan_sources

path_to_conan_sources = './conan_sources'

# 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.

sys.path.insert(0, os.path.abspath('./_themes'))
sys.path.insert(0, os.path.abspath(path_to_conan_sources))



# -- General configuration ------------------------------------------------
Expand All @@ -35,12 +42,21 @@
# ones.
extensions = [
'sphinx.ext.todo',
'conan',
'sphinxcontrib.spelling',
'sphinx_sitemap',
'notfound.extension',
'sphinx.ext.autodoc',
]

# autodoc configuration
add_module_names = False
autoclass_content = 'both'
autodoc_mock_imports = ["PyJWT", "requests", "urllib3", "PyYAML",
"patch-ng", "fasteners", "six", "node-semver", "distro",
"pygments", "tqdm", "Jinja2", "MarkupSafe", "Jinja2",
"python-dateutil", "configparse", "patch_ng", "yaml", "semver", "dateutil"]


# The short X.Y version.
version = "2.0-alpha"
# The full version, including alpha/beta/rc tags.
Expand Down Expand Up @@ -104,7 +120,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build', '**/site-packages']
exclude_patterns = ['_build', '**/site-packages', 'conan_sources/**.rst']

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand Down Expand Up @@ -134,14 +150,11 @@
todo_include_todos = True


# -- Options for HTML output ----------------------------------------------
import conan

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# html_theme = 'sphinx_rtd_theme'
html_theme = "conan"
html_theme_path = conan.get_html_theme_path()
html_theme_path = ["_themes"]


# Theme options are theme-specific and customize the look and feel of a theme
Expand Down
1 change: 1 addition & 0 deletions reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Reference

reference/commands
reference/python_api
reference/tools
17 changes: 17 additions & 0 deletions reference/python_api.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
Python API
==========

.. toctree::
:maxdepth: 2

python_api/ConanAPIV2
python_api/RemotesAPI
python_api/SearchAPI
python_api/ListAPI
python_api/ProfilesAPI
python_api/InstallAPI
python_api/GraphAPI
python_api/ExportAPI
python_api/RemoveAPI
python_api/ConfigAPI
python_api/NewAPI
python_api/UploadAPI
python_api/DownloadAPI
17 changes: 17 additions & 0 deletions reference/python_api/ConanAPIV2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Conan API Reference
===================

.. include:: api_warning.rst

.. currentmodule:: conan.api.conan_api

.. autoclass:: ConanAPIV2
:members:


Read more
---------

- Creating Conan custom commands
- ...

9 changes: 9 additions & 0 deletions reference/python_api/ConfigAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Config API
==========

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.config

.. autoclass:: ConfigAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/DownloadAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Download API
============

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.download

.. autoclass:: DownloadAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/ExportAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Export API
==========

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.export

.. autoclass:: ExportAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/GraphAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Graph API
=========

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.graph

.. autoclass:: GraphAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/InstallAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Install API
===========

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.install

.. autoclass:: InstallAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/ListAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
List API
========

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.list

.. autoclass:: ListAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/NewAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
New API
=======

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.new

.. autoclass:: NewAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/ProfilesAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Profiles API
============

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.profiles

.. autoclass:: ProfilesAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/RemotesAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Remotes API
===========

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.remotes

.. autoclass:: RemotesAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/RemoveAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Remove API
==========

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.remove

.. autoclass:: RemoveAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/SearchAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Search API
==========

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.search

.. autoclass:: SearchAPI
:members:
9 changes: 9 additions & 0 deletions reference/python_api/UploadAPI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Upload API
==========

.. include:: api_warning.rst

.. currentmodule:: conan.api.subapi.upload

.. autoclass:: UploadAPI
:members:
2 changes: 2 additions & 0 deletions reference/python_api/api_warning.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.. warning::
The Conan API is experimental and subject to breaking changes.
31 changes: 31 additions & 0 deletions reference/tools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. _conan_tools:

tools
=====

Tools are all things that can be imported and used in Conan recipes.

The import path is always like:

.. code-block:: python

from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake
form conan.tools.microsoft import MSBuildToolchain, MSBuildDeps, MSBuild


The main guidelines are:

- Everything that recipes can import belong to ``from conan.tools``. Any other thing is private implementation
and shouldn't be used in recipes.
- Only documented, public (not preceded by ``_``) tools can be used in recipes.


Contents:

.. toctree::
:maxdepth: 2

tools/cmake
tools/env
tools/build
tools/files
11 changes: 11 additions & 0 deletions reference/tools/build.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _conan_tools_build:

conan.tools.build
=================

conan.tools.build.cross_building()
----------------------------------

.. currentmodule:: conan.tools.build.cross_building

.. autofunction:: cross_building
12 changes: 12 additions & 0 deletions reference/tools/cmake.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _conan_tools_cmake:

conan.tools.cmake
=================

.. toctree::
:maxdepth: 2

cmake/cmakedeps
cmake/cmaketoolchain
cmake/cmake
cmake/cmake_layout
12 changes: 12 additions & 0 deletions reference/tools/cmake/cmake.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _conan-cmake-build-helper:

CMake
-----

Reference
=========

.. currentmodule:: conan.tools.cmake.cmake

.. autoclass:: CMake
:members:
8 changes: 8 additions & 0 deletions reference/tools/cmake/cmake_layout.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _cmake_layout:

cmake_layout
------------

.. currentmodule:: conan.tools.cmake.layout

.. autofunction:: cmake_layout
13 changes: 13 additions & 0 deletions reference/tools/cmake/cmakedeps.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _CMakeDeps:

CMakeDeps
---------

Reference
=========

.. currentmodule:: conan.tools.cmake.cmakedeps.cmakedeps

.. autoclass:: CMakeDeps
:members:

10 changes: 10 additions & 0 deletions reference/tools/cmake/cmaketoolchain.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CMakeToolchain
--------------

Reference
=========

.. currentmodule:: conan.tools.cmake.toolchain.toolchain

.. autoclass:: CMakeToolchain
:members:
Loading