Skip to content

Commit 6c2384a

Browse files
authored
Core Structure for supporting multiple XBlocks (#2)
* fix: basic project structure and configuration
1 parent 7a8286e commit 6c2384a

File tree

130 files changed

+7671
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+7671
-1
lines changed

.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[run]
2+
branch = True
3+
source = xblocks_contrib

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile

.editorconfig

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# ***************************
2+
# ** DO NOT EDIT THIS FILE **
3+
# ***************************
4+
#
5+
# This file was generated by edx-lint: https://github.com/openedx/edx-lint
6+
#
7+
# If you want to change this file, you have two choices, depending on whether
8+
# you want to make a local change that applies only to this repo, or whether
9+
# you want to make a central change that applies to all repos using edx-lint.
10+
#
11+
# Note: If your .editorconfig file is simply out-of-date relative to the latest
12+
# .editorconfig in edx-lint, ensure you have the latest edx-lint installed
13+
# and then follow the steps for a "LOCAL CHANGE".
14+
#
15+
# LOCAL CHANGE:
16+
#
17+
# 1. Edit the local .editorconfig_tweaks file to add changes just to this
18+
# repo's file.
19+
#
20+
# 2. Run:
21+
#
22+
# $ edx_lint write .editorconfig
23+
#
24+
# 3. This will modify the local file. Submit a pull request to get it
25+
# checked in so that others will benefit.
26+
#
27+
#
28+
# CENTRAL CHANGE:
29+
#
30+
# 1. Edit the .editorconfig file in the edx-lint repo at
31+
# https://github.com/openedx/edx-lint/blob/master/edx_lint/files/.editorconfig
32+
#
33+
# 2. install the updated version of edx-lint (in edx-lint):
34+
#
35+
# $ pip install .
36+
#
37+
# 3. Run (in edx-lint):
38+
#
39+
# $ edx_lint write .editorconfig
40+
#
41+
# 4. Make a new version of edx_lint, submit and review a pull request with the
42+
# .editorconfig update, and after merging, update the edx-lint version and
43+
# publish the new version.
44+
#
45+
# 5. In your local repo, install the newer version of edx-lint.
46+
#
47+
# 6. Run:
48+
#
49+
# $ edx_lint write .editorconfig
50+
#
51+
# 7. This will modify the local file. Submit a pull request to get it
52+
# checked in so that others will benefit.
53+
#
54+
#
55+
#
56+
#
57+
#
58+
# STAY AWAY FROM THIS FILE!
59+
#
60+
#
61+
#
62+
#
63+
#
64+
# SERIOUSLY.
65+
#
66+
# ------------------------------
67+
# Generated by edx-lint version: 5.2.5
68+
# ------------------------------
69+
[*]
70+
end_of_line = lf
71+
insert_final_newline = true
72+
charset = utf-8
73+
indent_style = space
74+
indent_size = 4
75+
max_line_length = 120
76+
trim_trailing_whitespace = true
77+
78+
[{Makefile, *.mk}]
79+
indent_style = tab
80+
indent_size = 8
81+
82+
[*.{yml,yaml,json}]
83+
indent_size = 2
84+
85+
[*.js]
86+
indent_size = 2
87+
88+
[*.diff]
89+
trim_trailing_whitespace = false
90+
91+
[.git/*]
92+
trim_trailing_whitespace = false
93+
94+
[COMMIT_EDITMSG]
95+
max_line_length = 72
96+
97+
[*.rst]
98+
max_line_length = 79
99+
100+
# f2f02689fced7a2e0c62c2f9803184114dc2ae4b

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
**Merge checklist:**
3+
Check off if complete *or* not applicable:
4+
- [ ] Version bumped
5+
- [ ] Changelog record added
6+
- [ ] Documentation updated (not only docstrings)
7+
- [ ] Fixup commits are squashed away
8+
- [ ] Unit tests added/updated
9+
- [ ] Manual testing instructions provided
10+
- [ ] Noted any: Concerns, dependencies, migration issues, deadlines, tickets

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches:
8+
- '**'
9+
10+
jobs:
11+
run_tests:
12+
name: Run Tests and Coverage
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
python-version: ['3.11', '3.12']
18+
toxenv: [quality, docs, django42, django51]
19+
20+
steps:
21+
- name: Check out code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install dependencies
30+
run: pip install -r requirements/pip.txt
31+
32+
- name: Install tox
33+
run: pip install tox
34+
35+
- name: Run Tox
36+
env:
37+
TOXENV: ${{ matrix.toxenv }}
38+
run: tox
39+
40+
- name: Upload coverage to Codecov
41+
if: matrix.python-version == '3.12' && matrix.toxenv == 'django42'
42+
uses: codecov/codecov-action@v4
43+
with:
44+
token: ${{ secrets.CODECOV_TOKEN }}
45+
flags: unittests
46+
fail_ci_if_error: true

.github/workflows/pypi-publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish package to PyPi
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
push:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: 3.12
19+
20+
- name: Install dependencies
21+
run: pip install -r requirements/pip.txt
22+
23+
- name: Build package
24+
run: python setup.py sdist bdist_wheel
25+
26+
- name: Publish to PyPi
27+
uses: pypa/gh-action-pypi-publish@master
28+
with:
29+
user: __token__
30+
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Upgrade Python Requirements
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * 1"
6+
workflow_dispatch:
7+
inputs:
8+
branch:
9+
description: "Target branch against which to create requirements PR"
10+
required: true
11+
default: 'main'
12+
13+
jobs:
14+
call-upgrade-python-requirements-workflow:
15+
uses: openedx/.github/.github/workflows/upgrade-python-requirements.yml@master
16+
with:
17+
branch: ${{ github.event.inputs.branch || 'main' }}
18+
# optional parameters below; fill in if you'd like github or email notifications
19+
# user_reviewers: ""
20+
# team_reviewers: ""
21+
# email_address: ""
22+
# send_success_notification: false
23+
secrets:
24+
requirements_bot_github_token: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
25+
requirements_bot_github_email: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
26+
edx_smtp_username: ${{ secrets.EDX_SMTP_USERNAME }}
27+
edx_smtp_password: ${{ secrets.EDX_SMTP_PASSWORD }}

.gitignore

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
*.py[cod]
2+
__pycache__
3+
.pytest_cache
4+
5+
# C extensions
6+
*.so
7+
8+
# Packages
9+
*.egg
10+
*.egg-info
11+
/dist
12+
/build
13+
/eggs
14+
/parts
15+
/bin
16+
/var
17+
/sdist
18+
/develop-eggs
19+
/.installed.cfg
20+
/lib
21+
/lib64
22+
23+
# Installer logs
24+
pip-log.txt
25+
26+
# Unit test / coverage reports
27+
.cache/
28+
.pytest_cache/
29+
.coverage
30+
.coverage.*
31+
.tox
32+
coverage.xml
33+
htmlcov/
34+
35+
# Virtual environments
36+
/venv/
37+
/venv-*/
38+
/.venv/
39+
/.venv-*/
40+
41+
# The Silver Searcher
42+
.agignore
43+
44+
# OS X artifacts
45+
*.DS_Store
46+
47+
# Logging
48+
log/
49+
logs/
50+
chromedriver.log
51+
ghostdriver.log
52+
53+
# Complexity
54+
output/*.html
55+
output/*/index.html
56+
57+
# Sphinx
58+
docs/_build
59+
docs/modules.rst
60+
docs/xblocks_contrib.rst
61+
docs/xblocks_contrib.*.rst
62+
63+
# Private requirements
64+
requirements/private.in
65+
requirements/private.txt
66+
67+
# Translations
68+
*.mo
69+
*.pot
70+
*.po

.readthedocs.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Build documentation in the docs/ directory with Sphinx
9+
sphinx:
10+
configuration: docs/conf.py
11+
fail_on_warning: true
12+
13+
# Set the version of python needed to build these docs.
14+
build:
15+
os: "ubuntu-lts-latest"
16+
tools:
17+
python: "3.12"
18+
19+
python:
20+
install:
21+
- requirements: requirements/doc.txt
22+
23+
# This will pip install this repo into the python environment
24+
# if you are using this in a repo that is not pip installable
25+
# then you should remove the following two lines.
26+
- method: pip
27+
path: .

CHANGELOG.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Change Log
2+
##########
3+
4+
..
5+
All enhancements and patches to xblocks-contrib will be documented
6+
in this file. It adheres to the structure of https://keepachangelog.com/ ,
7+
but in reStructuredText instead of Markdown (for ease of incorporation into
8+
Sphinx documentation and the PyPI description).
9+
10+
This project adheres to Semantic Versioning (https://semver.org/).
11+
12+
.. There should always be an "Unreleased" section for changes pending release.
13+
14+
Unreleased
15+
**********
16+
17+
*
18+
19+
0.1.0 – 2024-07-04
20+
**********************************************
21+
22+
Added
23+
=====
24+
25+
* First release on PyPI.

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This Dockerfile sets up an XBlock SDK environment for developing and testing XBlocks.
2+
# The following commands in the Makefile facilitate the Docker lifecycle:
3+
# - `make dev.clean`: Cleans up any existing Docker containers and images.
4+
# - `make dev.build`: Builds the Docker image for the XBlock SDK environment.
5+
# - `make dev.run`: Cleans, builds, and runs the container, mapping the local project directory.
6+
7+
FROM openedx/xblock-sdk:latest
8+
9+
WORKDIR /usr/local/src/xblocks-contrib
10+
VOLUME ["/usr/local/src/xblocks-contrib"]
11+
12+
RUN apt-get update && apt-get install -y \
13+
gettext \
14+
&& apt-get clean \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
COPY . /usr/local/src/xblocks-contrib/
18+
19+
RUN pip install -r requirements/dev.txt && pip install --force-reinstall -e .
20+
RUN make compile_translations
21+
22+
ENTRYPOINT ["bash", "-c", "python /usr/local/src/xblock-sdk/manage.py migrate && exec python /usr/local/src/xblock-sdk/manage.py runserver 0.0.0.0:8000"]
23+
EXPOSE 8000

0 commit comments

Comments
 (0)