Skip to content

Commit

Permalink
added travis
Browse files Browse the repository at this point in the history
  • Loading branch information
tolstislon committed May 18, 2020
1 parent 82b6e5e commit 7cbb344
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 7 deletions.
65 changes: 65 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
dist: bionic
language: python

git:
depth: false

stages:
- black
- flake8
- test

jobs:
include:
- stage: "black"
python: "3.6"
env: BLACK=19.10b0
install: pip install black==$BLACK
script: black ./phone_gen --check
after_success: false
- stage: "flake8"
python: "3.6"
env:
- FLAKE8=3.8.1
- PEP8_NAMING=0.10.0
install:
- pip install flake8==$FLAKE8
- pip install pep8-naming==$PEP8_NAMING
script: flake8 ./phone_gen
after_success: false

env:
- PHONENUMBERS="-U phonenumbers" # last version

python:
- "pypy3"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
install:
- pip install $PHONENUMBERS
- pip install pytest-cov==2.8.1
- pip install pytest==5.4.2
- pip install -e .
script:
- pip freeze | grep phonenumbers
- pytest tests
deploy:
provider: pypi
user: $PYPI_USER
password: $PYPI_PASSWORD
skip_existing: true
distributions: bdist_wheel --universal
on:
tags: true
repo: tolstislon/phone_gen
python: "3.8"

after_success:
- bash <(curl -s https://codecov.io/bash)

notifications:
email:
on_success: never
on_failure: always
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
# phone_gen
Phone number generator
# Phone Gen

[![Build Status](https://travis-ci.com/tolstislon/phone_gen.svg?branch=master)](https://travis-ci.com/tolstislon/phone_gen)
[![codecov](https://codecov.io/gh/tolstislon/phone-gen/branch/master/graph/badge.svg)](https://codecov.io/gh/tolstislon/phone-gen)


Phone number generator for [Google's libphonenumber library](https://github.com/google/libphonenumber)


Install
----

```bash
pip install phone-gen
```

Example
----
```python
from phone_gen import PhoneNumber

phone_number = PhoneNumber('GB')

# Get full phone number
number = phone_number.get_number()
print(number) # +442908124840

# Get country code
country_code = phone_number.get_code()
print(country_code) # 44

# Phone number without country code
number = phone_number.get_number(full=False)
print(number) # 183782623
```


Contributing
----
Contributions are very welcome.
2 changes: 1 addition & 1 deletion phone_gen/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def render(self) -> str:

class PhoneNumber:
def __init__(self, code: str):
self.country = PATTERNS['data'].get(code.upper(), {})
self.country = PATTERNS["data"].get(code.upper(), {})
if not self.country:
raise NumberGeneratorException("Not found country {}".format(code))
self.generator = NumberGenerator(self.country["pattern"])
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
license='MIT License',
author='tolstislon',
author_email='[email protected]',
description='Phone number generator',
description='Phone number generator for libphonenumber',
long_description=long_description,
long_description_content_type='text/markdown',
use_scm_version={"write_to": "phone_gen/__version__.py"},
Expand All @@ -22,10 +22,9 @@
include_package_data=True,
keywords=[],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.5',
Expand All @@ -34,6 +33,7 @@
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries :: Python Modules'
'Topic :: Software Development :: Testing',
'Topic :: Communications :: Telephony'
]
)

0 comments on commit 7cbb344

Please sign in to comment.