Skip to main content

Falgueras 🪴

PyPI version

Development framework for Python projects involving GCP, Pandas, and Spark.

The main goal is to accelerate development of data-driven projects by offering a unified framework for developers with different backgrounds, from software and data engineers to data scientists.

Set up

Base package: pip install falgueras (requieres Python>=3.10)

PySpark dependencies: pip install falgueras[spark] (PySpark 3.5.2)

PySpark libraries are optional to keep the package lightweight and because in most cases they are already provided by the environment. If you don't use falgueras PySpark dependencies, keep in mind that versions of the numpy, pandas and pyarrow packages were tested against PySpark version 3.5.2. Behavior with other versions may change.

Run Spark 3.5.2 applications locally in Windows from IntelliJ

try fast fail fast learn fast

For local Spark execution in Windows, the following environment variables must be set appropriately:

  • SPARK_HOME; version spark-3.5.2-bin-hadoop3.
  • HADOOP_HOME; same value than SPARK_HOME.
  • JAVA_HOME; recommended Java SDK 11.
  • PATH += %HADOOP_HOME%\bin, %JAVA_HOME%\bin.

%HADOOP_HOME%\bin must contain files winutils.exe and hadoop.dll, download from here.

Additionally, add findspark.init() at the beginning of the script in order to set and add environment variables and dependencies to sys.path.

Connect to BigQuery from Spark

As shown in the spark_session_utils.py, the SparkSession used must include the jar com.google.cloud.spark:spark-bigquery-with-dependencies_2.12:0.41.1 in order to communicate with BigQuery.

Packages

falgueras.common

Shared code between other packages and utils functions: datetime, json, enums, logging.

falgueras.gcp

The functionalities of various Google Cloud Platform (GCP) services are encapsulated within custom client classes. This approach enhances clarity and promotes better encapsulation. File services_toolbox.py contains standalone functions to interact with GCP services. If there's more than one function for a particular service, they must be grouped in a custom client class.

For instance, Google Cloud Storage (GCS) operations are wrapped in the gcp.GcsClient class, which has an attribute that holds the actual storage.Client object from GCS. Multiple GcsClient instances can share the same storage.Client object.

falgueras.pandas

Pandas related code.

The pandas_repo.py file provides a modular and extensible framework for handling pandas DataFrame operations across various storage systems. Using the PandasRepo abstract base class and PandasRepoProtocol, it standardizes read and write operations while enabling custom implementations for specific backends such as BigQuery (BqPandasRepo). These implementations encapsulate backend-specific logic, allowing users to interact with data sources using a consistent interface.

BqPandasRepo uses gcp.BqClient to interact with BigQuery.

falgueras.spark

Spark related code.

In the same way than the pandas_repo.py file, the spark_repo.py file provides a modular and extensible framework for handling Spark DataFrame operations across various storage systems. Using the SparkRepo abstract base class and SparkRepoProtocol, it standardizes read and write operations while enabling custom implementations for specific backends such as BigQuery (BqSparkRepo). These implementations encapsulate backend-specific logic, allowing users to interact with data sources using a consistent interface.

In contrast to BqPandasRepo, BqSparkRepo uses connectors gcs-connector-hadoop3 and spark-bigquery-with-dependencies in order to interact with BigQuery.

Metadata

Release files for falgueras 1.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for falgueras 1.1.6
File Size Uploaded
falgueras-1.1.6.tar.gz 23.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for falgueras 1.1.6
File Interpreter ABI Platform
falgueras-1.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 51.9 kB

Release files / falgueras-1.1.6.tar.gz

Download URL falgueras-1.1.6.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
26495e20ff0759b6cbc34789312dca0c9528cd7f12420d3dd96eb8057ba171c1
BLAKE2b-256 checksum
How to use checksums
90bfaf7712733446ba3f68b79d975c2f9e0c0d39fd8b0f0fe8699a10bd4eb60f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release files / falgueras-1.1.6-py3-none-any.whl

Download URL falgueras-1.1.6-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d9362ac52dc5be22f76032646b38ec974f68033ed5470c755485dfa723a3faf
BLAKE2b-256 checksum
How to use checksums
c2f1895e7121207c32fc0ca9bf290de7efa6422fe96d6b16382a6233526eaecd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release history Release notifications | RSS feed

This release

1.1.6 This release

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page