Skip to content

Commit 6035bdf

Browse files
committed
build: Update references to setup.py
Replace with pyproject.toml references as appropriate.
1 parent c2239a8 commit 6035bdf

File tree

4 files changed

+37
-39
lines changed

4 files changed

+37
-39
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Each directory contains detailed README.md files with adaptation guidance.
106106
```
107107
sample-plugin/
108108
├── README.md # This file - overview and quick start
109-
├── backend/
109+
├── backend/
110110
│ ├── README.md # Backend plugin detailed guide
111111
│ ├── sample_plugin/
112112
│ │ ├── apps.py # Django plugin configuration
@@ -133,7 +133,7 @@ sample-plugin/
133133
### Backend Plugin Development
134134

135135
1. **Setup**: Follow backend setup in [Quick Start](#quick-start-guide)
136-
2. **Development**:
136+
2. **Development**:
137137
- Modify models in `models.py`
138138
- Add API endpoints in `views.py`
139139
- Implement event handlers in `signals.py`
@@ -187,7 +187,7 @@ const response = await client.get(
187187
def log_course_info_changed(signal, sender, catalog_info, **kwargs):
188188
logging.info(f"{catalog_info.course_key} has been updated!")
189189

190-
# Filters: Modify course about URLs
190+
# Filters: Modify course about URLs
191191
class ChangeCourseAboutPageUrl(PipelineStep):
192192
def run_filter(self, url, org, **kwargs):
193193
# Custom URL logic
@@ -198,7 +198,7 @@ class ChangeCourseAboutPageUrl(PipelineStep):
198198
### Common Issues
199199

200200
**Plugin not loading:**
201-
- Verify `setup.py` entry points are correct
201+
- Verify `pyproject.toml` entry points are correct
202202
- Check that plugin app is in INSTALLED_APPS (should be automatic)
203203
- Review Django app plugin configuration in `apps.py`
204204

@@ -242,4 +242,4 @@ class ChangeCourseAboutPageUrl(PipelineStep):
242242
- **Working Integration**: Complete example showing all plugin types working together
243243
- **Real Business Logic**: Realistic course archiving functionality vs. hello-world examples
244244
- **Development Workflow**: End-to-end development and testing process
245-
- **Troubleshooting**: Common plugin development issues and solutions
245+
- **Troubleshooting**: Common plugin development issues and solutions

backend/README.md

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class SamplePluginConfig(AppConfig):
5959
"common": {PluginURLs.RELATIVE_PATH: "settings.common"},
6060
"production": {PluginURLs.RELATIVE_PATH: "settings.production"},
6161
},
62-
# ... CMS configuration
62+
# ... CMS configuration
6363
}
6464
}
6565
```
@@ -74,24 +74,21 @@ class SamplePluginConfig(AppConfig):
7474

7575
### Entry Points Configuration
7676

77-
In [`setup.py`](./setup.py), the plugin registers itself with edx-platform:
77+
In [`pyproject.toml`](./backend/pyproject.toml), the plugin registers itself with edx-platform:
7878

7979
```python
80-
entry_points={
81-
"lms.djangoapp": [
82-
"sample_plugin = sample_plugin.apps:SamplePluginConfig",
83-
],
84-
"cms.djangoapp": [
85-
"sample_plugin = sample_plugin.apps:SamplePluginConfig",
86-
],
87-
}
80+
[project.entry-points."lms.djangoapp"]
81+
sample_plugin = "sample_plugin.apps:SamplePluginConfig"
82+
83+
[project.entry-points."cms.djangoapp"]
84+
sample_plugin = "sample_plugin.apps:SamplePluginConfig"
8885
```
8986

9087
**Why this works**: The platform automatically discovers and loads any Django app registered in these entry points.
9188

9289
## Models & Database
9390

94-
**File**: [`sample_plugin/models.py`](./sample_plugin/models.py)
91+
**File**: [`sample_plugin/models.py`](./sample_plugin/models.py)
9592
**Official Docs**: [OEP-49: Django App Patterns](https://docs.openedx.org/projects/openedx-proposals/en/latest/best-practices/oep-0049-django-app-patterns.html)
9693

9794
### CourseArchiveStatus Model
@@ -133,7 +130,7 @@ The model includes PII documentation:
133130

134131
## API Endpoints
135132

136-
**File**: [`sample_plugin/views.py`](./sample_plugin/views.py)
133+
**File**: [`sample_plugin/views.py`](./sample_plugin/views.py)
137134
**URLs**: [`sample_plugin/urls.py`](./sample_plugin/urls.py)
138135

139136
### REST API Implementation
@@ -182,7 +179,7 @@ def perform_create(self, serializer):
182179

183180
## Events & Signals
184181

185-
**File**: [`sample_plugin/signals.py`](./sample_plugin/signals.py)
182+
**File**: [`sample_plugin/signals.py`](./sample_plugin/signals.py)
186183
**Official Docs**: [Open edX Events Guide](https://docs.openedx.org/projects/openedx-events/en/latest/)
187184

188185
### Event Handler Example
@@ -241,7 +238,7 @@ def ready(self):
241238

242239
## Filters & Pipeline Steps
243240

244-
**File**: [`sample_plugin/pipeline.py`](./sample_plugin/pipeline.py)
241+
**File**: [`sample_plugin/pipeline.py`](./sample_plugin/pipeline.py)
245242
**Official Docs**: [Using Open edX Filters](https://docs.openedx.org/projects/openedx-filters/en/latest/how-tos/using-filters.html)
246243

247244
### Filter Implementation
@@ -254,12 +251,12 @@ class ChangeCourseAboutPageUrl(PipelineStep):
254251
# Extract course ID from URL
255252
pattern = r'(?P<course_id>course-v1:[^/]+)'
256253
match = re.search(pattern, url)
257-
254+
258255
if match:
259256
course_id = match.group('course_id')
260257
new_url = f"https://example.com/new_about_page/{course_id}"
261258
return {"url": new_url, "org": org}
262-
259+
263260
# Return original data if no match
264261
return {"url": url, "org": org}
265262
```
@@ -278,7 +275,7 @@ class ChangeCourseAboutPageUrl(PipelineStep):
278275

279276
**Common Filters:**
280277
- Course enrollment filters
281-
- Authentication filters
278+
- Authentication filters
282279
- Certificate generation filters
283280
- Course discovery filters
284281

@@ -289,7 +286,7 @@ Filters must be registered in Django settings. This happens automatically via th
289286
### Real-World Use Cases
290287

291288
- **URL Redirection**: Send users to custom course pages
292-
- **Access Control**: Implement custom enrollment restrictions
289+
- **Access Control**: Implement custom enrollment restrictions
293290
- **Data Transformation**: Modify course data before display
294291
- **Integration**: Add custom fields to API responses
295292

@@ -380,7 +377,7 @@ python manage.py cms migrate
380377

381378
### Verification Steps
382379

383-
1. **Check Installation**:
380+
1. **Check Installation**:
384381
```bash
385382
python manage.py lms shell
386383
>>> from sample_plugin.models import CourseArchiveStatus
@@ -439,7 +436,7 @@ from django.contrib.auth import get_user_model
439436
class TestCourseArchiveStatusAPI(APITestCase):
440437
def setUp(self):
441438
self.user = get_user_model().objects.create_user(username="testuser")
442-
439+
443440
def test_list_archive_statuses(self):
444441
# Test API endpoints
445442
pass
@@ -492,7 +489,7 @@ Settings configure filter behavior:
492489
# settings/common.py
493490
def plugin_settings(settings):
494491
settings.SAMPLE_PLUGIN_REDIRECT_DOMAIN = "custom-domain.com"
495-
492+
496493
# pipeline.py - Uses setting
497494
class ChangeCourseAboutPageUrl(PipelineStep):
498495
def run_filter(self, url, org, **kwargs):
@@ -506,15 +503,15 @@ class ChangeCourseAboutPageUrl(PipelineStep):
506503
### For Your Use Case
507504

508505
1. **Models**: Modify [`models.py`](./sample_plugin/models.py) for your data structure
509-
2. **APIs**: Update [`views.py`](./sample_plugin/views.py) and [`serializers.py`](./sample_plugin/serializers.py)
506+
2. **APIs**: Update [`views.py`](./sample_plugin/views.py) and [`serializers.py`](./sample_plugin/serializers.py)
510507
3. **Events**: Change event handlers in [`signals.py`](./sample_plugin/signals.py)
511508
4. **Filters**: Implement your business logic in [`pipeline.py`](./sample_plugin/pipeline.py)
512509
5. **Settings**: Configure plugin behavior in [`settings/`](./sample_plugin/settings/)
513510

514511
### Plugin Development Checklist
515512

516-
- [ ] Update `setup.py` with your plugin name and dependencies
517-
- [ ] Modify `apps.py` with your app configuration
513+
- [ ] Update `pyproject.toml` with your plugin name and dependencies
514+
- [ ] Modify `apps.py` with your app configuration
518515
- [ ] Design your models in `models.py`
519516
- [ ] Create and run database migrations
520517
- [ ] Implement API endpoints in `views.py`
@@ -551,4 +548,4 @@ def handle_your_event(signal, sender, event_data, **kwargs):
551548
pass
552549
```
553550

554-
This backend plugin provides a solid foundation for any Open edX extension. Focus on adapting the business logic while keeping the proven patterns for authentication, permissions, and integration.
551+
This backend plugin provides a solid foundation for any Open edX extension. Focus on adapting the business logic while keeping the proven patterns for authentication, permissions, and integration.

backend/sample_plugin/apps.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ class SamplePluginConfig(AppConfig):
3333
- Add custom business logic
3434
3535
Entry Point Configuration:
36-
This plugin is registered in setup.py as::
36+
This plugin is registered in pyproject.toml as::
3737
38-
entry_points={
39-
"lms.djangoapp": ["sample_plugin = sample_plugin.apps:SamplePluginConfig"],
40-
"cms.djangoapp": ["sample_plugin = sample_plugin.apps:SamplePluginConfig"],
41-
}
38+
[project.entry-points."lms.djangoapp"]
39+
sample_plugin = "sample_plugin.apps:SamplePluginConfig"
40+
41+
[project.entry-points."cms.djangoapp"]
42+
sample_plugin = "sample_plugin.apps:SamplePluginConfig"
4243
4344
The platform automatically discovers and loads plugins registered in these entry points.
4445
""" # pylint: disable=line-too-long # noqa: E501

backend/tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ deps =
7272
-r{toxinidir}/requirements/quality.txt
7373
commands =
7474
touch tests/__init__.py
75-
pylint sample_plugin tests test_utils manage.py setup.py
75+
pylint sample_plugin tests test_utils manage.py
7676
rm tests/__init__.py
77-
pycodestyle sample_plugin tests manage.py setup.py
78-
pydocstyle sample_plugin tests manage.py setup.py
79-
isort --check-only --diff tests test_utils sample_plugin manage.py setup.py test_settings.py
77+
pycodestyle sample_plugin tests manage.py
78+
pydocstyle sample_plugin tests manage.py
79+
isort --check-only --diff tests test_utils sample_plugin manage.py test_settings.py
8080
make selfcheck
8181

8282
[testenv:pii_check]

0 commit comments

Comments
 (0)