Design Discussion: build and generate #501
Closed
oscarlevin
started this conversation in
General
Replies: 1 comment 1 reply
-
Just quickly chiming in to apologize for dropping off the past few days - been working on preparing for MathFest and POSE proposal stuff. My goal is to be back in dev mode by this afternoon's dropin. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As part of the refactor, I've been thinking about separation of concerns for the basic functionality of the CLI. This is most prevalent with
build
andgenerate
, althoughview
anddeploy
might require some attention too.Right now, when a user runs
pretext build
, we first run through thebuild
function ofcli.py
, whichproject.generate
(which will becometarget.generate
)project.build
(soontarget.build
)Then the class methods in
project/__init__.py
take over. This entails:build
function frombuild.py
(either a single one or one based on the format)Then the
build
function ofbuild.py
:build.py
.html()
) then makes the output directory if needed, does some reporting, and then in a working directory context, calls thecore.[format-name]
function.The story for
generate
is almost the same, except the last step also specifies some formats based on the target-format, and re-verifies that anything needs to be done at all (this seems unnecessary).I don't like having to look in three or four spots to find where each check, message, directory-making occurs. It seems like we should be able to eliminate the
build.py
andgenerate.py
functions by making them methods of thetarget
class. However, that makes the target class really bulky. I've seem some options for pulling these functions into their own files (inside theproject
module/directory), the simplest being to just include these in the__init__.py
file. Another option would be to do some sort of subclass thing, but I'm not seeing what the objects would be.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions