Skip to content

Config file: system_site_packages overwritten from project's setting #8783

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

Merged
merged 3 commits into from
Jan 7, 2022

Conversation

humitos
Copy link
Member

@humitos humitos commented Dec 22, 2021

I created a test case to demostrate what was reported in the issue. Summarizing,
if the project uses a config file and does not define python.system_packages
but has Project.use_system_packages=True the config option is True which is
wrong. When a config file is used, settings at Project level should be ignored
as this messages from "Advanced settings" states:

These settings can be configured using a configuration file. That's the
recommended way to set up your project. Settings listed here are ignored when
using a configuration file.

Reference #8782

I created a test case to demostrate what was reported in the issue. Summarizing,
if the project uses a config file and does not define `python.system_packages`
but has `Project.use_system_packages=True` the config option is `True` which is
wrong. When a config file is used, settings at Project level should be ignored
as this messages from "Advanced settings" states:

> These settings can be configured using a configuration file. That's the
recommended way to set up your project. Settings listed here are ignored when
using a configuration file.

Reference #8782
@humitos humitos requested a review from stsewd December 22, 2021 09:21
@humitos humitos requested a review from a team as a code owner December 22, 2021 09:21
@humitos
Copy link
Member Author

humitos commented Dec 22, 2021

If I understand correctly, we are defining the defaults with values coming from the project object itself, which I think it's wrong:

'use_system_packages': project.use_system_packages,

I think all those defaults should be the defaults we have documented in https://docs.readthedocs.io/en/stable/config-file/v2.html and not the values defined at project object (from the Admin). @stsewd am I right?

@stsewd
Copy link
Member

stsewd commented Jan 3, 2022

@humitos most of those default values are used in the v1 config file. But this one should always default to false

with self.catch_validation_error('python.system_packages'):
system_packages = self.defaults.get(
'use_system_packages',
False,
)
system_packages = self.pop_config(
'python.system_packages',
system_packages,
)
python['use_system_site_packages'] = validate_bool(system_packages)

@humitos
Copy link
Member Author

humitos commented Jan 4, 2022

@stsewd I don't follow you. The code that I linked seems to be used by config v2 as well, right? If we need different default values for v1 and v2 we should reflect that creating different dictionaries, right?

@stsewd
Copy link
Member

stsewd commented Jan 4, 2022

@humitos that use_system_packages from v2 shouldn't use self.defaults, it should always default to false.

@humitos
Copy link
Member Author

humitos commented Jan 4, 2022

@stsewd I pushed a commit with the change. Is it correct? I assume my test should pass now.

@humitos humitos merged commit 3eccde7 into master Jan 7, 2022
@humitos humitos deleted the humitos/system-packages branch January 7, 2022 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants