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

[DEPR]: Paver #34467

Open
16 of 20 tasks
Tracked by #35144 ...
kdmccormick opened this issue Apr 3, 2024 · 18 comments
Open
16 of 20 tasks
Tracked by #35144 ...

[DEPR]: Paver #34467

kdmccormick opened this issue Apr 3, 2024 · 18 comments
Assignees
Labels
depr Proposal for deprecation & removal per OEP-21

Comments

@kdmccormick
Copy link
Member

kdmccormick commented Apr 3, 2024

ℹ️ This DEPR ticket considers the Paver commands in two groups:

  • Operator-facing commands, which were accepted for deprecation back in May 2023, and then rolled into this general Paver DEPR ticket. These are the commands that operators need to migrate away from.
  • Internal CI commands, which will be replaced at the leisure of the edx-platform maintenance team. They should not affect operators in any way.

Timeline

Communicated

Operator-facing commands: 2023-03-08 (thread)
Internal CI commands: 2024-05-01 (thread)

Acceptance

Operator-facing commands: 2023-05-03
Internal CI commands: 2024-05-21

Replacement available

Operator-facing commands: 2024-05-07, Redwood
Internal CI commands: ~2024-11-09, early Teak (Target)

Earliest removal

Operator-facing commands: 2024-11-09, early Teak
Internal CI commands: as soon as replacement is available

Rationale

edx-platform historically handled its build scripts with paver:

Paver is a Python-based software project scripting tool along the lines of Make or Rake. It is not designed to handle the dependency tracking requirements of, for example, a C program. It is designed to help out with all of your other repetitive tasks (run documentation generators, moving files about, downloading things), all with the convenience of Python’s syntax and massive library of code.

Using paver has a few problems:

  • Paver adds dependencies to edx-platform: Paver follows the Python packaging model, so anything that's a dependency of edx-platform's pavelib suite becomes a dependency of edx-platform itself. In addition to the paver package, this means that we install libsass-python in production, which takes 60+ seconds (!) to compile and install.
  • Paver makes Python a requirement for all build actions: When your build tooling runs on Python, then you need a Python environment in order to do anything, even things that don't involve Python (including building static assets, running JS tests, etc.). This harms the cachability of edx-platform Dockerfiles, because it means that any change to the Python requirements list will invalidate any build steps used by Paver.
  • Paver is indirect: Paver basically just wraps shell commands that you could have run directly, adding a layer of complexity and potential bugs. Build scripts are ideally very simple--unlike application code, repetition is preferable to abstraction; they should be easy to write, easy to read, and easy to throw away and replace if necessary. Standard tools like Makefiles, Bash scripts, and Dockerfiles all encourage and excel at this sort of simplicity; Paver does not.
  • Paver is idiosyncratic: Unlike Make and Bash, Paver is not at all a standard part of a programmer's toolset, so it makes edx-platform less approachable for new contributors. Even for programmers who want to script in Python, Click is significantly more popular, well-documented, and user-friendly.

For the Paver Asset commands in particular, more depth is provided in the 'Reimplement edx-platform static asset processing' ADR.

Replacement

Module Replacement
assets New static assets guide
quality Directly invoking tools (pylint, etc.) when possible, Makefile targets otherwise
test_js Makefile target
prereqs pip
docs Makefile target
i18n Makefile targets for common tasks; i18n_tool for advanced tasks
servers Tutor (or the deprecated Docker-based Devstack, or bare-metal development

Migration

To ease migration for Paver users, in Redwood, each Paver Asset command will simply proxy to its replacement command, and will raise a deprecation warning explaining the new command that it is running.

By Nov 9th 2024, operators will need to have switched to the new commands, taking the steps indicated below by ACTION REQUIRED.

Requirements (Operators: ACTION REQUIRED)

In Redwood and earlier, Paver and its dependencies were included in requirements/edx/base.txt

Starting in Sumac, these dependencies will be removed from requirements/edx/base.txt. Instead, operators will need to install:

  • requirements/edx/assets.txt to build static assets
  • requirements/edx/testing.txt to run Python tests and linting
  • requirements/edx/base.txt download translations and collect static assets

Operator-facing commands with known users (Operators: ACTION REQUIRED)

These replacements are production-ready as of May 7th, for Redwood.

Module Known Users Before After
assets Ansible, Devstack paver update_assets npm run build && ./manage.py lms collectstatic --noinput && ./manage.py cms collectstatic
assets None paver process_xmodule_assets No longer needed - no replacement
assets Tutor, pavelib paver compile_sass npm run compile-sass
assets pavelib ./manage.py [lms/cms] compile_sass npm run compile-sass
assets pavelib paver webpack npm run webpack
assets Devstack paver watch_assets npm run watch
prereqs Ansible, Devstack, pavelib paver install_prereqs pip install -r requirements/edx/base.txt -r requirements/edx/assets.txt && npm clean-install
prereqs pavelib paver install_node_prereqs npm clean-install
prereqs pavelib paver uninstall_python_packages Will not be replaced
prereqs pavelib paver install_coverage_prereqs pip install -r requirements/edx/coverage.txt
prereqs pavelib paver install_python_prereqs pip install -r requirements/edx/base.txt

Operator-facing commands without known users

These commands have been replaced for a long time. We don't know of any users of them, except the old Vagrant Devstack, which was deprecated 8 years ago.

Module Before After
docs paver build_docs make docs
i18n paver i18n_validate_gettext which xgettext
i18n paver i18n_extract make extract_translations
i18n paver i18n_dummy i18n_tool dummy && i18n_tool generate
i18n paver i18n_generate i18n_tool generate
i18n paver i18n_generate_strict i18n_tool generate --strict
i18n paver i18n_clean make clean_translations
servers paver check_settings None
servers paver lms ./manage.py lms runserver
servers paver studio ./manage.py cms runserver
servers paver run_all_servers tutor local ...
servers paver devstack tutor dev ...

Internal CI commands

These commands are only used by the upstream openedx project for CI. They will replaced before Sumac. Operators do not need to take action.

Module Replacement Status Before After
quality This is a no-op paver find_fixme Remove
quality Need to implement paver run_eslint eslint
quality Need to implement paver run_stylelint make stylelint_js
quality Need to implement paver run_xsslint make xsslint
quality Need to implement paver run_pii_check make pii_check
quality Need to implement paver check_keywords make check_keywords
quality Ready to use paver run_quality Remove
quality Ready to use paver run_pylint pylint
quality Need to implement paver run_pep8 pycodestyle
js_test Need to implement paver diff_coverage make diff_coverage_js
js_test Need to implement paver test_js make test_js
js_test Need to implement paver test_js_run make test_js
js_test Need to implement paver test_js_dev make test_js MODE=browser

Django settings for Asset commands (Operators: ACTION REQUIRED)

In order to reimplement the Paver Asset commands without Python/Django, we are changing how several settings are configured.

The following Django settings are becoming read-only mirrors. If you override them now, remove your overrides:

  • LMS:
    • STATIC_ROOT (a string, loaded from STATIC_ROOT_LMS env var)
    • COMPREHENSIVE_THEME_DIRS (loaded from the env var, parsed into a list of strings)
  • CMS:
    • STATIC_ROOT (a string, loaded from STATIC_ROOT_CMS env var)
    • COMPREHENSIVE_THEME_DIRS (loaded from the env var, parsed into a list of strings)

The following Django settings are being removed. If you override them now, remove your overrides:

  • LMS:
    • STATIC_ROOT_BASE
    • WEBPACK_CONFIG_PATH
    • JS_ENV_EXTRA_CONFIG
  • CMS:
    • STATIC_ROOT_BASE
    • WEBPACK_CONFIG_PATH
    • JS_ENV_EXTRA_CONFIG

The following new environment variables are available. Set these in your environment, in place of the overrides you removed above:

  • STATIC_ROOT_LMS (path)
  • STATIC_ROOT_CMS (path)
  • COMPREHENSIVE_THEME_DIRS (colon-separated paths)
  • WEBPACK_CONFIG_PATH (path)
  • JS_ENV_EXTRA_CONFIG (serialized as json)

Note: If you previously set the STATIC_ROOT_BASE Django setting to /blah, then you should now set the LMS and CMS environment variables as so:

  • STATIC_ROOT_LMS=/blah
  • STATIC_ROOT_CMS=/blah/studio

Deprecation

In time for Redwood, deprecation warnings will be added to all edx-platform Paver Asset commands.

Removal

  • In edx-platform:

    • rm -rf ./pavelib/
    • rm ./requirements/edx/paver.in
    • rm ./requirements/edx/paver.txt
    • Search docs for 'paver' and replace with new commands
  • Elsewhere in the openedx GitHub org:

    • Search docs for 'paver' and replace with new commands
  • In Tutor:

    • Replace paver Asset references with new commands
@github-actions github-actions bot added the depr Proposal for deprecation & removal per OEP-21 label Apr 3, 2024
@kdmccormick kdmccormick self-assigned this Apr 3, 2024
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Apr 3, 2024
All CI used to go through scripts/generic-ci-tests.sh, which is a
wrapper around various `paver` test/linting/check invocations.
These days, most edx-platform CI checks just invoke their tools (pylint,
pycodestyle, pytest, etc.) directly.

In anticipation of the proposed Paver deprecation [1], let's remove
the parts of this script that aren't used any more, including several
`paver` command invocations. This should have no impact on CI.

Furthermore, we are able to remove the SHARD environment variable,
which was formely used to split unit and quality checks up into
smaller pieces. Unit tests and pylint checks now have their own
separate sharding logic, so there is only one "quality" shard remaining
(SHARD=4, ie generic quality checks), thus we don't need a SHARD
variable at all.

[1] openedx#34467
kdmccormick added a commit that referenced this issue Apr 4, 2024
All CI used to go through scripts/generic-ci-tests.sh, which is a
wrapper around various `paver` test/linting/check invocations.
These days, most edx-platform CI checks just invoke their tools (pylint,
pycodestyle, pytest, etc.) directly.

In anticipation of the proposed Paver deprecation [1], let's remove
the parts of this script that aren't used any more, including several
`paver` command invocations. This should have no impact on CI.

Furthermore, we are able to remove the SHARD environment variable,
which was formely used to split unit and quality checks up into
smaller pieces. Unit tests and pylint checks now have their own
separate sharding logic, so there is only one "quality" shard remaining
(SHARD=4, ie generic quality checks), thus we don't need a SHARD
variable at all.

[1] #34467
KyryloKireiev pushed a commit to raccoongang/edx-platform that referenced this issue Apr 24, 2024
)

All CI used to go through scripts/generic-ci-tests.sh, which is a
wrapper around various `paver` test/linting/check invocations.
These days, most edx-platform CI checks just invoke their tools (pylint,
pycodestyle, pytest, etc.) directly.

In anticipation of the proposed Paver deprecation [1], let's remove
the parts of this script that aren't used any more, including several
`paver` command invocations. This should have no impact on CI.

Furthermore, we are able to remove the SHARD environment variable,
which was formely used to split unit and quality checks up into
smaller pieces. Unit tests and pylint checks now have their own
separate sharding logic, so there is only one "quality" shard remaining
(SHARD=4, ie generic quality checks), thus we don't need a SHARD
variable at all.

[1] openedx#34467
@robrap robrap removed this from Arch-BOM Apr 29, 2024
@dianakhuang dianakhuang moved this from Proposed to Communicated in DEPR: Deprecation & Removal May 2, 2024
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue May 5, 2024
Together, these changes make it so that all features of the Paver-based
asset compilation system are supported with drop-in Paver-free
replacements. The remaining Paver asset functions are trivial wrappers,
which can be comfortably deleted before Sumac

* Turn `./manage.py ... compile_sass` into a simple wrapper around `npm
  run compile-sass`
* Turn `paver webpack` into a simple wrapper around `npm run webpack`
* Turn `pavelib.assets:collect_assets` into a simple wrapper around
  `./manage.py ... collectstatic`
* Add/improve deprecation warnings for all Paver asset commands.
* Load defaults for asset-related Django settings from environment
  variables. This allows the build to work without Python. For the
  settings which will be removed in Sumac, I've added deprecation
  warnings.
* Change EDX_PLATFORM_THEME_DIRS env var to COMPREHENSIVE_THEME_DIRS.
  This simplifies the migration instructions, because all the new env
  vars now match their corresponding Django settings. This amends an
  ADR, but it should not be a breaking change because the  env var was
  recently added (since Quince) and nobody should be using it yet.
* Future-proof the static assets ADR with links. The linked pages will
  be kept up-to-date even if the ADR isn't.

Part of: openedx#34467
kdmccormick added a commit that referenced this issue May 6, 2024
Together, these changes make it so that all features of the Paver-based
asset compilation system are supported with drop-in Paver-free
replacements. The remaining Paver asset functions are trivial wrappers,
which can be comfortably deleted before Sumac.

* Turn `./manage.py ... compile_sass` into a simple wrapper around `npm
  run compile-sass`
* Turn `paver webpack` into a simple wrapper around `npm run webpack`
* Turn `pavelib.assets:collect_assets` into a simple wrapper around
  `./manage.py ... collectstatic`
* Add/improve deprecation warnings for all Paver asset commands.
* Load defaults for asset-related Django settings from environment
  variables. This allows the build to work without Python. For the
  settings which will be removed in Sumac, I've added deprecation
  warnings.
* Change EDX_PLATFORM_THEME_DIRS env var to COMPREHENSIVE_THEME_DIRS.
  This simplifies the migration instructions, because all the new env
  vars now match their corresponding Django settings. This amends an
  ADR, but it should not be a breaking change because the  env var was
  recently added (since Quince) and nobody should be using it yet.
* Future-proof the static assets ADR with links. The linked pages will
  be kept up-to-date even if the ADR isn't.

Part of: #34467
@kdmccormick
Copy link
Member Author

I have updated the Django settings to clarify that we will also be removing the STATIC_ROOT_BASE Django setting.

@kdmccormick kdmccormick moved this from Communicated to Accepted in DEPR: Deprecation & Removal May 21, 2024
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue May 21, 2024
This is the first step of Paver removal.
These are the parts that we are confident are unused.

Part of: openedx#34467
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue May 21, 2024
TODO describe merge timing concerns

Part of: openedx#34467
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue May 21, 2024
This is the first step of Paver removal.
These are the parts that we are confident are unused.

Part of: openedx#34467
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue May 21, 2024
@kdmccormick
Copy link
Member Author

What @feanil says is right. I've tried to amend the description to be a bit clearer. In retrospect, it may have been clearer to just have two DEPR tickets, but doing that now would probably just add confusion. @timmc-edx let me know if it's still unclear.

@timmc-edx
Copy link
Contributor

I see now, thanks!

@dianakhuang
Copy link
Contributor

Just putting it here as a note for something that I/someone else could do: would be nice to create a make command for running asset processing, because otherwise I will forget the correct way of doing it.

@feanil
Copy link
Contributor

feanil commented Jul 17, 2024

Just putting it here as a note for something that I/someone else could do: would be nice to create a make command for running asset processing, because otherwise I will forget the correct way of doing it.

FWIW, it's just npm run build or npm run build-dev, that does all the things and aligns with our MFEs which do npm build to build out the serialized assets.

Also there is a full guide in the docs: https://github.com/kdmccormick/edx-platform/blob/master/docs/references/static-assets.rst

@dianakhuang
Copy link
Contributor

Oh, awesome! I have been around too long and of course I didn't think to read the doc. 😅

@kdmccormick
Copy link
Member Author

Friendly reminder that the breaking changes listed in the ticket description under "Operators: ACTION REQUIRED" are slated to land as early as 09 Nov.

kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Nov 12, 2024
These packages were installed transitively through paver.in, but they
are used as direct dependencies in edx-platform application code:

* psutil
* pymemcache
* wrapt

Since we are demoting paver.in to be a dev-only dependency (with plans
to remove paver.in entirely), we need to make those three packages
explicit dependencies in kernel.in

Part of: openedx#34467
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Nov 12, 2024
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Nov 12, 2024
These packages were installed transitively through paver.in, but they
are used as direct dependencies in edx-platform application code:

* psutil
* pymemcache
* wrapt

Since we are demoting paver.in to be a dev-only dependency (with plans
to remove paver.in entirely), we need to make those three packages
explicit dependencies in kernel.in

Part of: openedx#34467
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Nov 12, 2024
@UsamaSadiq
Copy link
Member

Hi @kdmccormick
I'm in the final stages of removing the paver usages from ansible scripts of configuration.
I'm a bit confused regarding the commands paver test_system, paver test_lib, paver coverage, paver run_quality as I couldn't find any alternate of these mentioned in the PRs that were merged and some of these are still being used in the generic-ci-test.sh script within edx-platform.

Could you guide me a bit about the replacement of these commands. Thanks in advance.

@kdmccormick
Copy link
Member Author

kdmccormick commented Nov 14, 2024

@UsamaSadiq paver test_system, paver test_lib, and paver coverage have all removed in favor of running pytest and coverage directly. That changed happened a couple years ago, separate from this DEPR. Regarding the paver test_lib reference in generic-ci-scripts, that is dead code-- nothing is calling the script with TEST_SUITE=pavelib-js-unit.

paver run_quality will be removed because CI does not use it any more. We considered adding a make quality target, but decided against it, because it would take so long to run all the different quality checks that it would be a bad developer experience.

None of that should matter for edx/configuration, correct? Are you asking because the commands are referenced in docs/concepts/testing/testing.rst? If so, that is a good point--we will need to update that documentation.

@UsamaSadiq
Copy link
Member

@UsamaSadiq paver test_system, paver test_lib, and paver coverage have all removed in favor of running pytest and coverage directly. That changed happened a couple years ago, separate from this DEPR. Regarding the paver test_lib reference in generic-ci-scripts, that is dead code-- nothing is calling the script with TEST_SUITE=pavelib-js-unit.

@kdmccormick yes, similar to the dead script generic-ci-tests.sh, there was a configuration role build_test_service which was using deprecated commands but after discussing with 2U-SRE team, we decided to remove that completely.
Thanks for the quick response.

We're almost done with the clearance on our end so could we make the paver removal change on Monday? This'll give us some bandwidth to wrap up internal config as well.

@kdmccormick
Copy link
Member Author

Sure thing @UsamaSadiq

@UsamaSadiq
Copy link
Member

Hi @kdmccormick Thanks for extending the cut off time for us. We're done with removing all occurrences of paver from 2U configs so you can now proceed with doing the final removals on your end. Thanks.

kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Dec 11, 2024
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Dec 11, 2024
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Dec 12, 2024
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Dec 12, 2024
These packages were installed transitively through paver.in, but they
are used as direct dependencies in edx-platform application code:

* psutil
* pymemcache
* wrapt

Since we are demoting paver.in to be a dev-only dependency (with plans
to remove paver.in entirely), we need to make those three packages
explicit dependencies in kernel.in

Part of: openedx#34467
kdmccormick added a commit to kdmccormick/tutor that referenced this issue Dec 12, 2024
From the upstream Paver DEPR [1], this accounts for a change
in the requirements files:

> Starting in Sumac, these dependencies will be removed from
> requirements/edx/base.txt. Instead, operators will need to install:
> * requirements/edx/assets.txt to build static assets

In the future, we could optimize the openedx image build by installing
assets.txt in a separate, rarely-invalidated cache layer. libsass
in particular takes 60+ seconds to install, so this is promising.
However, for now, in order to prepare for [1], we make just the
simplest possible change, which is to install assets.txt along with
base.txt.

We also take this opportunity to bump the nodeenv version from 1.8.0 to
1.9.1, matching edx-platform's. This is another area where we could make
use of assets.txt in a future Dockerfile refactoring.

[1] openedx/edx-platform#34467
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Dec 12, 2024
BREAKING CHANGE: Removes all remaining Paver commands including
`pavelib/prereqs.py:*` and `pavelib/assets.py:*`.

BREAKING CHANGE: Removes `./manage.py [lms|cms] compile_sass`, which
was just a wrapper around Paver commands.

BREAKING CHANGE: Removes paver.txt. Operators should install testing.txt
instead.

Part of: openedx#34467
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Dec 12, 2024
These packages were installed transitively through paver.in, but they
are used as direct dependencies in edx-platform application code:

* psutil
* pymemcache
* wrapt

Since we are demoting paver.in to be a dev-only dependency (with plans
to remove paver.in entirely), we need to make those three packages
explicit dependencies in kernel.in

Part of: openedx#34467
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Dec 13, 2024
BREAKING CHANGE: Removes all remaining Paver commands including
`pavelib/prereqs.py:*` and `pavelib/assets.py:*`.

BREAKING CHANGE: Removes `./manage.py [lms|cms] compile_sass`, which
was just a wrapper around Paver commands.

BREAKING CHANGE: Removes paver.txt. Operators should install testing.txt
instead.

Part of: openedx#34467
kdmccormick added a commit to kdmccormick/edx-platform that referenced this issue Dec 13, 2024
These packages were installed transitively through paver.in, but they
are used as direct dependencies in edx-platform application code:

* psutil
* pymemcache
* wrapt

Since we are demoting paver.in to be a dev-only dependency (with plans
to remove paver.in entirely), we need to make those three packages
explicit dependencies in kernel.in

Part of: openedx#34467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depr Proposal for deprecation & removal per OEP-21
Projects
Status: Removing
Development

No branches or pull requests

5 participants