Commit b8f0eb26 authored by paugier's avatar paugier
Browse files

Cleanup pres on Mercurial

parent 88c63fe0
This diff is collapsed.
This diff is collapsed.
......@@ -50,7 +50,7 @@
"source": [
"A template projet folder is provided (`pyfiles/mypackuga`). Let's first analyze its content.\n",
"There are 1 folder (mypackuga) and 4 files:\n",
"There are 2 folders (`mypackuga` and `doc`) and 4 files:\n",
"- README.rst\n",
%% Cell type:markdown id: tags:
# Python training UGA 2017
**A training to acquire strong basis in Python to use it efficiently**
Pierre Augier (LEGI), Cyrille Bonamy (LEGI), Eric Maldonado (Irstea), Franck Thollard (ISTERRE), Christophe Picard (LJK)
# Packaging, documentation, testing (and argparse)
Let's write your own package with a command line tool!
%% Cell type:markdown id: tags:
## Goal
The goal of this session is produce a small package providing a command line application (or actually what you want!).
You will have to organize your code in different files in a package.
%% Cell type:markdown id: tags:
A template projet folder is provided (`pyfiles/mypackuga`). Let's first analyze its content.
There are 1 folder (mypackuga) and 4 files:
There are 2 folders (`mypackuga` and `doc`) and 4 files:
- README.rst
This file is writen in the markup language "restructuredtext". It should contain a description of the package and instructions how to install it.
This file is important! Don't forget it in your project. It contains the license.
- setup.cfg
This file contains information on the package (its name, the version, a short description, ...)
This is the file to be executed to install the project.
The directory `mypackuga` is the package. It contains the code.
%% Cell type:markdown id: tags:
## Installation
Install the package with:
cd pyfiles/mypackuga
cat README.rst
python develop
The command line utility `mypackuga-raccoon` should be available. Try it!
# to get the help
mypackuga-raccoon -h
# to call the program
# to see where is the corresponding file
which mypackuga-raccoon
%% Cell type:markdown id: tags:
## Documentation of the package
- File `README.rst` or ``
- Directory `doc` in the root directory
- Documentation mainly written in the code (in docstrings)
- Automatically generated with the tool [Sphinx]( (start by running `sphinx-quickstart`)
- [Readthedocs](
%% Cell type:markdown id: tags:
## Testing with pytest
- Python files starting with `test_`
- Execute the test with the command `pytest` (see also `pytest -h`)
%% Cell type:markdown id: tags:
## Analyze the content of the code
Read the content of the files. Try to understand what is written.
## Modify the package.
Modify the code to use your functions from the command line tool. Use more than one file and `import` statements.
Do whatever will be useful for you! Change the names of the package and the command-line application!
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment