Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.devtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.devtools
Commits
65c14c46
Commit
65c14c46
authored
4 years ago
by
Amir MOHAMMADI
Browse files
Options
Downloads
Patches
Plain Diff
Add a sphinx command to help with migrating to sphinx 3
parent
f86e9e9e
No related branches found
No related tags found
1 merge request
!188
Add a sphinx command to help with migrating to sphinx 3
Pipeline
#45159
passed
4 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/devtools/scripts/sphinx.py
+58
-0
58 additions, 0 deletions
bob/devtools/scripts/sphinx.py
setup.py
+1
-0
1 addition, 0 deletions
setup.py
with
59 additions
and
0 deletions
bob/devtools/scripts/sphinx.py
0 → 100644
+
58
−
0
View file @
65c14c46
import
click
@click.group
()
def
sphinx
():
pass
@sphinx.command
()
@click.argument
(
"
sphix_configuration
"
,
default
=
"
doc/conf.py
"
,
type
=
click
.
Path
(
exists
=
True
,
dir_okay
=
False
),
required
=
False
,
)
def
migrate_autodoc_flags
(
sphix_configuration
):
with
open
(
sphix_configuration
)
as
f
:
config
=
f
.
read
()
config
=
config
.
replace
(
"""
autodoc_default_flags = [
'
members
'
,
'
undoc-members
'
,
'
show-inheritance
'
,
]
"""
,
"""
autodoc_default_options = {
"
members
"
: True,
"
undoc-members
"
: True,
"
show-inheritance
"
: True,
}
"""
,
)
config
=
config
.
replace
(
"""
# We want to remove all private (i.e. _. or __.__) members
# that are not in the list of accepted functions
accepted_private_functions = [
'
__array__
'
]
def member_function_test(app, what, name, obj, skip, options):
# test if we have a private function
if len(name) > 1 and name[0] ==
'
_
'
:
# test if this private function should be allowed
if name not in accepted_private_functions:
# omit privat functions that are not in the list of accepted private functions
return skip
else:
# test if the method is documented
if not hasattr(obj,
'
__doc__
'
) or not obj.__doc__:
return skip
return False
def setup(app):
app.connect(
'
autodoc-skip-member
'
, member_function_test)
"""
,
""
,
)
with
open
(
sphix_configuration
,
"
w
"
)
as
f
:
f
.
write
(
config
)
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
0
View file @
65c14c46
...
...
@@ -52,6 +52,7 @@ setup(
"
dav = bob.devtools.scripts.dav:dav
"
,
"
local = bob.devtools.scripts.local:local
"
,
"
gitlab = bob.devtools.scripts.gitlab:gitlab
"
,
"
sphinx = bob.devtools.scripts.sphinx:sphinx
"
,
],
"
bdt.gitlab.cli
"
:
[
"
badges = bob.devtools.scripts.badges:badges
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment