Skip to content
Nikolaus Sonnenschein edited this page Jul 30, 2015 · 9 revisions

Developer's guide

Tools

We highly recommend PyCharm for developing cameo.

Styleguide

Cameo code pretty much follows PEP8. Lines with > 72 character are ok though. It is safe to use PyCharm code reformatting feature for keeping things tidy and PEP8 conform. We also recommend enabling code reformatting in the commit menu (see screenshot below).

PyCharm reformatting option

Documentation

Cameo docstrings follow numpy's docstring convention because they're human readable (unlike ReStructuredText). Documentation generated with sphinx automatically generates ReStructuredText using the napoleon extension.

File headers

All files should declare utf-8 coding and include license information in the header. The following template should be used

# -*- coding: utf-8 -*-
# Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Logging

This is the preferred way of logging in cameo:

import logging
logger = logging.getLogger(__name__)
logger.debug('Some debug information ...')
logger.info('Some useful information the user might want to see ...')

Access to all of cameo's logs inside a script or a Jupyter notebook can be enabled through

import logging
logger = logging.getLogger('cameo')
logger.setLevel(logging.INFO)  # or logging.DEBUG, logging.ERROR, etc.

or

logger = logging.getLogger('cameo.strain_design.pathway_prediction')

if you want to restrict logging to a particular module.

Clone this wiki locally