1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2024-12-22 12:12:18 +01:00

Re-work as a proper standalone Python package

Add a setup.py so that installation is easier and a standalone CLI
script called csv-metadata-quality is provided. Now the user only
needs to run this from a virtual environment inside the project
directory:

    $ pip install .

Eventually I could publish this on PyPi when I settle on a more
appropriate package name.

See: https://packaging.python.org/tutorials/packaging-projects/
See: https://chriswarrick.com/blog/2014/09/15/python-apps-the-right-way-entry_points-and-scripts/
This commit is contained in:
Alan Orth 2019-07-31 17:34:36 +03:00
parent 4c4f4a3ba2
commit 9100efdf50
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
3 changed files with 44 additions and 2 deletions

View File

@ -1,5 +1,9 @@
from csv_metadata_quality import app from csv_metadata_quality import app
from sys import argv from sys import argv
def main():
app.run(argv)
if __name__ == '__main__': if __name__ == '__main__':
app.main(argv) main()

View File

@ -15,7 +15,7 @@ def parse_args(argv):
return args return args
def main(argv): def run(argv):
args = parse_args(argv) args = parse_args(argv)
# Read all fields as strings so dates don't get converted from 1998 to 1998.0 # Read all fields as strings so dates don't get converted from 1998 to 1998.0

38
setup.py Normal file
View File

@ -0,0 +1,38 @@
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
install_requires = [
'pandas',
'python-stdnum',
'requests',
'requests-cache',
'pycountry'
]
setuptools.setup(
name="csv-metadata-quality",
version="0.0.1",
author="Alan Orth",
author_email="aorth@mjanja.ch",
description="A simple, but opinionated CSV quality checking and fixing pipeline.",
license="GPLv3",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/alanorth/csv-metadata-quality",
classifiers=[
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta"
],
packages=['csv_metadata_quality'],
entry_points={
'console_scripts': [
'csv-metadata-quality = csv_metadata_quality.__main__:main'
]
},
install_requires=install_requires
)