-
Notifications
You must be signed in to change notification settings - Fork 356
feat(main): New Testcontainers Python Docs Site #822
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
feat(main): New Testcontainers Python Docs Site #822
Conversation
…he standard docs pages for python
…es section pages, fix some formatting issues
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #822 +/- ##
=======================================
Coverage ? 85.46%
=======================================
Files ? 12
Lines ? 688
Branches ? 110
=======================================
Hits ? 588
Misses ? 75
Partials ? 25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Converting to draft to address community module test issues and the diff has some changes branched off of #814 so I could verify everything was running locally. |
0221ee2 to
33a4365
Compare
33a4365 to
1fc72d5
Compare
This reverts commit a6bdf0e.
🤖 I have created a release *beep* *boop* --- ## [4.12.0](testcontainers-v4.11.0...testcontainers-v4.12.0) (2025-07-21) ### Features * **main:** New Testcontainers Python Docs Site ([#822](#822)) ([a6bdf0e](a6bdf0e)) * make config monkeypatchable, fix config related startup issues ([#833](#833)) ([ff6a32d](ff6a32d)) * **modules:** add OpenFGA module ([#762](#762)) ([0b7b482](0b7b482)) * set multiple variables via keyword args ([#804](#804)) ([1532df5](1532df5)) ### Bug Fixes * **core:** mypy ([#810](#810)) ([b816762](b816762)) * Enable mypy in the CI ([#842](#842)) ([ef65bd1](ef65bd1)) * just use the getLogger API and do not override logger settings ([#836](#836)) ([f467c84](f467c84)) ### Documentation * missing compose html from old docs ([#776](#776)) ([d749fc6](d749fc6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
I find it unfortunate that this MR was merged without prior discussion. In my view, switching the project’s documentation system from Sphinx to MkDocs is a significant architectural change that warrants broader consensus. The current documentation stack is built around Sphinx, including its AutoAPI integration and the use of doctests. The latter is particularly valuable, as it ensures that the examples in the documentation are executable and remain correct over time. If Markdown is a requirement, Sphinx already provides first-class support via its Markdown parser, so adopting MkDocs is not the only path forward. Additionally, introducing a From a Python developer’s perspective, a well-structured Sphinx documentation is both familiar and easier to navigate than a custom, project-specific documentation style. I am not convinced that this change meaningfully improves onboarding for new users, who are likely already accustomed to standard Python documentation tooling. Just my two cents. |
|
@CarliJoy readthedocs where the docs were hosted does not support anything but requirements.txt, i think the problem is there rather than here |
|
Ah, I see — my mistake. That said, even considering the examples in the Read the Docs documentation for both Sphinx and MkDocs, the More generally, my original concern still stands: moving to MkDocs introduces several drawbacks with, in my view, limited tangible benefits. Is there a concrete technical advantage of using MkDocs over Sphinx for this project? Key features we currently (or previously) benefit from with Sphinx include:
In addition, Sphinx offers extensive theming capabilities, including several solid default themes and a large ecosystem of community-maintained themes. This makes it entirely feasible to achieve a look and feel similar to the “official” Testcontainers documentation, if that is a goal. So my question to @alexanderankin is: would you be open to accepting a PR that converts the documentation introduced in this MR back to Sphinx? Related to that, how important is it for this project that the documentation style aligns with the “official” Testcontainers pages? I notice, for example, that the Rust Testcontainers documentation also uses a custom-looking style. I am not sure I will personally have the capacity to work on such a conversion in the near future, but it might be something another contributor could pick up — or something I could revisit later. In any case, it would be good to understand upfront whether such a PR would be welcome, as no one wants to invest time into work that is unlikely to be accepted. |
|
Working on a different PR I just saw that given example for casandra does not work and results in Traceback (most recent call last):
File "testcontainers-python/modules/cassandra/example_basic.py", line 153, in <module>
basic_example()
File "testcontainers-python/modules/cassandra/example_basic.py", line 14, in basic_example
port = cassandra.get_exposed_port(cassandra.port)
^^^^^^^^^^^^^^
AttributeError: 'CassandraContainer' object has no attribute 'port'. Did you mean: 'ports'?Just showing that doctests are important. |
Hello all!
I've been working on getting a new and improved docs site for Testcontainers Python. This docs site aligns it with Testcontainers Java/Go/.NET/Node which will hopefully help users onboard and adopt Testcontainers more easily.
Testing fork deploys can be seen here, I'm also lining up the official builds to live on the python.testcontainers.org name space! 👀
https://exquisite-dusk-036c28.netlify.app/
Why?
We (Docker) want to support the Python community! A big improvement opportunity I saw was the current docs site compared to some of the other languages. Adopting the same template and builds will help keep use inline with the other and hopefully make Testcontainers Python easier to adopt by providing a starting point with more guide style content.
Usage and Details
The old Sphinx site has been left untouched for now (TBD by the community if it's provided value imo). This is a large change for writing documentation on the lib. There is now a
/docsfolder filler with markdown files rather then being powered only by code comments. The left hand navigation is controlled by a new yml file on the root of the project calledmkdocs.yml.Rather then using Sphinx to parse code comments, with mkdocs you can include example python files to go with the documentation. I've created community module usage examples beside their implementation called
example_basic.pybut people can make other example files in the source as well. The linter is ignoring files withexample_in them to ease builds for the docs purposes (and missing dependencies that may not matter).In the documentation site you can them import your examples via
Content was largely generated by reading the source code with an editing pass from one of Docker's technical writers.
Running / Editing the Docs Site Locally
A new Testcontainer python docs Dockerfile lives in the root of the project which handles the docssite specific dependencies. The container will build and serve the site for you.
make serve-docsHow Documentation Will Deploy
It's Netlify powered. We can configure it to do preview deploys per PR and deploy a new site on merge to main. Unfortunately Netlify doesn't support Poetry so to keep the builds simple there is a requirements.txt for explicitly the docs site dependency.
The Contents of the New Documentation
As mentioned briefly in the opening we used AI to help generate the content of the site by reading the source code, myself and Arthur also did some human passes to ensure things read well, but clearly more help from people ensuring the accuracy will come over time. Once the new docs site is merged into main and hosting is fully working I think we should post in the community slack and ask for feedback, the two docs sites will run concurrently before officially launching (replacing) the current docs site.