Skip to content

Commit

Permalink
Make into a package with Poetry (#1)
Browse files Browse the repository at this point in the history
* Make into a package with Poetry

* Update the README
  • Loading branch information
Iain-S authored Nov 30, 2022
1 parent 494ee85 commit 34215b7
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ language: python

python:
- "2.7"
- "3.6"
- "3.7"

install:
- pip install coverage
- pip install coveralls

script:
- coverage run --source . test_generate_nhs_numbers.py
- coverage run --source nhs_number_generator tests/test_generate_nhs_numbers.py

after_success:
- coveralls
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
[![Coverage Status](https://coveralls.io/repos/github/Iain-S/nhs_number_generator/badge.svg?branch=master)](https://coveralls.io/github/Iain-S/nhs_number_generator?branch=master)
[![Build Status](https://travis-ci.org/Iain-S/nhs_number_generator.svg?branch=master)](https://travis-ci.org/Iain-S/nhs_number_generator)

Generate and validate NHS numbers in Python 2.7+ and 3.
Generate and validate NHS numbers in Python 2.7+ and 3.6+.

## To use as a script

Generate five (-n 5) sequential (-d) formatted (-f) nhs numbers:

```
$ python3 generate_nhs_numbers.py -n 5 -d -f
$ python -m nhs_number_generator.generate_nhs_numbers -n 5 -d -f
400 000 0004
400 000 0012
400 000 0020
Expand All @@ -21,7 +21,7 @@ $ python3 generate_nhs_numbers.py -n 5 -d -f
Use the -h flag for help:

```
$ python3 generate_nhs_numbers.py -h
$ python -m nhs_number_generator.generate_nhs_numbers -h
usage: generate_nhs_numbers.py [-h] [-n N] [-d] [-f]
Generate 10-digit NHS numbers.
Expand All @@ -36,7 +36,7 @@ optional arguments:
## To use as a library

```python
import generate_nhs_numbers
from nhs_number_generator import generate_nhs_numbers

for nhs_number in generate_nhs_numbers.random_nhs_number_generator([(489000000, 489999999)]):
print(nhs_number)
Expand Down
Empty file.
File renamed without changes.
8 changes: 8 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.poetry]
name = "nhs-number-generator"
version = "1.0.0"
description = ""
authors = ["Iain <[email protected]>"]
license = "GPLv3"
readme = "README.md"
packages = [{include = "nhs_number_generator"}]

[tool.poetry.dependencies]
python = "^2.7 || ^3.6"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Binary file added tests/.test_generate_nhs_numbers.py.swp
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from __future__ import unicode_literals
import unittest
from generate_nhs_numbers import (deterministic_nhs_number_generator, add_separators, calculate_check_digit,
from nhs_number_generator.generate_nhs_numbers import (deterministic_nhs_number_generator, add_separators, calculate_check_digit,
random_nhs_number_generator, is_valid_nhs_number, remove_separators)
import generate_nhs_numbers
from nhs_number_generator import generate_nhs_numbers
import sys

if sys.version_info.major >= 3: # pragma: no cover
Expand Down

0 comments on commit 34215b7

Please sign in to comment.