Giter VIP home page Giter VIP logo

pytasa's People

Contributors

alanfbaird avatar andreww avatar jack-walp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pytasa's Issues

Licence

We need to pick (and add) a licence.

Object model

Things will probably be easer to use if we end up representing elasticity as an object with most of the current functions as methods. However, we need to sketch out how this should work. This issue is for this sketch.

More testing stuff

We should have a test case to check the code style matches PEP8. There is a library for this so that should be easy. Obspy has one implementation but we should go much simpler.

It is also worth adding coverage monitoring for the test cases. This blog post outlines how to do this with pytest, but we use nose so that would need modification.

While we are at it, we may want to think about moving from nosetest to pytest (as nose is deprecated) but the test cases would need a bit of work.

Examples

We should have some examples. These could mirror the examples in MSAT or could be new. We need to decide if these should be as ipython notebooks or something else.

Ideas below!

MS_expand not implemented

One left over feature from the MS_load reimplementation is the ability to 'expand' a limited set of elastic constants to a full matrix. In MSAT this is done in MS_expand. When MS_expand is implemented this feature should be added to the io module.

Python 3 notes

At some point we should add a developers guide, and this will need to address python 2/3 compatibility. For now, list the main points here and below.

Main points

Try to write in idiomatic python3 with python2 compatibility limited (where possible) to module imports. As far as python2 goes, we only care about 2.7 (which is the only modern python2, and makes things very much easer. Some common issues are listed below.

Print

In python3 we print with a function not a keyword so:

print "Hi!"

becomes:

print("Hi!")

To make this run under python2 we need to from __future__ import print_function at the top of any module where we print.

Strings and bytes

Python3 distinguishes between sequences of Unicode characters (strings) and sequences of bytes (bytes). Dive into python3 provides a good overview. In Python2 strings are ascii and lists of bytes. This means we need to take care about the mode when opening files, and we ought to define string literals as unicode (u"a unicode string") .

The default encoding of python source files is also different (unicode for python3, ascii for python2). To
make unicode OK everywhere, add # -*- coding: utf-8 -*- as the first (or second line, after #!/usr/bin/env python) of all source files.

Testing and developing

We have Travis continuous integration set up to run our tests in a python2 and python3 environment. Try to avoid merging anything that does not pass all tests on both. This means we need to submit changes as pull requests (and get somebody else to review and merge these).

If using anaconda, it is possible to have python2 and python3 environments set up for local development. See https://github.com/andreww/python3_friends/blob/master/introToPython3.md#2-installation for a basic introduction.

Python 2.7 tests fail due to IPython upgrade

The tests on TravisCI fail on Python 2.7 today because we need IPython, and (as of IPython 6.0, released yesterday) IPython needs Python3. We end up with the error recorded at https://travis-ci.org/alanfbaird/PyTASA/jobs/223865304

We have a few options:

  1. Stop trying to support python2.7 (i.e. just specify that this needs python3). This would allow us to strip out the bits of compatibility stuff we already have (not much of that, to be honest) and mean that we would never need to depricate python2.7 in the future. However, this may cost us some users... If we do go down this route the guidance at http://www.python3statement.org/practicalities/ will be useful (and should be turned into an issue).

  2. Fix this by specifying an older version of IPython. 5.x is a LTS release so this isOK for a few years. However, we don't currently list IPython in requirements.txt (it's just a prerequisite of Jupyter). This is probably possible but (a) a bit of a pain to do and to maintain and (b) would mean that people on python3 may end up downgrading stuff in order to run our code.

  3. Implement a workaround in the testing. For example, we could select an alternative file to requirements.txt for the python2.7 tests. Probably easer for us to manage but this could leave us with complex installation instructions for users.

Not a great choice... I do wonder if I've missed something. Worth looking to see how Obspy handle this one.

Views? For now I'll just leave the 2.7 tests broken.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.