Skip to main content
drawing>

Easy environment : easy-to-use Python environment management toolkit

Easy Environment is a Python tool that provides easy-to-use functionality for managing files and data in different environments. It offers a class that simplifies file operations on the local disk and cloud services such as Google Cloud (Google Cloud Storage and Big Query) or SharePoint.

Features

  • Multi-format loading and saving: Load and save files in various formats with one command line
    • Default supported formats: csv, docx, jpg, json, md, parquet, pdf, pickle, png, pptx, sql, toml, txt, xlsx, xml, yaml, yml
    • Unsupported formats: Customisable. See Customise supported formats.
  • Multi-environment management:
    • Local disk: Loading/saving and management.
    • Google Cloud Storage: Loading/saving and management.
    • Big Query: Append, write, and run queries on Big Query tables.
    • SharePoint: Download, upload, and manage files on SharePoint.

drawing

Start by installing easyenvi :

pip install easyenvi

Multi-format loading and saving

Load or save a large variety of format : csv, docx, jpg, json, md, parquet, pdf, pickle, png, pptx, sql, toml, txt, xlsx, xml, yaml, yml

from easyenvi import file

secrets = file.load('my_path/secrets.toml')
config = file.load('my_path/config.json')
query = file.load('my_path/titanic.sql')

file.save(df, 'my_path/titanic.csv')
file.save(df, 'my_path/my_dict.parquet')
file.save(my_dict, 'my_path/my_dict.pickle')

Multi-environment management

To use Easy Environment, create an instance of the EasyEnvironment class. All the parameters in the EasyEnvironment class are optional: it depends on which environment you need to access.

from easyenvi import EasyEnvironment

envi = EasyEnvironment(
  local_path="", # Optional

  gcloud_project_id="your-project-id", # Optional
  gcloud_credential_path="path/to/credentials.json", # Optional
  GCS_path="gs://your-bucket-name/", # Optional

  sharepoint_site_url="https://{tenant}.sharepoint.com/sites/{site}", # Optional
  sharepoint_username="your-username", # Optional
  sharepoint_user_password="your-password" # Optional
                  )

Specifying certain parameters means certain dependencies:

  • For using local operation, local_path is the path from which local operations should be executed - specify an empty string if you want to use the current directory.
  • For using Google Cloud, it is necessary to specify the project ID, the path to a credential .json file, and, in case of interaction with Google Cloud Storage, the path to the GCS folder (see Google Cloud Initialisation).
  • For using SharePoint, it is necessary to specify the SharePoint site to interact with, as well as authentication credentials: either the client_id/client_secret pair or the username/user_password pair (see SharePoint Initialisation).

Examples of use

Local features

# Load any file format
my_dict = envi.local.load(path='inputs/my_dictionnary.pickle')
my_logo = envi.local.load(path='inputs/my_logo.png')
dataset = envi.local.load(path='inputs/dataset.csv')

# Save any file format
envi.local.save(obj=my_dict, path='outputs/my_dictionnary.pickle')
envi.local.save(obj=my_logo, path='outputs/my_logo.png')
envi.local.save(obj=dataset, path='outputs/dataset.csv')

Google Cloud Storage features

# Load any file format
my_dict = envi.gcloud.GCS.load(path='inputs/my_dictionnary.pickle')
my_logo = envi.gcloud.GCS.load(path='inputs/my_logo.png')
dataset = envi.gcloud.GCS.load(path='inputs/dataset.csv')

# Save any file format
envi.gcloud.GCS.save(obj=my_dict, path='outputs/my_dictionnary.pickle')
envi.gcloud.GCS.save(obj=my_logo, path='outputs/my_logo.png')
envi.gcloud.GCS.save(obj=dataset, path='outputs/dataset.csv')

Big Query features

df = pd.DataFrame(data={'age': [21, 52, 30], 'wage': [12, 17, 11]})

# Create a new table
envi.gcloud.BQ.write(dataset, 'mydata.mytable')

# Append an existing table
envi.gcloud.BQ.append(dataset, 'mydata.mytable')

# Run queries
query = """
SELECT *
FROM mydata.mytable
WHERE age < 40
"""

new_dataset = envi.gcloud.BQ.query(query).to_dataframe()

SharePoint features

# Download a file
envi.sharepoint.download(
  input_path="/Document partages/sharepoint_folder/my_file.txt",
  output_path="local_folder/my_file.txt"
  )
                        
# Upload a file
envi.sharepoint.upload(
  input_path="local_folder/my_file.txt",
  output_path="Document partages/folder/my_file.txt"
  )
                      
# List files
envi.sharepoint.list_files(folder="local_folder")

Documentation

The documentation is available here : Easy Environment - Documentation

Future Improvements

Future releases of Easy Environment will include support for additional cloud storage providers, including Amazon Web Services (AWS) and Microsoft Azure.

Metadata

Release files for easyenvi 1.0.8

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

Source distribution (sdist)

Source distribution for easyenvi 1.0.8
File Size Uploaded
easyenvi-1.0.8.tar.gz 12.0 kB Details

Release files / easyenvi-1.0.8.tar.gz

Download URL easyenvi-1.0.8.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
845dd116a2bfbe76553d679ca3c57b83027450f262832756b54240cf36f4dbc8
BLAKE2b-256 checksum
How to use checksums
2214cb085073aae7cc1fff2a3f820acf8ad9b0b8a9625635b55e5974b1443d86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Release history Release notifications | RSS feed

This release

1.0.8 This release

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

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