Skip to content

refactor: drop direct dependency on Boost.Spirit (graphviz parser) - #533

Merged
Becheler merged 1 commit into
boostorg:developfrom
Becheler:refactor/drop-spirit-dependency
Aug 31, 2026
Merged

refactor: drop direct dependency on Boost.Spirit (graphviz parser)#533
Becheler merged 1 commit into
boostorg:developfrom
Becheler:refactor/drop-spirit-dependency

Conversation

@Becheler

@Becheler Becheler commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Before submitting

  • This PR targets the develop branch.
  • I searched for an existing PR or issue covering the same change.
  • My contribution is licensed under the Boost Software License 1.0.

Type of change

  • Bug fix
  • New feature or API addition
  • Refactor (no behavior change)
  • Documentation
  • Build, CI, or tooling
  • Other (specify below)

Does this PR introduce a breaking change?

  • Yes (describe migration impact below)
  • No

What this PR does

  • graphviz.hpp: removed both Boost.Spirit code paths in the two read_graphviz overloads (they now always call read_graphviz_new)
  • dropped the unconditional classic_multi_pass Spirit include.
  • BOOST_GRAPH_USE_SPIRIT_PARSER still recognized, but now emits a BOOST_PRAGMA_MESSAGE deprecation notice and redirects to the default parser instead of selecting Spirit.
  • Deleted detail/read_graphviz_spirit.hpp (the Spirit DOT reader that pulled in 10 boost/spirit headers).
  • test/isomorphism.cpp: removed the incidental #define BOOST_GRAPH_USE_SPIRIT_PARSER
  • build.jam and CMakeLists.txt dropped the spirit dependency.

Motivation

The spirit-based graphviz parser has been non default, undocumented and untested for 16 years.
The Boost.Spirit library has 28 direct boost dependencies, and 54 indirect, effectively dragging most of Boost in BGL: https://alandefreitas.github.io/boostdep_graph/libs/spirit.html

This PR removes its implementation, effectively dropping spirit dependency and its direct+transitive chain.

The default parser uses Boost.Regex, that has a much better dependency chain: https://alandefreitas.github.io/boostdep_graph/libs/regex.html

Note: spirit is not effectively removed from the transitive dependencies chain, as Boost.Serialization pulls it in.
A next PR will drop Boost.Serialization for Boost.Core.Serialization.

Note: Boost.Spirit has several dependants that Boost.Graph uses:

  • Boost.PropertyTree
  • Boost.MPI

Testing

Checklist

  • Existing tests pass (b2 in the test/ directory).
  • New behavior is covered by a test, or this is a docs / build / refactor change.
  • Documentation was updated if user-facing behavior changed.
  • No new compiler warnings on the platforms I built against.

@Becheler Becheler self-assigned this Jul 17, 2026
@Becheler Becheler added the technical debt Code that works but needs refactoring, cleanup, or modernization. Not user-facing. label Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

Compiler-warning counts vs develop (auto-generated).
PR run 32455841293 vs develop run 32455728113 (233a8a4316).

Job Baseline After Delta
macos (clang, 14) 703 703 0
macos (clang, 17) 663 663 0
macos (clang, 20) 663 663 0
ubuntu (clang-19, 14) 703 703 0
ubuntu (clang-19, 17) 663 663 0
ubuntu (clang-19, 20) 663 663 0
ubuntu (clang-19, 23) 663 663 0
ubuntu (gcc-14, 14) 874 874 0
ubuntu (gcc-14, 17) 1010 1010 0
ubuntu (gcc-14, 20) 1010 1010 0
ubuntu (gcc-14, 23) 1010 1010 0
windows_msvc_14_3 (msvc-14.3) 962 962 0

@Becheler
Becheler marked this pull request as ready for review July 17, 2026 11:05
@Becheler
Becheler requested a review from jeremy-murphy as a code owner July 17, 2026 11:05
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

Boost dependency footprint vs develop (auto-generated).
PR run 33410598370 vs develop run 33397888958 (92470302c3).

Header-inclusion weights (graph files pulling each direct dependency in):

Dependency develop PR Δ
spirit 2 0 -2
config 94 93 -1
core 15 14 -1
function 2 1 -1
property_map 80 79 -1
throw_exception 11 10 -1
type_traits 42 41 -1

Transitive Boost modules: 66 → 66 (0)

@Becheler Becheler changed the title refactor: remove boost.spirit graphviz parser refactor: drop dependency on Boost.Spirit (graphviz parser) Jul 21, 2026
@Becheler Becheler changed the title refactor: drop dependency on Boost.Spirit (graphviz parser) refactor: drop direct dependency on Boost.Spirit (graphviz parser) Jul 21, 2026
@Becheler
Becheler force-pushed the refactor/drop-spirit-dependency branch 2 times, most recently from 6679ea9 to 0478c2d Compare August 7, 2026 19:17
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Becheler
Becheler force-pushed the refactor/drop-spirit-dependency branch from 0478c2d to 4a49846 Compare August 11, 2026 09:25
@Becheler
Becheler force-pushed the refactor/drop-spirit-dependency branch from 4a49846 to 233a8a4 Compare August 21, 2026 06:47
@Becheler Becheler added the dependencies Pull requests that update a dependency file label Aug 24, 2026

@mborland mborland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Very straightforward, and helps remove a heavy dependency.

@Becheler
Becheler force-pushed the refactor/drop-spirit-dependency branch from 233a8a4 to 9247030 Compare August 31, 2026 15:48
@Becheler
Becheler merged commit e55bde3 into boostorg:develop Aug 31, 2026
32 checks passed
@Becheler
Becheler deleted the refactor/drop-spirit-dependency branch August 31, 2026 18:05

@jeremy-murphy jeremy-murphy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One pedantic post-merge request. :)

#ifndef BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS
#define BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS
BOOST_PRAGMA_MESSAGE(
"BOOST_GRAPH_USE_SPIRIT_PARSER is deprecated and no longer has any effect: "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Deprecated" means that something still exists (and works) but its use is not recommended, so it's not really the right meaning here. I think that text can simply be removed.

Suggested change
"BOOST_GRAPH_USE_SPIRIT_PARSER is deprecated and no longer has any effect: "
"BOOST_GRAPH_USE_SPIRIT_PARSER no longer has any effect: "

@Becheler Becheler Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! Fixed in #584
I added a comment with deprecated and 1.95 because I will use this in a grep tag to track what must be removed in 1.95.

@jeremy-murphy

Copy link
Copy Markdown
Collaborator

Boost dependency footprint vs develop (auto-generated). PR run 33410598370 vs develop run 33397888958 (92470302c3).

Header-inclusion weights (graph files pulling each direct dependency in):

Dependency develop PR Δ
spirit 2 0 -2
config 94 93 -1
core 15 14 -1
function 2 1 -1
property_map 80 79 -1
throw_exception 11 10 -1
type_traits 42 41 -1
Transitive Boost modules: 66 → 66 (0)

So, removing Boost.Spirit didn't actually remove our dependency on any transitive modules?

@Becheler

Becheler commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

Correct, and it was expected (see the Notes in the PR description), because as long as Boost.PropertyTree is still a direct dependency, it will pull both Boost.Spirit and Boost.Serialization into the transitive dependency chain (those two libs are 55/68 = 80% of the dependency chain weight)

#547 Aims at getting rid of that, with additional benefits:

  • x3.5 faster runtime
  • x3.7 less memory
  • faster compilation time

I am running benchmarks on project compilation times before/after dependencies removal as we speak (compile time dominated by transitive header count). The figure is still a bit shitty, but interesting and kinda confirms that graphviz pulls half the boost galaxy and motivated #566 :

image

@jeremy-murphy

Copy link
Copy Markdown
Collaborator

#547 Aims at getting rid of that, with additional benefits:

x3.5 faster runtime
x3.7 less memory
faster compilation time

For what part of the library exactly? Just for GraphML or more broadly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file technical debt Code that works but needs refactoring, cleanup, or modernization. Not user-facing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants