Skip to content

Latest commit

 

History

History
200 lines (125 loc) · 5.35 KB

notes.md

File metadata and controls

200 lines (125 loc) · 5.35 KB

how to create markdown from jupyter notebook (named Untitled.ipynb)

ipython nbconvert --to markdown Untitled.ipynb

search all files to find a string

grep -rnw *.py -e "SASSIE_FLOATTYPE"

build docs into directory for github

sphinx-build -b html . ../docs/

0. Identation

Here is an example snippet from a .vimrc file that defines indentation rules. Note that the entire code base will have to be filtered to implement this. Any new code should follow these rules. Developers that use other IDEs should provide their settings for others to benefit.

filetype plugin on
set smartindent
set ts=4
set shiftwidth=4
set expandtab

Here is the indentation rules for Wingware Python IDE (which has also been followed in Emacs24):

Default Tab Size: 4
Default Indent Size: 4
Default Indent Style: Spaces Only

The old existing code base may be corrected in the future using autopep ( https://pypi.python.org/pypi/autopep8/).

SETUP.PY

format for data files:

( path in site-packages, [ path + file_name of file to move] )

format for data files:

( path in site-packages, [ path1 + file_name1 of file to move, path2 + filename2 of file to move] )

I will list single files even if multiple files go to the same place so that editing is easier

data_files = [
        ( os.path.join('sasmol','test_sasmol','manual_tests') , [os.path.join('src','python','test_sasmol','manual_tests','hiv1_gag.pdb')]),
                ( os.path.join('sasmol','test_sasmol','manual_tests') , [os.path.join('src','python','test_sasmol','manual_tests','hiv1_gag_200_frames.dcd')])
                                   ]

EPYDOC

http://epydoc.sourceforge.net/epydoc.html#python-docstrings

def x_intercept(m, b):
    """
    Return the x intercept of the line M{y=m*x+b}.  The X{x intercept}
    of a line is the point at which it crosses the x axis (M{y=0}).

    This function can be used in conjuction with L{z_transform} to
    find an arbitrary function's zeros.

    @type  m: number
    @param m: The slope of the line.
    @type  b: number
    @param b: The y intercept of the line.  The X{y intercept} of a
          line is the point at which it crosses the y axis (M{x=0}).
    @rtype:   number
    @return:  the x intercept of the line M{y=m*x+b}.
    """
    return -b/m

You can compare this function definition with the API documentation generated by epydoc. Note that:

Paragraphs are separated by blank lines. Inline markup has the form "x{...}", where "x" is a single capital letter. This example uses inline markup to mark mathematical expressions ("M{...}"); terms that should be indexed ("X{...}"); and links to the documentation of other objects ("L{...}").

Descriptions of parameters, return values, and types are marked with "@field:" or "@field arg:", where "field" identifies the kind of description, and "arg" specifies what object is described.

def example():
    """
    This is a paragraph.
    1. This is a list item.
       - This is a sublist.
       - The sublist contains two
         items.
          - The second item of the
            sublist has its own sublist.

    2. This list item contains two
        paragraphs and a doctest block.

     >>> print 'This is a doctest block'
     This is a doctest block

     This is the second paragraph.
"""

such as

def example():
    """
    - U{www.python.org}
    - U{http://www.python.org}
    - U{The epydoc homepage<http://
    epydoc.sourceforge.net>}
    - U{The B{Python} homepage
    <www.python.org>}
    - U{Edward Loper<mailto:edloper@
    gradient.cis.upenn.edu>}
   """

5.2.1 Functions and Methods parameters

@param p: ...

A description of the parameter p for a function or method.

@type p: ...

The expected type for the parameter p.

@return: ...

The return value for a function or method.

@rtype: ...

The type of the return value for a function or method.

@keyword p: ...

A description of the keyword parameter p.

@raise e: ...

A description of the circumstances under which a function or method raises exception e.

GIT

https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

config:

git config --list
git config --global core.editor "vi"

(jc@hal)git_working_copies/sasmol% cat /.gitignore_global * .DS_Store *.so *.pyc *.o

git config --global core.excludesfile ~/.gitignore_global 

both of these do not seem to work ???

git config --global core.autocrlf = true
git config --global core.autocrlf = input

but if you merely edit the ~/.gitconfig file it works

(there are other things in this file ... only showing the autocrlf bit

[core]
    autocrlf = input

cloning

git clone https://github.com/madscatt/sasmol.git


git checkout -b add_cpp_section

... do stuff ...

git add ...

git commit -m ''

git push -u sasmol add_cpp_section

(then you CAN use GitHub to merge and delete branch)

(but afterwards on local you must

update the local files already done on GitHub

git pull

make the master the active branch

git checkout master

delete the other branch

git branch -d add_cpp_section

###list branches git branch -av