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

Deprecation: remove "use system packages" (python.system_packages config key and UI checkbox) #10562

Merged
merged 9 commits into from
Aug 22, 2023

Conversation

humitos
Copy link
Member

@humitos humitos commented Jul 24, 2023

This option doesn't work on builds using build.os because the Python binary used it's not the one from the system, but another one compiled via asdf. This means that creating a virtualenv with access to the "system packages" has no effect at all.

This PR removes the feature completely from the UI and also from v1 and v2 config file.

📅 Merging date

This PR has to be deployed on August 29th, so merge it between August 23th and August 28th.

Closes #10500


📚 Documentation previews 📚

This option doesn't work on builds using `build.os` because the Python binary
used it's not the one from the system, but another one compiled via `asdf`.
This means that creating a virtualenv with access to the "system packages" has
no effect at all.

As a first step, I'm removing this option from the documentation to avoid
confusions. Next, we should probably our deprecation policy to contact users
ands  remove it from the code as well.

Closes #10500
@humitos humitos requested a review from a team as a code owner July 24, 2023 09:55
@humitos humitos requested a review from ericholscher July 24, 2023 09:55
@humitos
Copy link
Member Author

humitos commented Jul 27, 2023

Thinking a little more about this, I think we should completely remove it from our code as well since it's broken when using new build.os images (it's not "just deprecated"). I checked the builds from the last 90 days and we have 640 projects using this feature that we should contact before removing it from the code: https://ethicalads.metabaseapp.com/question/228-projects-using-python-site-packages?days=90

So, I'd propose to follow the pattern we have been following:

  • blog post
  • email
  • reach final date (let's say August 29th)
  • delete the code

@ericholscher
Copy link
Member

@humitos I do worry a bit about overwhelming the blog with deprecations. It would be nice to include any things in the config file at the same time, perhaps bundling this with the deprecation of the old build images?

@humitos
Copy link
Member Author

humitos commented Jul 31, 2023

I do worry a bit about overwhelming the blog with deprecations.

I understand your point about this, but I think I have a different point of view here. I believe small changelogs like this one are good usage of our blog. In any case, this is a conversation that's outside the scope of this PR and we can continue in another place.

It would be nice to include any things in the config file at the same time, perhaps bundling this with the deprecation of the old build images?

This may be a good idea, since it's related with the config file itself. However, the "big news" here will be "build.image is deprecated" which won't catch the attention of users using python.system_packages and may skip reading this blog post. On the other hand, users using build.os with python.system_packages will read a blog that's 80% unrelated to them. So, there is a trade off on both paths.

@ericholscher
Copy link
Member

It would be nice to include any things in the config file at the same time, perhaps bundling this with the deprecation of the old build images?

This may be a good idea, since it's related with the config file itself. However, the "big news" here will be "build.image is deprecated" which won't catch the attention of users using python.system_packages and may skip reading this blog post. On the other hand, users using build.os with python.system_packages will read a blog that's 80% unrelated to them. So, there is a trade off on both paths.

I see them as related, at least because folks using system_packages are implicitly depending on the system deps installed on the build image. So it seems like they make sense to bundle together -- also partially just to reduce the total number of deprecations we have to do.

Overall I guess focusing each deprecation on 1 specific issue is probably best for clarity of communication.

@humitos humitos changed the title Docs: do not mention python.system_packages Deprecation: remove "use system package" (python.system_packages config key and UI checkbox) Aug 3, 2023
- Removed from the UI
- Removed from the v1 and v2 config file
@humitos humitos requested a review from a team as a code owner August 3, 2023 12:37
@humitos
Copy link
Member Author

humitos commented Aug 3, 2023

I updated the PR to remove the code completely from our application. I will start writing the email, blog post and script to communicate this deprecation to our users.

@humitos humitos changed the title Deprecation: remove "use system package" (python.system_packages config key and UI checkbox) Deprecation: remove "use system packages" (python.system_packages config key and UI checkbox) Aug 3, 2023
@humitos humitos requested a review from ericholscher August 3, 2023 13:41
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

We should put the date to merge this in the description:

## Merge date: August 29th

This PR looks good, but now users with a python.system_packages key in their settings will just get a generic error right? It feels like we should be linking them to the deprecation blog post and helping them understand the issue, at least?

If that is a lot of work, we can skip it, but I think as a user it's not great UX to have the error message like the setting never existed after this deprecation. I imagine there are example .readthedocs.yaml files in various places online that specify this setting, which people will try to use in the future, for example.

@humitos
Copy link
Member Author

humitos commented Aug 3, 2023

This PR looks good, but now users with a python.system_packages key in their settings will just get a generic error right? It feels like we should be linking them to the deprecation blog post and helping them understand the issue, at least?

This is a good point. It's currently showing,

Screenshot_2023-08-03_17-59-31

I'll see if I can make that message better in a not so-complex way 😄

@humitos humitos requested a review from a team as a code owner August 3, 2023 16:58
@humitos humitos requested a review from agjohnson August 3, 2023 16:58
@humitos
Copy link
Member Author

humitos commented Aug 3, 2023

I was able to show custom messages based on the config key that failed and it wasn't too complex. Besides, it prepares the code for #9008 and similar issues.

It looks like the following now:

Screenshot_2023-08-03_18-39-30

We cannot have links on the URL due to a Knockout.js in the frontend. I left a comment there so we can come back to improve those links in another iteration 😄

@humitos humitos requested a review from ericholscher August 3, 2023 16:58
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

This looks like a good refactor, but I got a bit confused with the structure and what the various template variables are meant to be.

readthedocs/config/config.py Outdated Show resolved Hide resolved
readthedocs/config/config.py Show resolved Hide resolved
readthedocs/config/config.py Outdated Show resolved Hide resolved
{#
I'd like to use ``build.error|urlize`` here, so we can have nice links.
However, this is not possible because we are using `data-bind="text: error"`
which means that Knockout.js will use the `.error` attribute to fill
Copy link
Member

Choose a reason for hiding this comment

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

What error attribute? On the build itself?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor

Choose a reason for hiding this comment

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

If you would like this, we should make the APIv3 response match what we want, perhaps applying the filter on the field in the response there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hrm.. I don't think the API should return blob HTML tags on its response.

Copy link
Contributor

@agjohnson agjohnson Aug 8, 2023

Choose a reason for hiding this comment

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

Similar to templates and HTMX, the front end should only have to display the data from the backend application. I don't think we should have a front end reimplementation of urlize, which is required here to show build.error in the same way the templates would render it.

On the implementation side, I think we should be authoring error message to be a bit more rich than what we're doing now. Relying on urlize results in error message HTML like:

Something happened. See our documentation on webhooks at <a href="https://docs.readthedocs.io/page/something.html">https://docs.readthedocs.io/page/something.html</a>

This is not super user friendly, but is also not accessible either. Using HTML in the error would be better, but does require some translation to HTML at some point:

Something happened. <a href="https://docs.readthedocs.io/page/something.html">Read our documentation on webhooks</a> for more information

This is perhaps another good point for the notification redesign.

Copy link
Member Author

Choose a reason for hiding this comment

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

Similar to templates and HTMX, the front end should only have to display the data from the backend application

I think this is out of discussion. We are not using HTMX which requires specific endpoints for its purpose. Besides, here we are talking about a resource API that exposes data to our users. If we want to start exposing "data to be rendered by the frontend without any modification" that's a whole different use case than what the API was thought for.

In the case we want move in that direction,we will need to add _display fields (or similar) to all the things we want to expose to user as-is.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know we're not using HTMX, but we've talked about this approach specifically. Templates are more applicable then, and maintain a similar opinionated approach. My point is that we should do what we can at the backend in order to keep our frontend footprint low.

I think we talk about this more as part of the notification refactor either way. I just brought this up here to note that replicating urlize in front end code is not a great path forward.

If we want to start exposing "data to be rendered by the frontend without any modification"

I don't feel I'm talking about the same thing here. I am only referring to text with HTML links embedded, not any more structure than that.

Besides, here we are talking about a resource API that exposes data to our users

Well, I'd certainly say our API is dual function. The API needs to be useful for our own application too, it's not just a user resource API.

that's a whole different use case than what the API was thought for

Perhaps, but our application is also a consumer of this API. We don't need all the features exposed to end users though.

But if not the current API, it should be something on the application side. This can be separate, a different API or API-like endpoint, but it should be part of the application. I guess I don't see a strong reason for avoiding APIv3 though.

In the case we want move in that direction,we will need to add _display fields (or similar)

That seems fine, I don't have strong opinions on structure. We're not solving this problem here, so it's worth thinking about more. I'm just noting here as I think we should change our patterns, and the pattern noted in the PR here, in our notification refactor.

readthedocs/config/config.py Show resolved Hide resolved
readthedocs/config/config.py Outdated Show resolved Hide resolved
@humitos humitos requested a review from ericholscher August 7, 2023 10:46
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

I agree this code could be improved with a refactor, but this PR pushes us forward in a useful way, so I'm 👍 on the incremental step, and we can think more deeply about notifications in the project for that.

@humitos humitos added the Status: blocked Issue is blocked on another issue label Aug 7, 2023
humitos added a commit to readthedocs/blog that referenced this pull request Aug 8, 2023
* Post: Drop support for "Use system packages"

Announcement of readthedocs/readthedocs.org#10562

* Update drop-support-system-packages.rst

Co-authored-by: Eric Holscher <[email protected]>

---------

Co-authored-by: Eric Holscher <[email protected]>
readthedocs/config/config.py Outdated Show resolved Hide resolved
@humitos humitos merged commit bcac962 into main Aug 22, 2023
@humitos humitos deleted the humitos/config-system-packages branch August 22, 2023 17:31
@shoyer
Copy link

shoyer commented Aug 29, 2023

Just today I noticed that my project's doc builds are failing with the confusing error Invalid configuration option "python.system_packages". This configuration key has been deprecated and removed.

This was surprising because my config file already explicitly set system_packages: false, which is the new default behavior. Removing this line fixes my build, but I expected I would already have this behavior already...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: blocked Issue is blocked on another issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The virtual environment does not have the system packages as expected
4 participants