Skip to content

Conversation

@dwong2708
Copy link
Contributor

@dwong2708 dwong2708 commented Jul 14, 2025

Resolves: #332

Description

This PR introduces the following changes:

  • Added a zipper.py module to handle all ZIP file–related operations.
  • Introduced the TOMLPublishableEntityFile class to abstract TOML file generation for a publishable entity.
  • Introduced the TOMLPublishableEntityVersionFile class to abstract TOML file generation for a publishable entity version.
  • Added the TOMLMixin class to encapsulate and reuse common TOML-related methods.
  • Improved the structure of the generated TOML files to better meet the requirements.
  • Added a unit test to verify the expected structure and content of the dump file.

Resulting Dump File

image

Suggestion

Given the entity key xblock.v1:html:Query Counting, the TOML file currently uses this string as-is, which isn't ideal for a filename.
I suggest transforming it into a slugified format—for example: xblock-v1-html-query-counting—to make it more suitable as a filename.

Content of the Entity File

image

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 14, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Jul 14, 2025

Thanks for the pull request, @dwong2708!

This repository is currently maintained by @axim-engineering.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Jul 14, 2025
@dwong2708 dwong2708 force-pushed the dwong2708/lp_dump_publish_ent branch 2 times, most recently from 34527b7 to 123ad6a Compare July 15, 2025 15:28
@mphilbrick211 mphilbrick211 added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Jul 15, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Jul 15, 2025
@dwong2708 dwong2708 force-pushed the dwong2708/lp_dump_publish_ent branch 2 times, most recently from fffd5c2 to 964bb83 Compare July 18, 2025 23:59
@dwong2708 dwong2708 requested a review from Copilot July 21, 2025 15:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to dump learning packages with their publishable entities to a ZIP file containing TOML representations. The implementation introduces a modular architecture for ZIP file creation and TOML generation.

  • Added ZIP file creation with publishable entities as individual TOML files
  • Introduced a mixin pattern for TOML generation with reusable components
  • Created comprehensive test coverage for the dump functionality

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
openedx_learning/apps/authoring/backup_restore/zipper.py New module implementing ZIP file creation with learning package and entity data
openedx_learning/apps/authoring/backup_restore/toml.py Added TOMLPublishableEntityFile class and TOMLMixin for reusable TOML generation
openedx_learning/apps/authoring/backup_restore/api.py Refactored to use new zipper module instead of inline ZIP creation
openedx_learning/apps/authoring/backup_restore/management/commands/lp_dump.py Removed redundant logging in exception handler
openedx_learning/apps/authoring/publishing/models/publishable_entity.py Added can_stand_alone property to PublishableEntityVersioning
tests/openedx_learning/apps/authoring/backup_restore/test_backup.py New comprehensive test suite for backup functionality
test_settings.py Added BackupRestoreConfig to installed apps
openedx_learning/api/authoring.py Exposed backup_restore API functions

@dwong2708 dwong2708 force-pushed the dwong2708/lp_dump_publish_ent branch 3 times, most recently from cd89fae to 85aa808 Compare July 23, 2025 19:20
@dwong2708 dwong2708 changed the title feat: Add PublishableEntities to lp_dump file Add PublishableEntities and PublishableEntityVersions to lp_dump file Jul 23, 2025
@dwong2708 dwong2708 marked this pull request as ready for review July 23, 2025 19:36
@dwong2708 dwong2708 requested a review from ormsbee July 23, 2025 19:36
@dwong2708
Copy link
Contributor Author

Hi @ormsbee. I’m done with this task. Please let me know if it meets the requirements when you have a chance

Copy link
Contributor

@ormsbee ormsbee left a comment

Choose a reason for hiding this comment

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

It's not a blocker for this PR, but I'm not clear on why it's necessary to create mixins and classes for the TOML conversion of the data. It seems like it would be simpler to declare them as simple functions that take what the constructor took and returns the TOML document object.

Adds a comment with the current datetime to indicate when the export occurred.
This helps with traceability and file versioning.
Adds a newline to the TOML document.
This is useful for formatting the output.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not clear on why this class exists. These small methods only seem to echo into the TOMLDocument object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically yes. The idea was to act as a sort of interface (it didn’t quite work out that way, but that was the intention) in case we ever wanted to switch from TOML to YAML or another format. However, I agree with you—keeping it simple is better. I don't think we'll need to support other formats, so I can convert this into simple functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was changed to functions

if comment_text:
section.add(comment(comment_text))
for key, value in params.items():
section.add(key, value)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this equivalent to:

section = table()
section.update(params)

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know about this method. I'll change it. Thanks Dave.

@dwong2708 dwong2708 requested a review from ormsbee July 30, 2025 19:25
@mphilbrick211 mphilbrick211 moved this from Waiting on Author to In Eng Review in Contributions Jul 30, 2025
@dwong2708 dwong2708 force-pushed the dwong2708/lp_dump_publish_ent branch from 1e9bcdd to d4b31f0 Compare July 31, 2025 18:08
@ormsbee ormsbee merged commit 8fe2799 into openedx:main Jul 31, 2025
11 checks passed
@github-project-automation github-project-automation bot moved this from In Eng Review to Done in Contributions Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add PublishableEntities and PublishableEntityVersions to lp_dump file.

4 participants