Implementation Questions [TeachBooks Package Development] #28
Replies: 2 comments 2 replies
-
I don't know the answers to any of this. |
Beta Was this translation helpful? Give feedback.
-
Yeah that's good common practice when people use the code from github directly. It's not needed as much if people only work with releases (pypi/github releases) as then they would not use the branch version of the code. The alternative is to leave
I wouldn't call these "global constants". Globals are something completely different in programming.
You can setup a config manager. This should be quite straightforward. The builtin python library import yaml
# define defaults
config = {"path1": "test/test", "path2": "test/abc"} # these can also be in a yaml file in the teachbooks package, for consistency.
# update config with info from yaml (replace the string with text read from a file)
config.update(yaml.safe_load("path1: test/def")) It would be good to add some validation after loading so you can rely on some paths being there or other settings not breaking the workflow elsewhere.
Easily extendable pre- and post-processing would be great to have! Although if those pre/post processors need a certain order of execution (e.g., applying
You can use entrypoints. They are a bit complex to set up the first time, but once you got the first one working and you have an example how to use it it becomes quite straightforward. |
Beta Was this translation helpful? Give feedback.
-
first specific requests:
@CasparJungbacker would be happy to hear your opinion! Also, my apologies for making your code much much more ugly and sloppy than the original version. Any ideas on how to improve that are welcome . At least there are a few more tests now :)
@Tom-van-Woudenberg maybe you have an opinion on item no. 1 and 4?
@BSchilperoort your opinion is always welcome! But if short on time, maybe a quick check if any of these things below would conflict with your toc tool?
Explanation
I recently finished some improvements to the CLI. For example, PR 44 improves
teachbooks serve
. Along the way I acquired questions for how to implement/modify the package in the future, and I would like your thoughts on how!dev
branch collects improvements via PR's which become releases asdev
is merged intomain
. Can set up a PR fromdev
intomain
with a title like "Next release". If interested in commenting on local computer setup for development, see Discussion 49../book/.teachbooks/
to./.teachbooks/
as Issue 41 made it clear that the./book/
directory was not a good place to keep it (this can change for non-standard repo setups).serve
command now uses global constants (./teachbooks/__init__.py
) to enforce default directory structures for an arbitrary book setup (./book/
) and build directory (./book/_build/html/
), as well as the server working directory (.teachbooks/server/
). Does anyone object to using global constants?./_teachbooks_config.yml
would be best, but I am not sure where it would be "used"...would a good approach be to process it in./teachbooks/__init__.py
and then save the global constants (and anything else that comes along) in a state file in the temp directory./.teachbooks/
?jupyter book build book
. I think this is OK for now, but some time in the future we may need to formalize how this works.Beta Was this translation helpful? Give feedback.
All reactions