Welcome to pyfb-normalization’s documentation!

Contents:

Pyfb-normalization

https://badge.fury.io/py/pyfb-normalization.svg https://travis-ci.org/mwolff44/pyfb-normalization.svg?branch=master https://codecov.io/gh/mwolff44/pyfb-normalization/branch/master/graph/badge.svg

Normalization application package. TRansform phone number to E.164 numbers. Mainly used in PyFreeBilling project.

Documentation

The full documentation is at https://pyfb-normalization.readthedocs.io.

Quickstart

Install pyfb-normalization:

pip install pyfb-normalization

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'pyfb_normalization.apps.PyfbNormalizationConfig',
    ...
)

Add pyfb-normalization’s URL patterns:

from pyfb_normalization import urls as pyfb_normalization_urls


urlpatterns = [
    ...
    url(r'^', include(pyfb_normalization_urls)),
    ...
]

Features

  • TODO

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

Installation

At the command line:

$ easy_install pyfb-normalization

Or, if you have virtualenvwrapper installed:

$ mkvirtualenv pyfb-normalization
$ pip install pyfb-normalization

Usage

To use pyfb-normalization in a project, add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'pyfb_normalization.apps.PyfbNormalizationConfig',
    ...
)

Add pyfb-normalization’s URL patterns:

from pyfb_normalization import urls as pyfb_normalization_urls


urlpatterns = [
    ...
    url(r'^', include(pyfb_normalization_urls)),
    ...
]

Internationalization

All user-facing text content should be marked for translation. Even if this application is only run in English, our open source users may choose to use another language. Marking content for translation ensures our users have this choice.

Follow the internationalization coding guidelines in the edX Developer’s Guide when developing new features.

Updating Translations

This project uses Transifex to translate content. After new features are developed the translation source files should be pushed to Transifex. Our translation community will translate the content, after which we can retrieve the translations.

Pushing source translation files to Transifex requires access to the edx-platform. Request access from the Open Source Team if you will be pushing translation files. You should also configure the Transifex client if you have not done so already.

The make targets listed below can be used to push or pull translations.

Target Description
pull_translations Pull translations from Transifex
push_translations Push source translation files to Transifex

Fake Translations

As you develop features it may be helpful to know which strings have been marked for translation, and which are not. Use the fake_translations make target for this purpose. This target will extract all strings marked for translation, generate fake translations in the Esperanto (eo) language directory, and compile the translations.

You can trigger the display of the translations by setting your browser’s language to Esperanto (eo), and navigating to a page on the site. Instead of plain English strings, you should see specially-accented English strings that look like this:

Thé Fütüré øf Ønlïné Édüçätïøn Ⱡσяєм ι# Før änýøné, änýwhéré, änýtïmé Ⱡσяєм #

Testing

{{ cookiecutter.project_name }} has an assortment of test cases and code quality checks to catch potential problems during development. To run them all in the version of Python you chose for your virtualenv:

$ make validate

To run just the unit tests:

$ make test

To run just the unit tests and check diff coverage

$ make diff_cover

To run just the code quality checks:

$ make quality

To run the unit tests under every supported Python version and the code quality checks:

$ make test-all

To generate and open an HTML report of how much of the code is covered by test cases:

$ make coverage

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

You can contribute in many ways:

Types of Contributions

Report Bugs

Report bugs at https://github.com/mwolff44/pyfb-normalization/issues.

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your local setup that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.

Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.

Implement Features

Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.

Write Documentation

pyfb-normalization could always use more documentation, whether as part of the official pyfb-normalization docs, in docstrings, or even on the web in blog posts, articles, and such.

Submit Feedback

The best way to send feedback is to file an issue at https://github.com/mwolff44/pyfb-normalization/issues.

If you are proposing a feature:

  • Explain in detail how it would work.
  • Keep the scope as narrow as possible, to make it easier to implement.
  • Remember that this is a volunteer-driven project, and that contributions are welcome :)

Get Started!

Ready to contribute? Here’s how to set up pyfb-normalization for local development.

  1. Fork the pyfb-normalization repo on GitHub.

  2. Clone your fork locally:

    $ git clone git@github.com:your_name_here/pyfb-normalization.git
    
  3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:

    $ mkvirtualenv pyfb-normalization
    $ cd pyfb-normalization/
    $ python setup.py develop
    
  4. Create a branch for local development:

    $ git checkout -b name-of-your-bugfix-or-feature
    

    Now you can make your changes locally.

  5. When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:

    $ flake8 pyfb_normalization tests
    $ python setup.py test
    $ tox
    

    To get flake8 and tox, just pip install them into your virtualenv.

  6. Commit your changes and push your branch to GitHub:

    $ git add .
    $ git commit -m "Your detailed description of your changes."
    $ git push origin name-of-your-bugfix-or-feature
    
  7. Submit a pull request through the GitHub website.

Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

  1. The pull request should include tests.
  2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
  3. The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy. Check https://travis-ci.org/mwolff44/pyfb-normalization/pull_requests and make sure that the tests pass for all supported Python versions.

Tips

To run a subset of tests:

$ python -m unittest tests.test_pyfb_normalization

Credits

Development Lead

Contributors

None yet. Why not be the first?

History

1.0.1 (2019-01-30)

  • SQL views for kamailio
  • translations updates

1.0.0 (2018-11-15)

  • First release on PyPI.