diff --git a/.github/workflows/python_deploy_dev.yml b/.github/workflows/python_deploy_dev.yml new file mode 100644 index 0000000..c75c208 --- /dev/null +++ b/.github/workflows/python_deploy_dev.yml @@ -0,0 +1,31 @@ +name: Deploy python package in development + +on: + push: + tags: + - 'v*' # Push events to every version tag (eg. v1.0.0) + +jobs: + call-workflow-conda-publish: + name: Publish development conda package on JFrog Artifactory + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_conda_package.yml@main + with: + package-name: 'las-geoh5' + python-version: '3.10' + virtual-repo-names: '["public-conda-dev"]' + secrets: + JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} + JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} + call-workflow-pypi-publish: + name: Publish development pypi package (JFrog Artifactory and TestPyPI) + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_pypi_package.yml@main + with: + package-manager: 'poetry' + package-name: 'las-geoh5' + version-tag: ${{ github.ref_name }} + python-version: '3.10' + virtual-repo-names: '["public-pypi-dev", "test-pypi"]' + secrets: + JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} + JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} + PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} diff --git a/.github/workflows/python_deploy_prod.yml b/.github/workflows/python_deploy_prod.yml new file mode 100644 index 0000000..0c84c99 --- /dev/null +++ b/.github/workflows/python_deploy_prod.yml @@ -0,0 +1,30 @@ +name: Deploy python package in production + +on: + release: + types: [published] + +jobs: + call-workflow-conda-publish: + name: Publish production conda package on JFrog Artifactory + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_conda_package.yml@main + with: + package-name: 'las-geoh5' + python-version: '3.10' + virtual-repo-names: '["public-conda-prod"]' + secrets: + JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} + JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} + call-workflow-pypi-publish: + name: Publish production pypi package (JFrog Artifactory and PyPI) + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_pypi_package.yml@main + with: + package-manager: 'poetry' + package-name: 'las-geoh5' + version-tag: ${{ github.ref_name }} + python-version: '3.10' + virtual-repo-names: '["public-pypi-prod", "pypi"]' + secrets: + JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} + JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 39bcf6b..0042ffc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,6 +39,7 @@ repos: pydantic==2.5.*, tomli, # to read config from pyproject.toml types-toml, + types-PyYAML, ] exclude: ^(docs|las_geoh5-assets)/ - repo: https://github.com/codingjoe/relint @@ -78,6 +79,7 @@ repos: exclude_types: [jupyter] - id: check-toml - id: check-yaml + exclude: ^meta.yaml$ - id: check-added-large-files - id: check-case-conflict - id: check-merge-conflict diff --git a/meta.yaml b/meta.yaml new file mode 100644 index 0000000..281f690 --- /dev/null +++ b/meta.yaml @@ -0,0 +1,60 @@ +{% set name = "las-geoh5" %} +{% set version = "0.3.0a2" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + # url: https://github.com/MiraGeoscience/{{ name }}/archive/v{{ version }}.tar.gz + # sha256: 1c20e6bb021516ef89de8551dc1f47f944bc98ea83d3da393d13e71469add43d + path: ../{{ name }} + +build: + noarch: python + script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation + number: 0 + entry_points: + - geoh5_to_las = las_geoh5.scripts.geoh5_to_las:main + - las_to_geoh5 = las_geoh5.scripts.las_to_geoh5:main + +requirements: + host: + - pip + - python >=3.10.0,<3.11 + - poetry-core >=1.0.0 + - setuptools + - setuptools_scm + run: + - python >=3.9.0,<3.11 + - geoh5py >=0.10.0a1,<0.11.0 + - lasio >=0.31 + - numpy >=1.26.0,<1.27.0 + - pydantic >=2.5.2,<2.6.0 + - tqdm >=4.66.1,<4.67.0 + +test: + imports: + - las_geoh5 + commands: + - pip list + - pip check + requires: + - pip + +about: + home: https://www.mirageoscience.com/mining-industry-software/python-integration/ + summary: 'Import/Export LAS files to/from geoh5 format.' + description: | + Import/Export LAS files to/from geoh5 format. + This package allows for import and export of LAS files to and from a drillhole group. There is a module each for import and export operations. Each of these includes a driver and a ui.json that parameterizes the driver and renders a UI for use within Geoscience ANALYST Pro. Read on to learn how to install las-geoh5 and get started importing and exporting LAS files. + license: MIT + license_file: + - LICENSE + doc_url: https://mirageoscience-las-geoh5.readthedocs-hosted.com/en/stable/ + dev_url: https://github.com/MiraGeoscience/las-geoh5 + +extra: + recipe-maintainers: + - SophieCurinier + - sebhmg diff --git a/poetry.lock b/poetry.lock index 8139e59..1da59e0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "alabaster" @@ -904,6 +904,68 @@ pytest = ">=4.6" [package.extras] testing = ["fields", "hunter", "process-tests", "pytest-xdist", "virtualenv"] +[[package]] +name = "pyyaml" +version = "6.0.2" +description = "YAML parser and emitter for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086"}, + {file = "PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf"}, + {file = "PyYAML-6.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8824b5a04a04a047e72eea5cec3bc266db09e35de6bdfe34c9436ac5ee27d237"}, + {file = "PyYAML-6.0.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7c36280e6fb8385e520936c3cb3b8042851904eba0e58d277dca80a5cfed590b"}, + {file = "PyYAML-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ec031d5d2feb36d1d1a24380e4db6d43695f3748343d99434e6f5f9156aaa2ed"}, + {file = "PyYAML-6.0.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:936d68689298c36b53b29f23c6dbb74de12b4ac12ca6cfe0e047bedceea56180"}, + {file = "PyYAML-6.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:23502f431948090f597378482b4812b0caae32c22213aecf3b55325e049a6c68"}, + {file = "PyYAML-6.0.2-cp310-cp310-win32.whl", hash = "sha256:2e99c6826ffa974fe6e27cdb5ed0021786b03fc98e5ee3c5bfe1fd5015f42b99"}, + {file = "PyYAML-6.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:a4d3091415f010369ae4ed1fc6b79def9416358877534caf6a0fdd2146c87a3e"}, + {file = "PyYAML-6.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cc1c1159b3d456576af7a3e4d1ba7e6924cb39de8f67111c735f6fc832082774"}, + {file = "PyYAML-6.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1e2120ef853f59c7419231f3bf4e7021f1b936f6ebd222406c3b60212205d2ee"}, + {file = "PyYAML-6.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d225db5a45f21e78dd9358e58a98702a0302f2659a3c6cd320564b75b86f47c"}, + {file = "PyYAML-6.0.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5ac9328ec4831237bec75defaf839f7d4564be1e6b25ac710bd1a96321cc8317"}, + {file = "PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ad2a3decf9aaba3d29c8f537ac4b243e36bef957511b4766cb0057d32b0be85"}, + {file = "PyYAML-6.0.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4"}, + {file = "PyYAML-6.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:797b4f722ffa07cc8d62053e4cff1486fa6dc094105d13fea7b1de7d8bf71c9e"}, + {file = "PyYAML-6.0.2-cp311-cp311-win32.whl", hash = "sha256:11d8f3dd2b9c1207dcaf2ee0bbbfd5991f571186ec9cc78427ba5bd32afae4b5"}, + {file = "PyYAML-6.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:e10ce637b18caea04431ce14fabcf5c64a1c61ec9c56b071a4b7ca131ca52d44"}, + {file = "PyYAML-6.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c70c95198c015b85feafc136515252a261a84561b7b1d51e3384e0655ddf25ab"}, + {file = "PyYAML-6.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ce826d6ef20b1bc864f0a68340c8b3287705cae2f8b4b1d932177dcc76721725"}, + {file = "PyYAML-6.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f71ea527786de97d1a0cc0eacd1defc0985dcf6b3f17bb77dcfc8c34bec4dc5"}, + {file = "PyYAML-6.0.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b22676e8097e9e22e36d6b7bda33190d0d400f345f23d4065d48f4ca7ae0425"}, + {file = "PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80bab7bfc629882493af4aa31a4cfa43a4c57c83813253626916b8c7ada83476"}, + {file = "PyYAML-6.0.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:0833f8694549e586547b576dcfaba4a6b55b9e96098b36cdc7ebefe667dfed48"}, + {file = "PyYAML-6.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8b9c7197f7cb2738065c481a0461e50ad02f18c78cd75775628afb4d7137fb3b"}, + {file = "PyYAML-6.0.2-cp312-cp312-win32.whl", hash = "sha256:ef6107725bd54b262d6dedcc2af448a266975032bc85ef0172c5f059da6325b4"}, + {file = "PyYAML-6.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:7e7401d0de89a9a855c839bc697c079a4af81cf878373abd7dc625847d25cbd8"}, + {file = "PyYAML-6.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:efdca5630322a10774e8e98e1af481aad470dd62c3170801852d752aa7a783ba"}, + {file = "PyYAML-6.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:50187695423ffe49e2deacb8cd10510bc361faac997de9efef88badc3bb9e2d1"}, + {file = "PyYAML-6.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ffe8360bab4910ef1b9e87fb812d8bc0a308b0d0eef8c8f44e0254ab3b07133"}, + {file = "PyYAML-6.0.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:17e311b6c678207928d649faa7cb0d7b4c26a0ba73d41e99c4fff6b6c3276484"}, + {file = "PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70b189594dbe54f75ab3a1acec5f1e3faa7e8cf2f1e08d9b561cb41b845f69d5"}, + {file = "PyYAML-6.0.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:41e4e3953a79407c794916fa277a82531dd93aad34e29c2a514c2c0c5fe971cc"}, + {file = "PyYAML-6.0.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:68ccc6023a3400877818152ad9a1033e3db8625d899c72eacb5a668902e4d652"}, + {file = "PyYAML-6.0.2-cp313-cp313-win32.whl", hash = "sha256:bc2fa7c6b47d6bc618dd7fb02ef6fdedb1090ec036abab80d4681424b84c1183"}, + {file = "PyYAML-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563"}, + {file = "PyYAML-6.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:24471b829b3bf607e04e88d79542a9d48bb037c2267d7927a874e6c205ca7e9a"}, + {file = "PyYAML-6.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7fded462629cfa4b685c5416b949ebad6cec74af5e2d42905d41e257e0869f5"}, + {file = "PyYAML-6.0.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d84a1718ee396f54f3a086ea0a66d8e552b2ab2017ef8b420e92edbc841c352d"}, + {file = "PyYAML-6.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9056c1ecd25795207ad294bcf39f2db3d845767be0ea6e6a34d856f006006083"}, + {file = "PyYAML-6.0.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:82d09873e40955485746739bcb8b4586983670466c23382c19cffecbf1fd8706"}, + {file = "PyYAML-6.0.2-cp38-cp38-win32.whl", hash = "sha256:43fa96a3ca0d6b1812e01ced1044a003533c47f6ee8aca31724f78e93ccc089a"}, + {file = "PyYAML-6.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:01179a4a8559ab5de078078f37e5c1a30d76bb88519906844fd7bdea1b7729ff"}, + {file = "PyYAML-6.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:688ba32a1cffef67fd2e9398a2efebaea461578b0923624778664cc1c914db5d"}, + {file = "PyYAML-6.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a8786accb172bd8afb8be14490a16625cbc387036876ab6ba70912730faf8e1f"}, + {file = "PyYAML-6.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d8e03406cac8513435335dbab54c0d385e4a49e4945d2909a581c83647ca0290"}, + {file = "PyYAML-6.0.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12"}, + {file = "PyYAML-6.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3b1fdb9dc17f5a7677423d508ab4f243a726dea51fa5e70992e59a7411c89d19"}, + {file = "PyYAML-6.0.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0b69e4ce7a131fe56b7e4d770c67429700908fc0752af059838b1cfb41960e4e"}, + {file = "PyYAML-6.0.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a9f8c2e67970f13b16084e04f134610fd1d374bf477b17ec1599185cf611d725"}, + {file = "PyYAML-6.0.2-cp39-cp39-win32.whl", hash = "sha256:6395c297d42274772abc367baaa79683958044e5d3835486c16da75d2a694631"}, + {file = "PyYAML-6.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:39693e1f8320ae4f43943590b49779ffb98acb81f788220ea932a6b6c51004d8"}, + {file = "pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e"}, +] + [[package]] name = "requests" version = "2.32.3" @@ -1190,4 +1252,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "ae5ac2a8eb7f3d5989d71fb98b39a8a08e93aded6108964152005b6d099a6f1a" +content-hash = "1789d4cefb6d72eadb53a4db44d2f5ec5056dd99c53c96fa4cd7ee9ddb718535" diff --git a/pyproject.toml b/pyproject.toml index f06c323..fa3db22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,6 +62,9 @@ Pygments = "*" pylint = "*" pytest = "*" pytest-cov = "*" +pyyaml = '*' +jinja2 = '*' +packaging = '*' tomli = "*" sphinx = "*" sphinx-autodoc-typehints = "*" diff --git a/tests/version_test.py b/tests/version_test.py index 0de7d91..fd777ba 100644 --- a/tests/version_test.py +++ b/tests/version_test.py @@ -9,12 +9,46 @@ from __future__ import annotations import re +from pathlib import Path + +import tomli as toml +import yaml +from jinja2 import Template +from packaging.version import Version import las_geoh5 -def test_version_is_consistent(pyproject: dict): - assert las_geoh5.__version__ == pyproject["tool"]["poetry"]["version"] +def get_version(): + path = Path(__file__).resolve().parents[1] / "pyproject.toml" + + with open(str(path), encoding="utf-8") as file: + pyproject = toml.loads(file.read()) + + return pyproject["tool"]["poetry"]["version"] + + +def get_conda_recipe_version(): + path = Path(__file__).resolve().parents[1] / "meta.yaml" + + with open(str(path), encoding="utf-8") as file: + content = file.read() + + template = Template(content) + rendered_yaml = template.render() + + recipe = yaml.safe_load(rendered_yaml) + + return recipe["package"]["version"] + + +def test_version_is_consistent(): + assert las_geoh5.__version__ == get_version() + + +def test_conda_version_is_pep440(): + version = Version(get_conda_recipe_version()) + assert version is not None def test_version_is_semver():