python
Used in:
components
- OverviewOverview
- VersionsVersions
- DependentsDependents
- DependenciesDependencies
<dependency>
<groupId>au.csiro.pathling</groupId>
<artifactId>python</artifactId>
<version>9.4.0</version>
</dependency><?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
~ Organisation (CSIRO) ABN 41 687 119 230.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>au.csiro.pathling</groupId>
<artifactId>pathling</artifactId>
<version>9.4.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>python</artifactId>
<packaging>pom</packaging>
<name>Pathling Python API</name>
<description>A library for using Pathling with Python.</description>
<properties>
<!--suppress UnresolvedMavenProperty -->
<pathling.pyapi.version>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}${pathling.pyapi.version.qualifier}</pathling.pyapi.version>
<pathling.pyapi.version.qualifier>.dev</pathling.pyapi.version.qualifier>
<pathling.pypi.repository>pypi</pathling.pypi.repository>
</properties>
<dependencies>
<dependency>
<groupId>au.csiro.pathling</groupId>
<artifactId>library-runtime</artifactId>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}</directory>
<includes>
<include>.coverage</include>
<include>pathling/_version.py</include>
<include>build</include>
<include>build/**/*</include>
<include>.pytest_cache</include>
<include>pathling.egg-info</include>
<include>pathling.egg-info/**/*</include>
<include>**/.ipynb_checkpoints</include>
<include>metastore_db</include>
<include>metastore_db/**/*</include>
<include>derby.log</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<!-- Install dependencies -->
<execution>
<id>ensure-venv</id>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<arguments>
<argument>venv</argument>
<argument>--allow-existing</argument>
<argument>-p 3.9</argument>
<argument>.venv</argument>
</arguments>
</configuration>
</execution>
<!-- Install dependencies -->
<execution>
<id>install-dependencies</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<arguments>
<argument>sync</argument>
</arguments>
</configuration>
</execution>
<!-- Build Python distributions -->
<execution>
<id>python-package</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<arguments>
<argument>run</argument>
<argument>python</argument>
<argument>-m</argument>
<argument>build</argument>
<argument>--outdir</argument>
<argument>${project.build.directory}/py-dist</argument>
</arguments>
</configuration>
</execution>
<!-- Install package -->
<execution>
<id>install</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<arguments>
<argument>pip</argument>
<argument>install</argument>
<argument>.</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>ru.yaal.maven</groupId>
<artifactId>write-text-files-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<charset>UTF-8</charset>
<files>
<file>
<path>pathling/_version.py</path>
<lines>
<line>#</line>
<line># Auto generated from POM project version.</line>
<line># Please do not modify.</line>
<line>#</line>
<line>__version__="${pathling.pyapi.version}"</line>
<line>__java_version__="${project.version}"</line>
<line>__scala_version__="${pathling.scalaVersion}"</line>
<line>__delta_version__="${pathling.deltaVersion}"</line>
<line>__hadoop_version__="${pathling.hadoopVersion}"</line>
</lines>
</file>
</files>
</configuration>
<executions>
<execution>
<id>write-text-files</id>
<phase>generate-sources</phase>
<goals>
<goal>write-text-files</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>pythonTests</id>
<activation>
<property>
<name>!skipTests</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<!-- Check Python code with ruff linter -->
<execution>
<id>ruff-check</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<workingDirectory>${project.basedir}</workingDirectory>
<arguments>
<argument>run</argument>
<argument>ruff</argument>
<argument>check</argument>
<argument>.</argument>
</arguments>
</configuration>
</execution>
<!-- Check Python code formatting with ruff -->
<execution>
<id>ruff-format-check</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<workingDirectory>${project.basedir}</workingDirectory>
<arguments>
<argument>run</argument>
<argument>ruff</argument>
<argument>format</argument>
<argument>--check</argument>
<argument>.</argument>
</arguments>
</configuration>
</execution>
<!-- Run the Python tests -->
<execution>
<id>python-tests</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<workingDirectory>${project.basedir}</workingDirectory>
<arguments>
<argument>run</argument>
<argument>pytest</argument>
<argument>-x</argument>
<argument>tests</argument>
<argument>--cov=pathling</argument>
<argument>--cov-report=html:target/coverage/html</argument>
<argument>--cov-report=xml:target/coverage/coverage.xml</argument>
<argument>--cov-report=annotate:target/coverage/annotate</argument>
<argument>-v</argument>
</arguments>
<environmentVariables>
<PYTHONPATH>${project.basedir}</PYTHONPATH>
<PYSPARK_PYTHON>${project.basedir}/.venv/bin/python</PYSPARK_PYTHON>
</environmentVariables>
</configuration>
</execution>
<!-- Test spark-submit -->
<execution>
<id>spark-submit-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<arguments>
<argument>run</argument>
<argument>spark-submit</argument>
<argument>--packages</argument>
<argument>au.csiro.pathling:library-runtime:${project.version},io.delta:delta-spark_${pathling.scalaVersion}:${pathling.deltaVersion}</argument>
<argument>--conf</argument>
<argument>spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension</argument>
<argument>--conf</argument>
<argument>spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog</argument>
<argument>--conf</argument>
<argument>spark.sql.mapKeyDedupPolicy=LAST_WIN</argument>
<argument>${project.basedir}/examples/fhir_view.py</argument>
</arguments>
<environmentVariables>
<PYSPARK_PYTHON>${project.basedir}/.venv/bin/python</PYSPARK_PYTHON>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>docs</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<!-- Build Python documentation -->
<execution>
<id>python-generate-docs</id>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<arguments>
<argument>run</argument>
<argument>sphinx-apidoc</argument>
<argument>--force</argument>
<argument>--full</argument>
<argument>-o</argument>
<argument>${project.build.directory}/docs</argument>
<argument>-t</argument>
<argument>${project.basedir}/docs/templates/</argument>
<argument>pathling</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>python-compile-docs</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>make</executable>
<arguments>
<argument>-C</argument>
<argument>${project.build.directory}/docs</argument>
<argument>clean</argument>
<argument>html</argument>
</arguments>
<environmentVariables>
<SPHINXBUILD>uv run sphinx-build</SPHINXBUILD>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
<!-- Create a JAR containing the Python docs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>docs-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>${project.build.directory}/docs/_build/html</classesDirectory>
<classifier>docs</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>pythonRelease</id>
<properties>
<pathling.pyapi.version.qualifier/>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<!-- Deploy package to PyPI -->
<execution>
<id>deploy</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<arguments>
<argument>run</argument>
<argument>twine</argument>
<argument>upload</argument>
<argument>--verbose</argument>
<argument>--skip-existing</argument>
<argument>--repository</argument>
<argument>${pathling.pypi.repository}</argument>
<argument>${project.build.directory}/py-dist/*</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>pythonPreRelease</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<!-- Deploy package to PyPI -->
<execution>
<id>deploy</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<arguments>
<argument>run</argument>
<argument>twine</argument>
<argument>upload</argument>
<argument>--verbose</argument>
<argument>--repository</argument>
<argument>${pathling.pypi.repository}</argument>
<argument>${project.build.directory}/py-dist/*</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>format</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<!-- Format Python code with ruff -->
<execution>
<id>ruff-format</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<workingDirectory>${project.basedir}</workingDirectory>
<arguments>
<argument>run</argument>
<argument>ruff</argument>
<argument>format</argument>
<argument>.</argument>
</arguments>
</configuration>
</execution>
<!-- Fix Python code issues with ruff -->
<execution>
<id>ruff-fix</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>uv</executable>
<workingDirectory>${project.basedir}</workingDirectory>
<arguments>
<argument>run</argument>
<argument>ruff</argument>
<argument>check</argument>
<argument>--fix</argument>
<argument>.</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>