Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Add submodule configuration #47

Closed
wants to merge 5 commits into from

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Mar 22, 2018

Closes #30 and probably also closes others issues on the rtd repo.

I'm adding only tests for now, hope the behavior for submodules is fine.

The checklist:

  • Add test for config
  • Add integration tests (that integrates with the others configs for now, the real integration would be on the rtd repo, right? or should I write one here?)
  • Implement the submodules validation
  • Update the spec documentation (is it necessary to do it here or maybe just update https://docs.readthedocs.io/en/latest/yaml-config.html?)

source_file = tmpdir.join('subdir', 'readthedocs.yml')
build = get_build_config({}, source_file=str(source_file))
build.validate_submodules()
# TODO: This will be the dafult behavior?
Copy link
Member Author

Choose a reason for hiding this comment

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

What I mean here is: on other parts of the code, when the key is not given, it doesn't get added to the build dict, and then the default values are chosen by rtd, I think with that current behavior we are repeating some logic.

with tmpdir.as_cwd():
build = get_build_config({
'submodules': {
'exclude': 'all',
Copy link
Member

Choose a reason for hiding this comment

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

If when submodules key is not present we are defaulting to include all of them, we need to support exclude: all --otherwise, how we say that we don't want to checkout submodules>

Copy link
Member Author

Choose a reason for hiding this comment

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

We do it with include: []

Copy link
Member Author

Choose a reason for hiding this comment

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

Still would be necessary exclude: all? I think it's more clear with the other form only.

Copy link
Member

Choose a reason for hiding this comment

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

To me, include: [] doesn't have a good meaning and it's confusing. It's more explicit to say exclude: all from my understanding.

assert build['submodules']['include'] == []
assert build['submodules']['recursive'] is False

def it_parses_explicit_wrong_defaults(tmpdir):
Copy link
Member Author

Choose a reason for hiding this comment

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

What would be the behavior for this case? Should be an error? Ignore this? or change the value of recursive to False (this is implemented on this test case)?

@stsewd stsewd force-pushed the submodule-implementation branch from a287a17 to 8115e5e Compare March 23, 2018 05:08


__all__ = (
'load', 'BuildConfig', 'ConfigError', 'InvalidConfig', 'ProjectConfig')


CONFIG_FILENAMES = ('readthedocs.yml', '.readthedocs.yml')
ALL = 'all'
Copy link
Member Author

Choose a reason for hiding this comment

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

It's fine this constant here?

@@ -168,6 +172,7 @@ def validate(self):
self.validate_base()
self.validate_python()
self.validate_formats()
self.validate_submodules()
Copy link
Member Author

Choose a reason for hiding this comment

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

It's fine triggering the validation here?

else:
submodules['include'] = validate_list(include)
self.validate_directories(submodules['include'])
if not submodules['include']:
Copy link
Member Author

Choose a reason for hiding this comment

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

Forcing to be always false if include: []

)
return True

def get_default_submodules_config(self):
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 would be different for the previous projects

submodules:
  include: all
  recursive: true

And probably this would be managed by the rtd code...

@stsewd
Copy link
Member Author

stsewd commented Jun 13, 2018

@agjohnson should we merge this first? Or maybe port this once the repo is moved? (I think the second option is better since we can really test this)

@agjohnson
Copy link
Contributor

I agreed that porting over after the merge makes the most sense. I'll set this to blocking for now, but feel free to move over the PR whenever things are ported to rtd core.

@agjohnson agjohnson added the Status: blocked Issue is blocked on another issue label Jun 19, 2018
@agjohnson agjohnson modified the milestone: yaml Jun 19, 2018
@stsewd
Copy link
Member Author

stsewd commented Aug 2, 2018

This PR was ported to the another repo in readthedocs/readthedocs.org#4355

@stsewd stsewd closed this Aug 2, 2018
@stsewd stsewd deleted the submodule-implementation branch August 2, 2018 17:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Status: blocked Issue is blocked on another issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add submodule configuration
3 participants