Skip to content

Commit

Permalink
Move sphinx deps to requirmeents.txt files
Browse files Browse the repository at this point in the history
This moves the sphinx python dependencies into requirments.txt files,
which are easeir for dependabot to scan.
  • Loading branch information
JordonPhillips committed Mar 13, 2024
1 parent 1f9ced3 commit 3ad3d4b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import software.amazon.smithy.model.node.ObjectNode;
import software.amazon.smithy.model.node.StringNode;
import software.amazon.smithy.model.shapes.ServiceShape;
import software.amazon.smithy.utils.IoUtils;
import software.amazon.smithy.utils.SmithyInternalApi;
import software.amazon.smithy.utils.SmithyUnstableApi;
import software.amazon.smithy.utils.StringUtils;
Expand Down Expand Up @@ -93,18 +94,9 @@ public final class SphinxIntegration implements DocIntegration {
private static final Logger LOGGER = Logger.getLogger(SphinxIntegration.class.getName());

// The default requirements needed to build the docs.
private static final List<String> BASE_REQUIREMENTS = List.of(
"Sphinx==7.2.6",
"sphinx_inline_tabs==2023.4.21",
"sphinx-copybutton==0.5.2",
"Pygments==2.16.1",
"sphinx-design==0.5.0"
);
private static final List<String> FURO_REQUIREMENTS = List.of("furo==2023.9.10");
private static final List<String> MARKDOWN_REQUIREMENTS = List.of(
"myst-parser==2.0.0",
"linkify-it-py==2.0.2"
);
private static final List<String> BASE_REQUIREMENTS = parseRequirements("requirements-base.txt");
private static final List<String> FURO_REQUIREMENTS = parseRequirements("requirements-furo.txt");
private static final List<String> MARKDOWN_REQUIREMENTS = parseRequirements("requirements-markdown.txt");

private static final List<String> BASE_EXTENSIONS = List.of(
"sphinx_inline_tabs",
Expand All @@ -117,6 +109,13 @@ public final class SphinxIntegration implements DocIntegration {

private SphinxSettings settings = SphinxSettings.fromNode(Node.objectNode());

private static List<String> parseRequirements(String filename) {
String requirementsFile = IoUtils.readUtf8Resource(SphinxIntegration.class, "sphinx/" + filename);
return requirementsFile.lines()
.filter(line -> line.stripLeading().startsWith("#"))
.collect(Collectors.toList());
}

@Override
public String name() {
return "sphinx";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# These are base requirements needed for any sphinx project output.
Sphinx==7.2.6
sphinx_inline_tabs==2023.4.21
sphinx-copybutton==0.5.2
Pygments==2.16.1
sphinx-design==0.5.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These are requirements only needed for the base furo theme
furo==2023.9.10
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are requirements needed for sphinx projects with markdown support.
myst-parser==2.0.0
linkify-it-py==2.0.2

0 comments on commit 3ad3d4b

Please sign in to comment.