nbbdd

BDD for Jupyter Notebooks. Hackday project at SSI Collaborations Workshop 2020. #CollabW2020

https://github.com/pgmccann/nbbdd

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: researchgate.net
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.0%) to scientific vocabulary

Keywords

bdd behavior-driven-development collabw20 gherkin jupyter jupyter-notebook jupyter-notebooks python
Last synced: 6 months ago · JSON representation ·

Repository

BDD for Jupyter Notebooks. Hackday project at SSI Collaborations Workshop 2020. #CollabW2020

Basic Info
  • Host: GitHub
  • Owner: pgmccann
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 37.1 KB
Statistics
  • Stars: 3
  • Watchers: 2
  • Forks: 4
  • Open Issues: 4
  • Releases: 0
Topics
bdd behavior-driven-development collabw20 gherkin jupyter jupyter-notebook jupyter-notebooks python
Created almost 6 years ago · Last pushed almost 6 years ago
Metadata Files
Readme License Citation Codemeta

README.md

License: MIT

BDD for Jupyter Notebooks

This is a Hackday project at the SSI Collaborations Workshop 2020.

This is a Python-based command-line tool for parsing Gherkin code in Markdown cells in a Jupyter Notebook and generating skeleton unit tests which are then inserted into the Notebook at the appropriate points.

The idea of this project is improve the Jupyter notebooks by adding validations but all this is not something new, there is already something available as a plug in for Jupyter called nbval which work nice if you want to use the TDD approach which sometime can be a little bit painful when you are in an early stage prototyping you research. Since TDD (Test Driven Development) can be a little be to much from the beginning we found that it may be helpful to start with a BDD (Behavior-driven development) approach by writing test cases in a natural language that non-programmers can read and also serve as a documentation more or less.

The basic workflow will be:

  1. Create initial notebook
  2. Start writing test cases using natural language combined with Gherkin behaviour markup
  3. nbbdd generates feature and skeleton step files, inserts step code, returns failing test results
  4. Populate skeleton tests with real test code
  5. Start write software while keeping in mind running also the tests until all pass

Some simple example for step 2 using behave

Feature: Fight or Flight (Natural Language, tutorial02)

    In order to increase the ninja survival rate,
    As a ninja commander
    I want my ninjas to decide whether to take on an opponent
    based on their skill levels.

    Scenario: Weaker opponent
        Given the ninja has a third level black-belt
        When attacked by a samurai
        Then the ninja should engage the opponent

    Scenario: Stronger opponent
        Given the ninja has a third level black-belt
        When attacked by Chuck Norris
        Then the ninja should run for his life

Steps 4 and 5 can be identified as the TDD part which already requires some coding skills.

Acknowledgements

This paper helped a lot to understand what should be achieved during the hackday:

Fangohr, H. & Fauske, Vidar & Kluyver, Thomas & Albert, Maximilian & Laslett, Oliver & Cortés-Ortuño, David & Beg, Marijan & Ragan-Kelly, Min. (2020). Testing with Jupyter notebooks: NoteBook VALidation (nbval) plug-in for pytest.

Owner

  • Name: Paddy McCann
  • Login: pgmccann
  • Kind: user
  • Location: St Andrews, UK
  • Company: University of St Andrews

Research Software Engineer in the @StAResComp team at the University of St Andrews. Carpentries instructor working with @St-Andrews-Carpentries.

Citation (CITATION.cff)

# YAML 1.2
---
authors:
  -
    affiliation: "University of Bristol"
    family-names: Massey
    given-names: Jon
    orcid: "https://orcid.org/0000-0002-2497-4040"
  -
    affiliation: "University of St Andrews"
    family-names: McCann
    given-names: Patrick
    orcid: "https://orcid.org/0000-0002-9324-2775"
  -
    affiliation: Figshare
    family-names: Oprea
    given-names: Lucian
cff-version: "1.0.3"
license: MIT
message: "If you use this software, please cite it using these metadata."
repository-code: "https://github.com/pgmccann/nbbdd"
title: "BDD for Jupyter Notebooks"

CodeMeta (codemeta.json)

{
  "@context": [
    "https://doi.org/10.5063/schema/codemeta-2.0",
    "http://schema.org"
  ],
  "@type": "SoftwareSourceCode",
  "author": [
    {
      "@id": "https://orcid.org/0000-0002-2497-4040",
      "@type": "Person",
      "affiliation": {
        "@type": "Organization",
        "legalName": "University of Bristol"
      },
      "familyName": "Massey",
      "givenName": "Jon"
    },
    {
      "@id": "https://orcid.org/0000-0002-9324-2775",
      "@type": "Person",
      "affiliation": {
        "@type": "Organization",
        "legalName": "University of St Andrews"
      },
      "familyName": "McCann",
      "givenName": "Patrick"
    },
    {
      "@type": "Person",
      "affiliation": {
        "@type": "Organization",
        "legalName": "Figshare"
      },
      "familyName": "Oprea",
      "givenName": "Lucian"
    }
  ],
  "codeRepository": "https://github.com/pgmccann/nbbdd",
  "license": "http://www.opensource.org/licenses/MIT",
  "name": "BDD for Jupyter Notebooks",
  "programmingLanguage": "Python"
}

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 6
  • Total pull requests: 11
  • Average time to close issues: about 3 hours
  • Average time to close pull requests: 8 minutes
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 0.17
  • Average comments per pull request: 0.0
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • pgmccann (4)
  • Jongmassey (2)
Pull Request Authors
  • Jongmassey (5)
  • pgmccann (4)
  • lucianoprea (2)
Top Labels
Issue Labels
Pull Request Labels