diff --git a/MANIFEST.in b/MANIFEST.in index 8d537e152..d8417390b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1 @@ -include xblock/VERSION.txt recursive-include xblock *.mo *.po diff --git a/README.rst b/README.rst index d4d40ae76..1f9c608c3 100644 --- a/README.rst +++ b/README.rst @@ -38,25 +38,30 @@ Developing One Time Setup -------------- -.. code-block:: +First, clone the repository: + +.. code-block:: bash - # Clone the repository git clone git@github.com:openedx/XBlock.git - cd XBlock - # Set up a virtualenv using virtualenvwrapper with the same name as the repo and activate it +Go to the XBlock directory, set up a virtual environment using ``virtualenvwrapper`` with +the same name as the repo and activate it: + +.. code-block:: bash + + cd XBlock mkvirtualenv -p python3.11 XBlock Every time you develop something in this repo --------------------------------------------- -.. code-block:: +.. code-block:: bash # Activate the virtualenv workon XBlock # Grab the latest code - git checkout main + git checkout master git pull # Install/update the dev requirements @@ -88,12 +93,14 @@ Deploying To package a new release: -#. Describe the release in CHANGELOG.rst +#. Describe the release in `CHANGELOG.rst`_ -#. Update the version number in xblock/VERSION.txt. +#. Update the ``__version__`` number in `xblock/__init__.py`_ -#. Use the github release mechanism to release a new version. This will tag and publish the package. +#. Use the github release mechanism to release a new version. This will tag and publish the package. +.. _CHANGELOG.rst: https://github.com/openedx/XBlock/blob/master/CHANGELOG.rst +.. _xblock/__init__.py: https://github.com/openedx/XBlock/blob/master/xblock/__init__.py Using the XBlock-SDK ******************** @@ -104,13 +111,13 @@ that demonstrate XBlock functionality. You can find it in its own repository: https://github.com/openedx/xblock-sdk - Getting Help ************ Documentation ============= -The docs for the XBlock API is on Read The Docs: https://xblock.readthedocs.org . + +The docs for the XBlock API is on Read The Docs: https://xblock.readthedocs.org . Reading the code ---------------- @@ -135,7 +142,9 @@ Making an XBlock can be as simple as creating a Python class with a few specific methods. Instructions for constructing a new XBlock along with examples can be found in -the XBlock SDK: https://github.com/openedx/xblock-sdk +the `XBlock SDK`_. + +.. _XBlock SDK: https://github.com/openedx/xblock-sdk More Help ========= @@ -165,8 +174,9 @@ License The code in this repository is licensed the Apache 2.0 license unless otherwise noted. -Please see ``LICENSE.txt`` for details. +Please see `LICENSE.txt`_ for details. +.. _LICENSE.txt: https://github.com/openedx/XBlock/blob/master/LICENSE.txt Contributing ************ @@ -207,24 +217,24 @@ Please do not report security issues in public. Please email security@openedx.or :target: https://pypi.python.org/pypi/XBlock/ :alt: PyPI -.. |ci-badge| image:: https://github.com/openedx/XBlock/workflows/Python%20CI/badge.svg?branch=main +.. |ci-badge| image:: https://github.com/openedx/XBlock/workflows/Python%20CI/badge.svg?branch=master :target: https://github.com/openedx/XBlock/actions :alt: CI -.. |codecov-badge| image:: https://codecov.io/github/openedx/XBlock/coverage.svg?branch=main - :target: https://codecov.io/github/openedx/XBlock?branch=main +.. |codecov-badge| image:: https://codecov.io/github/openedx/XBlock/coverage.svg?branch=master + :target: https://codecov.io/github/openedx/XBlock?branch=master :alt: Codecov .. |doc-badge| image:: https://readthedocs.org/projects/XBlock/badge/?version=latest - :target: https://XBlock.readthedocs.io/en/latest/ + :target: https://edx.readthedocs.io/projects/xblock/en/latest/ :alt: Documentation .. |pyversions-badge| image:: https://img.shields.io/pypi/pyversions/XBlock.svg - :target: https://pypi.python.org/pypi/XBlock/ + :target: https://edx.readthedocs.io/projects/xblock/en/latest/ :alt: Supported Python versions .. |license-badge| image:: https://img.shields.io/github/license/openedx/XBlock.svg - :target: https://github.com/openedx/XBlock/blob/main/LICENSE.txt + :target: https://github.com/openedx/XBlock/blob/master/LICENSE.txt :alt: License .. |status-badge| image:: https://img.shields.io/badge/Status-Maintained-brightgreen diff --git a/xblock/core.py b/xblock/core.py index 4dc42bce8..7ff362475 100644 --- a/xblock/core.py +++ b/xblock/core.py @@ -151,7 +151,7 @@ def open_local_resource(cls, uri): if not uri.startswith(cls.public_dir + '/'): raise DisallowedFileError(f"Only files from {cls.public_dir!r}/ are allowed: {uri!r}") - # Disalow paths that have a '/.' component, as `/./` is a no-op and `/../` + # Disallow paths that have a '/.' component, as `/./` is a no-op and `/../` # can be used to recurse back past the entry point of this XBlock. if "/." in uri: raise DisallowedFileError("Only safe file names are allowed: %r" % uri) @@ -724,7 +724,7 @@ def load_tagged_classes(cls, tag, fail_silently=True): plugin cannot import. The goal is to be able to use part of libraries from an XBlock (and thus have it installed), even if the overall XBlock cannot be used (e.g. depends on Django in a - non-Django application). There is diagreement about whether + non-Django application). There is disagreement about whether this is a good idea, or whether we should see failures early (e.g. on startup or first page load), and in what contexts. Hence, the flag. diff --git a/xblock/fields.py b/xblock/fields.py index 60ce960b6..9f814ce06 100644 --- a/xblock/fields.py +++ b/xblock/fields.py @@ -1036,7 +1036,7 @@ class ReferenceList(List): It's up to the runtime to know how to dereference the elements of the list. The field type enables the runtime to know that it must do the interpretation. """ - # this could define from_json and to_json as list comprehensions calling from/to_json on the list eles, + # this could define from_json and to_json as list comprehensions calling from/to_json on the list elements, # but since Reference doesn't stipulate a definition for from/to, that seems unnecessary at this time. @@ -1047,7 +1047,7 @@ class ReferenceValueDict(Dict): It's up to the runtime to know how to dereference the elements of the list. The field type enables the runtime to know that it must do the interpretation. """ - # this could define from_json and to_json as list comprehensions calling from/to_json on the list eles, + # this could define from_json and to_json as list comprehensions calling from/to_json on the list elements, # but since Reference doesn't stipulate a definition for from/to, that seems unnecessary at this time. @@ -1071,7 +1071,7 @@ def scope_key(instance, xblock): We separate field portions with /. This gives a natural directory tree. This is nice in URLs and filenames (although not so nice in urls.py) - If a field starts with punctuatation, we prefix a _. This prevents hidden files. + If a field starts with punctuation, we prefix a _. This prevents hidden files. Uncommon characters, we encode as their ordinal value, surrounded by -. For example, tilde would be -126-. diff --git a/xblock/utils/helpers.py b/xblock/utils/helpers.py index 941daa3b4..f897f5ee6 100644 --- a/xblock/utils/helpers.py +++ b/xblock/utils/helpers.py @@ -10,7 +10,7 @@ def child_isinstance(block, child_id, block_class_or_mixin): Arguments: block -- the parent (or ancestor) of the child block in question child_id -- the usage key of the child block we are wondering about - block_class_or_mixin -- We return true if block's child indentified by child_id is an + block_class_or_mixin -- We return true if block's child identified by child_id is an instance of this. This method is equivalent to