From 248dde87c56f83f05fc607d27b0e470a0e9e285b Mon Sep 17 00:00:00 2001 From: Luis Moreno Date: Thu, 15 Apr 2021 09:16:48 -0400 Subject: [PATCH] refactor: Rename openedx_events to openedx_hooks --- .coveragerc | 2 +- CHANGELOG.rst | 2 +- MANIFEST.in | 2 +- Makefile | 8 +-- README.rst | 49 +++++++------------ docs/Makefile | 8 +-- docs/conf.py | 16 +++--- docs/index.rst | 6 +-- docs/make.bat | 4 +- docs/testing.rst | 2 +- openedx.yaml | 2 +- openedx_events/__init__.py | 5 -- openedx_hooks/__init__.py | 5 ++ .../signals/__init__.py | 0 .../signals/auth/__init__.py | 0 .../signals/auth/v1/__init__.py | 2 +- .../signals/enrollment/__init__.py | 0 .../signals/enrollment/v1/__init__.py | 2 +- setup.py | 12 ++--- tests/test_openedx_events.py | 4 +- tox.ini | 4 +- 21 files changed, 62 insertions(+), 73 deletions(-) delete mode 100644 openedx_events/__init__.py create mode 100644 openedx_hooks/__init__.py rename {openedx_events => openedx_hooks}/signals/__init__.py (100%) rename {openedx_events => openedx_hooks}/signals/auth/__init__.py (100%) rename {openedx_events => openedx_hooks}/signals/auth/v1/__init__.py (87%) rename {openedx_events => openedx_hooks}/signals/enrollment/__init__.py (100%) rename {openedx_events => openedx_hooks}/signals/enrollment/v1/__init__.py (87%) diff --git a/.coveragerc b/.coveragerc index 6e796b61..df193167 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,6 @@ [run] branch = True data_file = .coverage -source=openedx_events +source=openedx_hooks omit = tests diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bb7b56aa..4e9f1948 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,7 +2,7 @@ Change Log ---------- .. - All enhancements and patches to openedx_events will be documented + All enhancements and patches to openedx_hooks will be documented in this file. It adheres to the structure of https://keepachangelog.com/ , but in reStructuredText instead of Markdown (for ease of incorporation into Sphinx documentation and the PyPI description). diff --git a/MANIFEST.in b/MANIFEST.in index 3099f8e7..23ed634e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,4 @@ include CHANGELOG.rst include LICENSE.txt include README.rst include requirements/base.in -recursive-include openedx_events *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py +recursive-include openedx_hooks *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py diff --git a/Makefile b/Makefile index 4c701e17..821970eb 100644 --- a/Makefile +++ b/Makefile @@ -48,11 +48,11 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy quality: ## check coding style with pycodestyle and pylint touch tests/__init__.py - pylint openedx_events tests test_utils *.py + pylint openedx_hooks tests test_utils *.py rm tests/__init__.py - pycodestyle openedx_events tests *.py - pydocstyle openedx_events tests *.py - isort --check-only --diff --recursive tests test_utils openedx_events *.py test_settings.py + pycodestyle openedx_hooks tests *.py + pydocstyle openedx_hooks tests *.py + isort --check-only --diff --recursive tests test_utils openedx_hooks *.py test_settings.py python setup.py bdist_wheel twine check dist/* make selfcheck diff --git a/README.rst b/README.rst index d3c5dd6e..7ac78765 100644 --- a/README.rst +++ b/README.rst @@ -1,22 +1,11 @@ -openedx-events +openedx-hooks ============================= -|pypi-badge| |ci-badge| |codecov-badge| |doc-badge| |pyversions-badge| +|pypi-badge| |ci-badge| |codecov-badge| |pyversions-badge| |license-badge| -The ``README.rst`` file should start with a brief description of the repository, -which sets it in the context of other repositories under the ``edx`` -organization. It should make clear where this fits in to the overall edX -codebase. +openedx-hooks is a python library that contains the common definitions (django signals) and utilities for the Open edX hooks framework. -What is this project? - -Overview (please modify) ------------------------- - -The ``README.rst`` file should then provide an overview of the code in this -repository, including the main components and useful entry points for starting -to understand the code in more detail. Documentation ------------- @@ -31,11 +20,11 @@ One Time Setup .. code-block:: # Clone the repository - git clone git@github.com:edx/openedx-events.git - cd openedx-events + git clone git@github.com:edx/openedx-hooks.git + cd openedx-hooks # Set up a virtualenv using virtualenvwrapper with the same name as the repo and activate it - mkvirtualenv -p python3.8 openedx-events + mkvirtualenv -p python3.8 openedx-hooks Every time you develop something in this repo @@ -43,7 +32,7 @@ Every time you develop something in this repo .. code-block:: # Activate the virtualenv - workon openedx-events + workon openedx-hooks # Grab the latest code git checkout master @@ -113,26 +102,26 @@ For more information about these options, see the `Getting Help`_ page. .. _community Slack workspace: https://openedx.slack.com/ .. _Getting Help: https://openedx.org/getting-help -.. |pypi-badge| image:: https://img.shields.io/pypi/v/openedx-events.svg - :target: https://pypi.python.org/pypi/openedx-events/ +.. |pypi-badge| image:: https://img.shields.io/pypi/v/openedx-hooks.svg + :target: https://pypi.python.org/pypi/openedx-hooks/ :alt: PyPI -.. |ci-badge| image:: https://github.com/edx/openedx-events/workflows/Python%20CI/badge.svg?branch=master - :target: https://github.com/edx/openedx-events/actions +.. |ci-badge| image:: https://github.com/edunext/openedx-hooks/workflows/Python%20CI/badge.svg?branch=main + :target: https://github.com/edunext/openedx-hooks/actions :alt: CI -.. |codecov-badge| image:: https://codecov.io/github/edx/openedx-events/coverage.svg?branch=master - :target: https://codecov.io/github/edx/openedx-events?branch=master +.. |codecov-badge| image:: https://codecov.io/github/edunext/openedx-hooks/coverage.svg?branch=master + :target: https://codecov.io/github/edunext/openedx-hooks?branch=main :alt: Codecov -.. |doc-badge| image:: https://readthedocs.org/projects/openedx-events/badge/?version=latest - :target: https://openedx-events.readthedocs.io/en/latest/ +.. |doc-badge| image:: https://readthedocs.org/projects/openedx-hooks/badge/?version=latest + :target: https://openedx-hooks.readthedocs.io/en/latest/ :alt: Documentation -.. |pyversions-badge| image:: https://img.shields.io/pypi/pyversions/openedx-events.svg - :target: https://pypi.python.org/pypi/openedx-events/ +.. |pyversions-badge| image:: https://img.shields.io/pypi/pyversions/openedx-hooks.svg + :target: https://pypi.python.org/pypi/openedx-hooks/ :alt: Supported Python versions -.. |license-badge| image:: https://img.shields.io/github/license/edx/openedx-events.svg - :target: https://github.com/edx/openedx-events/blob/master/LICENSE.txt +.. |license-badge| image:: https://img.shields.io/github/license/edx/openedx-hooks.svg + :target: https://github.com/edunext/openedx-hooks/blob/main/LICENSE.txt :alt: License diff --git a/docs/Makefile b/docs/Makefile index 11bed386..9d1be160 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -96,9 +96,9 @@ qthelp: @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/openedx-events.qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/openedx-hooks.qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/openedx-events.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/openedx-hooks.qhc" .PHONY: applehelp applehelp: @@ -115,8 +115,8 @@ devhelp: @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/openedx-events" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/openedx-events" + @echo "# mkdir -p $$HOME/.local/share/devhelp/openedx-hooks" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/openedx-hooks" @echo "# devhelp" .PHONY: epub diff --git a/docs/conf.py b/docs/conf.py index 3adb5550..7c6d65aa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ # pylint: disable=invalid-name """ -openedx-events documentation build configuration file. +openedx-hooks documentation build configuration file. This file is execfile()d with the current directory set to its containing dir. @@ -40,7 +40,7 @@ def get_version(*file_paths): REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(REPO_ROOT) -VERSION = get_version('../openedx_events', '__init__.py') +VERSION = get_version('../openedx_hooks', '__init__.py') # If extensions (or modules to document with autodoc) are in another directory, @@ -91,10 +91,10 @@ def get_version(*file_paths): top_level_doc = 'index' # General information about the project. -project = 'openedx-events' +project = 'openedx-hooks' copyright = edx_theme.COPYRIGHT # pylint: disable=redefined-builtin author = edx_theme.AUTHOR -project_title = 'openedx-events' +project_title = 'openedx-hooks' documentation_title = "{project_title}".format(project_title=project_title) @@ -102,7 +102,7 @@ def get_version(*file_paths): html_context = { "display_github": True, # Integrate GitHub "github_user": "edx", # Username - "github_repo": 'openedx-events', # Repo name + "github_repo": 'openedx-hooks', # Repo name "github_version": "master", # Version "conf_py_path": "/docs/", # Path in the checkout to the docs root } @@ -188,7 +188,7 @@ def get_version(*file_paths): # The name for this set of Sphinx documents. # " v documentation" by default. # -# html_title = 'openedx-events v0.1.0' +# html_title = 'openedx-hooks v0.1.0' # A shorter title for the navigation bar. Default is the same as html_title. # @@ -500,8 +500,8 @@ def on_init(app): # pylint: disable=unused-argument # If we are, assemble the path manually bin_path = os.path.abspath(os.path.join(sys.prefix, 'bin')) apidoc_path = os.path.join(bin_path, apidoc_path) - check_call([apidoc_path, '-o', docs_path, os.path.join(root_path, 'openedx_events'), - os.path.join(root_path, 'openedx_events/migrations')]) + check_call([apidoc_path, '-o', docs_path, os.path.join(root_path, 'openedx_hooks'), + os.path.join(root_path, 'openedx_hooks/migrations')]) def setup(app): diff --git a/docs/index.rst b/docs/index.rst index 4169bc0d..55c4f728 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,12 +1,12 @@ -.. openedx-events documentation top level file, created by +.. openedx-hooks documentation top level file, created by sphinx-quickstart on Wed Apr 07 10:13:29 2021. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -openedx-events +openedx-hookss ============== -What is this project? +Library with definitions and utilities for the Open edX hooks framework. Contents: diff --git a/docs/make.bat b/docs/make.bat index 6381ee5b..d2b12bd1 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -129,9 +129,9 @@ if "%1" == "qthelp" ( echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\openedx-events.qhcp + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\openedx-hooks.qhcp echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\openedx-events.ghc + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\openedx-hooks.ghc goto end ) diff --git a/docs/testing.rst b/docs/testing.rst index a847b39a..cb254aba 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -3,7 +3,7 @@ Testing ======= -openedx-events has an assortment of test cases and code quality +openedx-hooks has an assortment of test cases and code quality checks to catch potential problems during development. To run them all in the version of Python you chose for your virtualenv: diff --git a/openedx.yaml b/openedx.yaml index 71a694dd..99c88620 100644 --- a/openedx.yaml +++ b/openedx.yaml @@ -2,7 +2,7 @@ # https://open-edx-proposals.readthedocs.io/en/latest/oep-0002-bp-repo-metadata.html#specification --- -nick: openedx-events +nick: openedx-hooks tags: - tools oeps: diff --git a/openedx_events/__init__.py b/openedx_events/__init__.py deleted file mode 100644 index 4a53fb0a..00000000 --- a/openedx_events/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -""" -Events of the openedx platform. -""" - -__version__ = "0.1.0" diff --git a/openedx_hooks/__init__.py b/openedx_hooks/__init__.py new file mode 100644 index 00000000..2ef202c1 --- /dev/null +++ b/openedx_hooks/__init__.py @@ -0,0 +1,5 @@ +""" +Hooks library for the openedx platform. +""" + +__version__ = "0.1.0" diff --git a/openedx_events/signals/__init__.py b/openedx_hooks/signals/__init__.py similarity index 100% rename from openedx_events/signals/__init__.py rename to openedx_hooks/signals/__init__.py diff --git a/openedx_events/signals/auth/__init__.py b/openedx_hooks/signals/auth/__init__.py similarity index 100% rename from openedx_events/signals/auth/__init__.py rename to openedx_hooks/signals/auth/__init__.py diff --git a/openedx_events/signals/auth/v1/__init__.py b/openedx_hooks/signals/auth/v1/__init__.py similarity index 87% rename from openedx_events/signals/auth/v1/__init__.py rename to openedx_hooks/signals/auth/v1/__init__.py index 9b040a09..69f069db 100644 --- a/openedx_events/signals/auth/v1/__init__.py +++ b/openedx_hooks/signals/auth/v1/__init__.py @@ -1,5 +1,5 @@ """ -openedx_events.signals.auth.v1 module. +openedx_hooks.signals.auth.v1 module. """ from django.dispatch import Signal diff --git a/openedx_events/signals/enrollment/__init__.py b/openedx_hooks/signals/enrollment/__init__.py similarity index 100% rename from openedx_events/signals/enrollment/__init__.py rename to openedx_hooks/signals/enrollment/__init__.py diff --git a/openedx_events/signals/enrollment/v1/__init__.py b/openedx_hooks/signals/enrollment/v1/__init__.py similarity index 87% rename from openedx_events/signals/enrollment/v1/__init__.py rename to openedx_hooks/signals/enrollment/v1/__init__.py index 30861b5a..69c636e6 100644 --- a/openedx_events/signals/enrollment/v1/__init__.py +++ b/openedx_hooks/signals/enrollment/v1/__init__.py @@ -1,5 +1,5 @@ """ -openedx_events.signals.enrollment.v1 module. +openedx_hooks.signals.enrollment.v1 module. """ from django.dispatch import Signal diff --git a/setup.py b/setup.py index 898fa1bc..e66d3e97 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -Package metadata for openedx_events. +Package metadata for openedx_hooks. """ import os import re @@ -53,7 +53,7 @@ def is_requirement(line): return line and not line.startswith(('-r', '#', '-e', 'git+', '-c')) -VERSION = get_version('openedx_events', '__init__.py') +VERSION = get_version('openedx_hooks', '__init__.py') if sys.argv[-1] == 'tag': print("Tagging the version on github:") @@ -65,15 +65,15 @@ def is_requirement(line): CHANGELOG = open(os.path.join(os.path.dirname(__file__), 'CHANGELOG.rst')).read() setup( - name='openedx-events', + name='openedx-hooks', version=VERSION, - description="""What is this project?""", + description="""Open edX hooks definitions and utilities.""", long_description=README + '\n\n' + CHANGELOG, author='edX', author_email='oscm@edx.org', - url='https://github.com/edx/openedx-events', + url='https://github.com/edx/openedx-hooks', packages=[ - 'openedx_events', + 'openedx_hooks', ], include_package_data=True, install_requires=load_requirements('requirements/base.in'), diff --git a/tests/test_openedx_events.py b/tests/test_openedx_events.py index 414734f3..277ba898 100644 --- a/tests/test_openedx_events.py +++ b/tests/test_openedx_events.py @@ -1,11 +1,11 @@ """ -Tests for openedx_events.py. +Tests for openedx_hooks.py. """ class TestEvents: """ - Tests of openedx events. + Tests of openedx hooks. """ def test_something(self): diff --git a/tox.ini b/tox.ini index 0d04be5e..395bbba3 100644 --- a/tox.ini +++ b/tox.ini @@ -32,7 +32,7 @@ ignore = D101,D200,D203,D212,D215,D404,D405,D406,D407,D408,D409,D410,D411,D412,D [pytest] -addopts = --cov openedx_events --cov-report term-missing --cov-report xml +addopts = --cov openedx_hooks --cov-report term-missing --cov-report xml norecursedirs = .* docs requirements site-packages [testenv] @@ -51,7 +51,7 @@ deps = -r{toxinidir}/requirements/doc.txt commands = doc8 --ignore-path docs/_build README.rst docs - rm -f docs/openedx_events.rst + rm -f docs/openedx_hooks.rst rm -f docs/modules.rst make -C docs clean make -C docs html