Skip to content
Snippets Groups Projects

docs: enhance package structure

Merged Audrius Mecionis requested to merge github/fork/hjhsalo/initial-sphinx-docs into master

Created by: hjhsalo

  • add initial Sphinx documentation structure, with license, authors, etc. (closes #1 (closed))
  • add initial Travis CI configuration and tests
  • add copyright header messages to each source code file

Signed-off-by: Harri Hirvonsalo harri.hirvonsalo@cern.ch

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Audrius Mecionis
    Audrius Mecionis @amecioni started a thread on commit 32dd0a82
  • 6 # Foundation; either version 2 of the License, or (at your option) any later
    7 # version.
    8 #
    9 # REANA is distributed in the hope that it will be useful, but WITHOUT ANY
    10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
    11 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    12 #
    13 # You should have received a copy of the GNU General Public License along with
    14 # REANA; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
    15 # Suite 330, Boston, MA 02111-1307, USA.
    16 #
    17 # In applying this license, CERN does not waive the privileges and immunities
    18 # granted to it by virtue of its status as an Intergovernmental Organization or
    19 # submit itself to any jurisdiction.
    20
    21 include Dockerfile
  • Created by: hjhsalo

    What has been updated (25.4.2017)

    • I changed the structure of the module a bit and added a Alpine Linux based Dockerfile (python:2.7-alpine)
    • Python code now greets and stores (appends) the greeting to a filepath given as function parameters. (Defaults to "Hello World!" and 'output/output.txt')
    • Greeting is written character by character. There is an optional waiting period between write of each character.
    • Behaviour can be changed using environment variables (REANA_DEMO_NAME, REANA_DEMO_OUTPUTFILE, REANA_DEMO_SLEEPTIMER). Checking for environment variables is done in Python code and not e.g. in Dockerfile.

    To test with Docker

    • Build and run with altering the greeting and outputfolder. Note: If output-directory doesn't exist, making a local volume mount with -v option causes the output-folder to be created with root-permissions. Python script inside the Docker Container is run with root-priviledges -> owner of output-file if root.
      $ docker build -t reanahub/reana-demo-helloworld .
      $ mkdir output
      $ docker run --rm -v $PWD/output/:/code/output \
                   reanahub/reana-demo-helloworld \
                   python reana_demo_helloworld/helloworld.py \
                   --name "J. Doe" \
                   --outputfile output/output.txt \
                   --sleeptimer 0.5
    • Check the content of 'output/output.txt' for the greeting. (Should contain "Hello, J. Doe!")
      $ cat output/output.txt

    Notes and possible improvements

    • Naming of things could be changed a bit, e.g. outputfile -> outputpath. Any comments / preferences / conventions on this?
    • There are three simple test cases, which are infact partly overlapping. Should I refactor them to one test case that covers both hello() and main()?
    • Is it OK to add .coveragerc -file to exclude unnecessary checks such as 'if __name__ == "__main__":' to reach 100% coverage?
    • Had to use os.path.dirname(__file__) in docs/conf.py to get rid of IOErrors about not existing version.py -file. I don't know how portable this is between operating systems, but then again, we are not supporting Windows. This should work, but there are many (better?) ways to achieve the same end result. Should I change this to something else?
    • I didn't specify a config.py as amount of configurable things is (still?) low. On the other hand, this demo-helloworld could serve as a reference structure for other reana-demo-examples and it might be beneficial to do everything by the book / de facto standards. The same reasoning applies for tests. Should I do this in some other way?

    Notes on Docker Image sizes I opted for Alpine Linux based image to shrink down the filesize of the resulting Docker Image. To further slim down the image I only install reana-demo-helloworld module and not it's dependencies needed to run tests or build documentation. Here is a summary for comparison of Debian based image vs Alpine based one and the impact of not installing by .[all]:

    • Python:2.7 = 745MB
    • Python:2.7-alpine = 144MB
    • Python:2.7-alpine + pip install without [all] -flag = 78.6MB

    Further slimming down the size of image might be possible. I have to look into it later.

  • Created by: hjhsalo

    BTW, should I include the instruction part in documentation? I'm not yet sure how this will be integrated to actual reanahub/reana installation and left out any usage instructions from the documentation for this reason.

  • Audrius Mecionis
  • Audrius Mecionis
  • Audrius Mecionis
  • Audrius Mecionis
  • Audrius Mecionis
  • Created by: diegodelemos

    Review: Approved

  • Merged by: diegodelemos at 2017-04-25 12:39:10 UTC

  • Please register or sign in to reply
    Loading