Commit e9fc817d authored by Greg Harris's avatar Greg Harris
Browse files

Improving versioning and dependency handling.

parent 3832f2c6
......@@ -72,7 +72,55 @@ pipenv run python -m lascli ingest wellbore -t %OSDUTOKEN%
This keeps the command line short. This can also be done for other commonly used options (e.g. `-u/--url`).
### Config file
## Deploy
Before build and deploy ensure that the setup.py and the pipfile.lock dependencies synced, by running:
```
pipenv-setup sync
```
Check that the version number in the `src/lasloader/__init__.py` file is correct.
### Dev install from repo
The LASCLI can be installed in edit mode on the command line by running
```
pip install -e .
```
The LAS CLI can then be accessed using the command:
```
lascli
```
Or alternatively using a virtual environment, install with:
```
pipenv install -e .
```
This installs the package in a virtual environment. The CLI can then be run using:
```
pipenv run lascli
```
### Creating distribution archives
To create a distribution run:
```
python setup.py sdist bdist_wheel
```
This will create both source and binary wheel distributions. The package can then be deployed using:
```
pip install .
```
### Publish the package distribution
To be determined...
## Config file
The LASCLI requires a configuration file that has the following JSON structure:
```
......
from glob import glob
from os.path import splitext, basename
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="lasloader",
version="0.0.7",
author="Greg Harris & Niall McDaid",
author_email="author@example.com",
description="LAS file ingest command line interface",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://community.opengroup.org/osdu/platform/data-flow/data-loading/wellbore-ddms-las-loader",
project_urls={
"Bug Tracker": "https://community.opengroup.org/osdu/platform/data-flow/data-loading/wellbore-ddms-las-loader/-/issues",
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
packages=['lasloader', 'lasloader.commands'],
package_dir={"": "src"},
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
include_package_data=True,
python_requires=">=3.9",
entry_points={"console_scripts": ["lascli=lasloader.__main__:main"]},
)
import os
import re
from os.path import basename, dirname, join, splitext, basename
from glob import glob
from setuptools import setup
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
def read(fname):
"""Local read helper function for long documentation"""
osducli_path = dirname(os.path.realpath(__file__))
return open(join(osducli_path, fname)).read()
version_file = read(os.path.join("src", "lasloader", "__init__.py"))
__VERSION__ = re.search(
r'^__VERSION__\s*=\s*[\'"]([^\'"]*)[\'"]', version_file, re.MULTILINE
).group(1)
setup(
name="lasloader",
version=__VERSION__,
author="BP",
author_email="greg.harris1@bp.com",
description="OSDU LAS file ingest - command line interface",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://community.opengroup.org/osdu/platform/data-flow/data-loading/wellbore-ddms-las-loader",
project_urls={
"Bug Tracker": "https://community.opengroup.org/osdu/platform/data-flow/data-loading/wellbore-ddms-las-loader/-/issues",
},
license="Apache",
classifiers=[
"Environment :: Console",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Programming Language :: Python :: 3.9",
],
keywords="osdu",
python_requires=">=3.9",
packages=["lasloader", "lasloader.commands"],
package_dir={"": "src"},
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
include_package_data=True,
entry_points={"console_scripts": ["lascli=lasloader.__main__:main"]},
install_requires=[
"argcomplete==1.12.3",
"colorama==0.4.4; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"jmespath==0.10.0; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"knack==0.8.2",
"lasio==0.29",
"numpy==1.21.3; python_version < '3.10' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
"pandas==1.3.4",
"pyarrow==6.0.0",
"pygments==2.10.0; python_version >= '3.5'",
"python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"pytz==2021.3",
"pyyaml==6.0; python_version >= '3.6'",
"six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"tabulate==0.8.9",
"toml==0.10.2",
],
)
# Gets the version number
__VERSION__ = "0.0.1"
import sys
from knack import CLI
from lasloader.lascli import LasCommandLoader, LasCommandHelp
def main():
"""Main entry point for LAS LOADER"""
try:
args_list = sys.argv[1:]
lascli = CLI(cli_name="LASCLI",
commands_loader_cls=LasCommandLoader,
help_cls=LasCommandHelp)
exit_code = lascli.invoke(args_list)
sys.exit(exit_code)
except KeyboardInterrupt:
sys.exit(1)
from lasloader.lascli import main
if __name__ == "__main__":
......
import sys
from collections import OrderedDict
from knack import ArgumentsContext
from knack import CLI, ArgumentsContext
from knack.help import CLIHelp
from knack.commands import CLICommandsLoader, CommandGroup
from lasloader import __VERSION__
BASE_MESSAGE = r"""
OSDU_MESSAGE = r"""
___ ___ ___ _ _
| . |/ __]| . \| | |
| | |\__ \| | || | |
`___'[___/|___/ \__|
Welcome to the LASCLI OSDU LOADER!
Welcome to the LASCLI OSDU LOADER!"""
USAGE_MESSAGE = r"""
Usage:
lascli [command]
Available Commands:
"""
Available Commands:"""
BASE_MESSAGE = f"{OSDU_MESSAGE}\nVersion {__VERSION__}\n{USAGE_MESSAGE}"
class LasCommandHelp(CLIHelp):
"""OSDU CLI help loader"""
......@@ -150,3 +155,23 @@ class LasCommandLoader(CLICommandsLoader):
help='The base url of the OSDU instance.')
arg_context.argument('token', type=str, options_list=('-t', '--token'),
help='A valid bearer token used to authenticate with the OSDU instance.')
def main():
"""Main entry point for LAS LOADER"""
try:
args_list = sys.argv[1:]
lascli = CLI(cli_name="LASCLI",
commands_loader_cls=LasCommandLoader,
help_cls=LasCommandHelp)
exit_code = lascli.invoke(args_list)
sys.exit(exit_code)
except KeyboardInterrupt:
sys.exit(1)
if __name__ == "__main__":
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment