Skip to content
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

Docs: build.jobs reference documentation #9056

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/user/config-file/v2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,42 @@ We don't currently support PPA's or other custom repositories.
When possible avoid installing Python packages using apt (``python3-numpy`` for example),
:ref:`use pip or Conda instead <guides/reproducible-builds:pinning dependencies>`.


build.jobs
``````````

Commands to be run before or after a Read the Docs pre-defined job.
This allows you to run custom commands at a particular moment in the build process.
Comment on lines +425 to +426
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Commands to be run before or after a Read the Docs pre-defined job.
This allows you to run custom commands at a particular moment in the build process.
Commands to be run before or after a Read the Docs pre-defined build step.
This allows you to run custom commands at various times in the build process.
A few common use cases for this area:
* Modifying the state of the checkout of your repository
* Stopping a build by returning a non-zero exit code on certain conditions
* Running a command to process generate markup files prior to building

Thinking more about this, we probably need to define this feature a lot more explicitly in the docs somewhere, particularly around exit codes.

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't mention use cases here because none of the other config keys do that. Instead, I suggested writing a guide explaining what are the known use cases we have already and expanding on each of them clearly.

I see this page as reference documentation that only explains what are the possible/valid config keys and values of each of them, but it does not talk about use cases. I'd include the link to that guide page here once we write it, tho, as we do with build.tools.python and the Conda Support link (https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python)

What do you think?



.. code-block:: yaml

version: 2

build:
os: ubuntu-22.04
Copy link
Member

Choose a reason for hiding this comment

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

Should we make this a string for consistency?

Suggested change
os: ubuntu-22.04
os: "ubuntu-22.04"

Copy link
Member Author

Choose a reason for hiding this comment

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

This one, in particular, is not required to be a string. However, we can declare it as it. We should change the other one as well where I copied it from https://docs.readthedocs.io/en/stable/config-file/v2.html#build

tools:
python: "3.10"
jobs:
pre_create_environment:
- echo "Command run at 'pre_create_environment' step"
post_build:
- echo "Command run at 'post_build' step"
- echo `date`

.. note::

Each key under ``build.jobs`` must be a list of strings.
Copy link
Member

Choose a reason for hiding this comment

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

I don't really know what this means. Can we communicate it more explicitly somehow? What else would users try to do here, that might be wrong?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm trying to avoid users writing something like

build:
  jobs:
    post_install: pip install mypackage

when it should be

build:
  jobs:
    post_install: 
      - pip install mypackage



:Type: ``dict``
Copy link
Member

Choose a reason for hiding this comment

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

Seems like the above note is probably better noted here?

:Allowed keys: ``post_checkout``, ``pre_system_dependencies``, ``post_system_dependencies``,
``pre_create_environment``, ``post_create_environment``, ``pre_install``, ``post_install``,
``pre_build``, ``post_build``
:Required: ``false``
:Default: ``{}``


sphinx
~~~~~~

Expand Down