Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cleanup #775

Merged
merged 4 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
include xblock/VERSION.txt
recursive-include xblock *.mo *.po
48 changes: 29 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,30 @@ Developing
One Time Setup
--------------

.. code-block::
First, clone the repository:

.. code-block:: bash

# Clone the repository
git clone [email protected]: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
Expand Down Expand Up @@ -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
********************
Expand All @@ -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
----------------
Expand All @@ -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
=========
Expand Down Expand Up @@ -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
************
Expand Down Expand Up @@ -207,24 +217,24 @@ Please do not report security issues in public. Please email [email protected]
: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
Expand Down
4 changes: 2 additions & 2 deletions xblock/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions xblock/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand All @@ -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.


Expand All @@ -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-.
Expand Down
2 changes: 1 addition & 1 deletion xblock/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading