RunestoneComponents
RunestoneComponents copied to clipboard
More config values for Runcstone components
This is a continuation of the work done in PR #592. Two new config values (configurable in conf.py) are introduced:
- mchoice_compare_button_show - if False, hide the 'Compare me' button in mchoice (default True)
- fitb_compare_button_show - if False, hide the 'Compare me' button in fitb (default True)
Thanks,
These are useful configuration parameters, especially for someone running their own book on their own server. When used in the Runestone.Academy mode, then these don't help, as everyone uses the same book, but with different configuration parameters populated into eBookConfig when the page is served.
We are working hard toward keeping our documentation up to date as well as improving our coverage on the selenium based unit tests for each component.
Could you please update the docstrings for the affected directives, and where possible add a unit test to exercise your new changes.
Thanks.
@bnmnetp docstrings updates are in the second commit of the pull request.
I've took a look to existing test cases and I'm not sure how to alter config values (in conf.py) between test cases. Existing test cases should be enough for testing default config values (components behaves like before for default config values), but for more detailed testing we need different builds for different test cases.
I agree. One way to do this is to add a directory named RunestoneComponents/runestone/fitb/test_1
which is mostly a copy of RunestoneComponents/runestone/fitb/test
, but has updated conf.py
values and updated test_fitb.py
contents to make sure the Compare Me button isn't rendered.
@bjones1 -- This seems like it would be another use case for the context manager we did for the settings with @presnick
We would need to generalize it a bit but it seems much better than duplicating everything.
Alternatively, I think we can also use the -c
option to sphinx-build to specify an alternative config.py file. We would just need some way to tell the tests to rebuild
@bjones1 @bnmnetp We may also consider to alter config values in build-time between different fitb
directive visitings. There are several ideas how to do that: make special testing-purposed directive to alter app.config/env.config (app.config['fitb_compare_button_show'] = ...
) or use a callable value as a config value (def fitb_compare_button_show(c): ...
instead of fitb_compare_button_show = ...
) or both. I've tool a look to the Sphinx source, both __setitem__
and implicit invoke of a callable value in __getattr__
are impmeneted in the Config class: https://github.com/sphinx-doc/sphinx/blob/44c49f462c91870c0ef5e3e7dba74cba3edb8e12/sphinx/config.py#L246.
We in the Loop Foundation (Fondacija Petlja) are currently focused on new and updated online books for the new school year and will be able to continue our work on compatibility PRs in a month or two (including test cases in this PR). Our plan is to become compatible with the original RunestoneComonents (with our additional extensions) and stop to depend on the forked repo.
BTW, Our extensions are also open sourced and we will be ready to port-back some features to RunestoneComponets. We are going to publish English version of some of our online books and then we will be able to show how those additional features work in practice.
@vasiljevic That sounds great. The more we can collaborate the more progress we can all make. I found your site (https://petlja.org) and I hope can adopt some of the nice updates you have made to the user interface.
Hmmm, I like the callable approach -- it would allow us to change the config value on a per-problem basis. I could image creating a directive called update-config
or something, with use like:
.. update-config::
:config_value_name: updated_value
That should be pretty easy to implement. Let me know if you want help doing that -- I've written several directives. The directive might need to modify a callable, as you mention, since I seem to recall that the app.config
values aren't (easily) changable.
Hi @vasiljevic I just wanted to come back to this, as my semester has started and I'm getting into a schedule. I would love to collaborate with you on your changes and take advantage of some of the great work you have done on improving the components.
How is your schedule these days?
Hello @bnmnetp, sorry for my late response. Our new team member @maric993 is now assigned to this pull request. He currently works on test cases and will continue to work on authoring tools including further contributions to the upstream project.
BTW, here is our interactive book in Englih: https://petlja.github.io/TxtProgInPythonEng/ (repo: https://github.com/Petlja/TxtProgInPythonEng)
Late summer and autumn is our annual peak of activity since we provide learning materials and teacher training for the new school year.
this is great, thanks.
@bjones1 can you take a look at this one?
Will do.
Let me know if we can improve anything else.