Skip to content

Commit

Permalink
chore: refactor common to structures_pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan committed Mar 12, 2024
1 parent ab1451b commit 4822e95
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/common/requirements/testing.txt
pip install -r scripts/structures_pruning/requirements/testing.txt
- name: Run pytest
run: |
pytest scripts/common
pytest scripts/structures_pruning
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ REQ_FILES = \
scripts/xblock/requirements \
scripts/user_retirement/requirements/base \
scripts/user_retirement/requirements/testing \
scripts/common/requirements/base \
scripts/common/requirements/testing
scripts/structures_pruning/requirements/base \
scripts/structures_pruning/requirements/testing

define COMMON_CONSTRAINTS_TEMP_COMMENT
# This is a temporary solution to override the real common_constraints.txt\n# In edx-lint, until the pyjwt constraint in edx-lint has been removed.\n# See BOM-2721 for more details.\n# Below is the copied and edited version of common_constraints\n
Expand Down
44 changes: 0 additions & 44 deletions scripts/common/requirements/testing.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Common Scripts
==============
Structures Pruning Scripts
==========================

`This <https://github.com/openedx/edx-platform/tree/master/scripts/structures_pruning>`_ directory contains mongo db structures pruning script that is migrated from the
`tubular <https://github.com/openedx/tubular>`_ repository.

`This <https://github.com/openedx/edx-platform/tree/master/scripts/common>`_ directory contains some common python scripts. Some of them are migrated from the other repositories.

These scripts could be called from any automation/CD framework.
This script could be called from any automation/CD framework.

How to run the scripts
======================
Expand All @@ -17,7 +19,7 @@ To download the scripts, you can perform a partial clone of the edx-platform rep
[email protected]:openedx/edx-platform.git
branch=master
directory=scripts/common
directory=scripts/structures_pruning
git clone --branch $branch --single-branch --depth=1 --filter=tree:0 $repo_url
cd edx-platform
Expand All @@ -41,7 +43,7 @@ Install the required pip packages using the provided requirements file:

.. code-block:: bash
pip install -r scripts/common/requirements/base.txt
pip install -r scripts/structures_pruning/requirements/base.txt
Execute Script
Expand All @@ -51,7 +53,7 @@ You can simply execute Python scripts with python command

.. code-block:: bash
python scripts/common/structures.py prune plan_file.json
python scripts/structures_pruning/structures.py prune plan_file.json
Feel free to customize these steps according to your specific environment and requirements.

Expand All @@ -62,10 +64,10 @@ Before running test cases, install the testing requirements:

.. code-block:: bash
pip install -r scripts/common/requirements/testing.txt
pip install -r scripts/structures_pruning/requirements/testing.txt
Run the test cases using pytest:

.. code-block:: bash
pytest scripts/common
pytest scripts/structures_pruning
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
click
click-log
pymongo
edx-opaque-keys
pymongo
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
#
click==8.1.7
# via
# -r scripts/common/requirements/base.in
# -r scripts/structures_pruning/requirements/base.in
# click-log
click-log==0.4.0
# via -r scripts/common/requirements/base.in
# via -r scripts/structures_pruning/requirements/base.in
edx-opaque-keys==2.5.1
# via -r scripts/common/requirements/base.in
# via -r scripts/structures_pruning/requirements/base.in
pbr==6.0.0
# via stevedore
pymongo==3.13.0
# via
# -r scripts/common/requirements/base.in
# -r scripts/structures_pruning/requirements/base.in
# edx-opaque-keys
stevedore==5.2.0
# via edx-opaque-keys
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r base.txt

pytest
ddt
pytest
44 changes: 44 additions & 0 deletions scripts/structures_pruning/requirements/testing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
click==8.1.7
# via
# -r scripts/structures_pruning/requirements/base.txt
# click-log
click-log==0.4.0
# via -r scripts/structures_pruning/requirements/base.txt
ddt==1.7.2
# via -r scripts/structures_pruning/requirements/testing.in
edx-opaque-keys==2.5.1
# via -r scripts/structures_pruning/requirements/base.txt
exceptiongroup==1.2.0
# via pytest
iniconfig==2.0.0
# via pytest
packaging==24.0
# via pytest
pbr==6.0.0
# via
# -r scripts/structures_pruning/requirements/base.txt
# stevedore
pluggy==1.4.0
# via pytest
pymongo==3.13.0
# via
# -r scripts/structures_pruning/requirements/base.txt
# edx-opaque-keys
pytest==8.1.1
# via -r scripts/structures_pruning/requirements/testing.in
stevedore==5.2.0
# via
# -r scripts/structures_pruning/requirements/base.txt
# edx-opaque-keys
tomli==2.0.1
# via pytest
typing-extensions==4.10.0
# via
# -r scripts/structures_pruning/requirements/base.txt
# edx-opaque-keys
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Add top-level project path to sys.path before importing scripts code
sys.path.append(path.abspath(path.join(path.dirname(__file__), '../..')))

from scripts.common.utils.splitmongo import SplitMongoBackend, ChangePlan
from scripts.structures_pruning.utils.splitmongo import SplitMongoBackend, ChangePlan

# Add top-level module path to sys.path before importing tubular code.
# sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Add top-level project path to sys.path before importing scripts code
sys.path.append(path.abspath(path.join(path.dirname(__file__), '../..')))

from scripts.common.utils.splitmongo import (
from scripts.structures_pruning.utils.splitmongo import (
ActiveVersionBranch, ChangePlan, Structure, SplitMongoBackend, StructuresGraph
)

Expand Down
File renamed without changes.

0 comments on commit 4822e95

Please sign in to comment.