diff --git a/.gitignore b/.gitignore index 1269488..250faa2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ data +venv +*.egg-info +__pycache__ diff --git a/Pipfile b/Pipfile index 4eff159..02f453f 100644 --- a/Pipfile +++ b/Pipfile @@ -4,6 +4,7 @@ url = "https://pypi.org/simple" verify_ssl = true [dev-packages] +pipenv-setup = "*" [packages] click = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 03cce3a..da16da3 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "4c0df054f8dcd0256bafaa3a679648addb86a8df8212b7885020bf02be2ce212" + "sha256": "9bc7aeabd9e99f42a2da92abc2deb0014cf802fd7857228945c189982dfb20b6" }, "pipfile-spec": 6, "requires": { @@ -147,5 +147,83 @@ "version": "==1.2.0" } }, - "develop": {} + "develop": { + "appdirs": { + "hashes": [ + "sha256:9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92", + "sha256:d8b24664561d0d34ddfaec54636d502d7cea6e29c3eaf68f3df6180863e2166e" + ], + "version": "==1.4.3" + }, + "attrs": { + "hashes": [ + "sha256:69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79", + "sha256:f0b870f674851ecbfbbbd364d6b5cbdff9dcedbc7f3f5e18a6891057f21fe399" + ], + "version": "==19.1.0" + }, + "black": { + "hashes": [ + "sha256:09a9dcb7c46ed496a9850b76e4e825d6049ecd38b611f1224857a79bd985a8cf", + "sha256:68950ffd4d9169716bcb8719a56c07a2f4485354fec061cdd5910aa07369731c" + ], + "version": "==19.3b0" + }, + "click": { + "hashes": [ + "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", + "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" + ], + "index": "pypi", + "version": "==7.0" + }, + "colorama": { + "hashes": [ + "sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d", + "sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48" + ], + "version": "==0.4.1" + }, + "packaging": { + "hashes": [ + "sha256:a7ac867b97fdc07ee80a8058fe4435ccd274ecc3b0ed61d852d7d53055528cf9", + "sha256:c491ca87294da7cc01902edbe30a5bc6c4c28172b5138ab4e4aa1b9d7bfaeafe" + ], + "version": "==19.1" + }, + "pipenv-setup": { + "hashes": [ + "sha256:9c8bb190960150dc437bcb815bfa0b916ea6b76897488694e479efe79864ee6d" + ], + "index": "pypi", + "version": "==2.1.6" + }, + "pipfile": { + "hashes": [ + "sha256:f7d9f15de8b660986557eb3cc5391aa1a16207ac41bc378d03f414762d36c984" + ], + "version": "==0.0.2" + }, + "pyparsing": { + "hashes": [ + "sha256:6f98a7b9397e206d78cc01df10131398f1c8b8510a2f4d97d9abd82e1aacdd80", + "sha256:d9338df12903bbf5d65a0e4e87c2161968b10d2e489652bb47001d82a9b028b4" + ], + "version": "==2.4.2" + }, + "six": { + "hashes": [ + "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", + "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" + ], + "version": "==1.12" + }, + "toml": { + "hashes": [ + "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c", + "sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e" + ], + "version": "==0.10.0" + } + } } diff --git a/README.md b/README.md index 507b58d..cea210c 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,19 @@ easier to use by denormalising it, concatenating the files, adding headers, and standardising some of the formatting. -## Usage -With Python 3 and [Pipenv][pipenv] installed: +## Installation +Ensure you have Python 3.7+ installed on your machine. + +``` +pip3 install --user "git+https://github.com/timwis/code-point-open-transformer#egg=code-point-open-transformer" +``` -1. Clone this repository and run `pipenv install` within it. -2. Download the [Code-Point Open][cpo] dataset and unzip it. -3. Activate a local environment using `pipenv shell`. -4. Run the script using `python bin/cli.py /path/to/unzipped_data/ /path/to/output_dir/` +## Usage +``` +Usage: codepointopen [OPTIONS] PACKAGE_DIR OUTPUT_DIR -The script will write a `.csv` file for every set of regions included in the code-point -open "code list" files. It will also merge all the data files, converting linked values -to [CURIE][curie] format. Finally, it modifies the `Postcode` column to format it with a -single space + Improve usability of Code-Point Open data and link to lookup files +``` This script does the following: diff --git a/code_point_open_transformer/__init__.py b/code_point_open_transformer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bin/cli.py b/code_point_open_transformer/cli.py similarity index 100% rename from bin/cli.py rename to code_point_open_transformer/cli.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1e1933b --- /dev/null +++ b/setup.py @@ -0,0 +1,18 @@ +from setuptools import setup + +setup( + name="code_point_open_transformer", + version="2.0", + py_modules=["code_point_open_transformer"], + install_requires=[ + "click==7.0", + "openpyxl==3.0.0", + "tqdm==4.36.1", + "xlrd==1.2.0", + ], + dependency_links=[], + entry_points=""" + [console_scripts] + codepointopen=code_point_open_transformer.cli:main + """, +)