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

refactor: Fix linting, testing, CI, remove old backends and logs #32

Merged
merged 5 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[run]
branch = True
data_file = .coverage
source=xapi-db-load
source=xapi_db_load
omit =
tests
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run all tests & checks

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
tests:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install development dependencies
run: make requirements

- name: Tests
run: tox
22 changes: 12 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Scripts for generating and loading test xAPI events
===================================================
***************************************************

|pypi-badge| |ci-badge| |codecov-badge| |doc-badge| |pyversions-badge|
|license-badge| |status-badge|


Purpose
*******
=======

Some test scripts to help make apples-to-apples comparisons of different
database backends for xAPI events. Supports direct database connections to
bmtcril marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -19,10 +19,10 @@ event-routing-backends package, but are not yet maintained to advance alongside
them.

Getting Started
***************
===============

Usage
=====
-----

Details of how to run the current version of the script can be found by executing:

Expand All @@ -32,10 +32,11 @@ Details of how to run the current version of the script can be found by executin


Developing
==========
----------

One Time Setup
--------------
^^^^^^^^^^^^^^

.. code-block::

# Clone the repository
Expand All @@ -47,7 +48,8 @@ One Time Setup


Every time you develop something in this repo
---------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block::

# Activate the virtualenv
Expand Down Expand Up @@ -83,18 +85,18 @@ Every time you develop something in this repo


Getting Help
************
============

Documentation
=============
-------------

Start by going through `the documentation`_ (in progress!).

.. _the documentation: https://docs.openedx.org/projects/xapi-db-load


More Help
=========
---------

If you're having trouble, we have discussion forums at
https://discuss.openedx.org where you can connect with others in the
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ coverage:
patch:
default:
enabled: yes
target: 100%
target: 72%
bmtcril marked this conversation as resolved.
Show resolved Hide resolved

comment: false
89 changes: 44 additions & 45 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def get_version(*file_paths):
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError('Unable to find version string.')
raise RuntimeError("Unable to find version string.")


REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(REPO_ROOT)

VERSION = get_version('../xapi_db_load', '__init__.py')
VERSION = get_version("../xapi_db_load", "__init__.py")


# If extensions (or modules to document with autodoc) are in another directory,
Expand All @@ -58,48 +58,48 @@ def get_version(*file_paths):
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon'
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.ifconfig",
"sphinx.ext.napoleon",
]

# A list of warning types to suppress arbitrary warning messages.
suppress_warnings = [
'image.nonlocal_uri',
"image.nonlocal_uri",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
#
# source_encoding = 'utf-8-sig'

# The top level toctree document.
top_level_doc = 'index'
top_level_doc = "index"

# General information about the project.
project = 'xapi-db-load'
project = "xapi-db-load"
current_year = datetime.utcnow().year
copyright = f"{current_year}, The Center for Reimagining Learning" # pylint: disable=redefined-builtin
author = "Open edX"
project_title = 'xapi-db-load'
project_title = "xapi-db-load"
documentation_title = f"{project_title}"


# Set display_github to False if you don't want "edit on Github" button
html_context = {
"display_github": True, # Integrate GitHub
"github_user": "edx", # Username
"github_repo": 'xapi-db-load', # Repo name
"github_repo": "xapi-db-load", # Repo name
"github_version": "main", # Version
"conf_py_path": "/docs/", # Path in the checkout to the docs root
}
Expand All @@ -118,7 +118,7 @@ def get_version(*file_paths):
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand All @@ -133,12 +133,12 @@ def get_version(*file_paths):
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = [
'_build',
'Thumbs.db',
'.DS_Store',
"_build",
"Thumbs.db",
".DS_Store",
# This file is intended as a guide for developers browsing the source tree,
# not to be rendered into the output docs.
'decisions/README_orig.rst',
"decisions/README_orig.rst",
]

# The reST default role (used for this markup: `text`) to use for all
Expand All @@ -161,7 +161,7 @@ def get_version(*file_paths):
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -178,14 +178,14 @@ def get_version(*file_paths):
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.

html_theme = 'sphinx_book_theme'
html_theme = "sphinx_book_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"repository_url": "https://github.com/openedx/xapi-db-load",
"repository_branch": 'main',
"repository_branch": "main",
"path_to_docs": "docs/",
"logo_only": True,
"home_page_in_toc": True,
Expand Down Expand Up @@ -213,7 +213,7 @@ def get_version(*file_paths):
rel="license"
href="https://creativecommons.org/licenses/by-sa/4.0/"
>Creative Commons Attribution-ShareAlike 4.0 International License</a>.
"""
""",
}

# Note the logo won't show up properly yet because there is an upstream
Expand Down Expand Up @@ -328,23 +328,20 @@ def get_version(*file_paths):
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = f'{project}doc'
htmlhelp_basename = f"{project}doc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -353,10 +350,9 @@ def get_version(*file_paths):
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_target = f'{project}.tex'
latex_target = f"{project}.tex"
latex_documents = [
(top_level_doc, latex_target, documentation_title,
author, 'manual'),
(top_level_doc, latex_target, documentation_title, author, "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -396,10 +392,7 @@ def get_version(*file_paths):

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(top_level_doc, project_title, documentation_title,
[author], 1)
]
man_pages = [(top_level_doc, project_title, documentation_title, [author], 1)]

# If true, show URL addresses after external links.
#
Expand All @@ -412,9 +405,15 @@ def get_version(*file_paths):
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(top_level_doc, project_title, documentation_title,
author, project_title, 'Load test xAPI statements to a database or LRS',
'Miscellaneous'),
(
top_level_doc,
project_title,
documentation_title,
author,
project_title,
"Load test xAPI statements to a database or LRS",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand Down Expand Up @@ -488,7 +487,7 @@ def get_version(*file_paths):
# epub_post_files = []

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
epub_exclude_files = ["search.html"]

# The depth of the table of contents in toc.ncx.
#
Expand Down Expand Up @@ -521,7 +520,7 @@ def get_version(*file_paths):

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('https://docs.python.org/3.8', None),
"python": ("https://docs.python.org/3.8", None),
}


Expand All @@ -533,16 +532,16 @@ def on_init(app): # pylint: disable=unused-argument
avoid checking in the generated reStructuredText files.
"""
docs_path = os.path.abspath(os.path.dirname(__file__))
root_path = os.path.abspath(os.path.join(docs_path, '..'))
apidoc_path = 'sphinx-apidoc'
if hasattr(sys, 'real_prefix'): # Check to see if we are in a virtualenv
root_path = os.path.abspath(os.path.join(docs_path, ".."))
apidoc_path = "sphinx-apidoc"
if hasattr(sys, "real_prefix"): # Check to see if we are in a virtualenv
# If we are, assemble the path manually
bin_path = os.path.abspath(os.path.join(sys.prefix, 'bin'))
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, 'xapi_db_load')])
check_call([apidoc_path, "-o", docs_path, os.path.join(root_path, "xapi_db_load")])


def setup(app):
"""Sphinx extension: run sphinx-apidoc."""
event = 'builder-inited'
event = "builder-inited"
app.connect(event, on_init)
Loading