Read and upload files to/from Nextcloud directly in Jupyter notebooks without downloading them locally
Project description
Read and upload files to/from Nextcloud directly in Jupyter notebooks without downloading them locally.
This package provides seamless integration between Nextcloud and Jupyter notebooks, allowing you to work with cloud-stored files as if they were local, supporting 25+ file formats including LiDAR point clouds, geospatial data, and scientific datasets.
🌟 Features
- ✅ Read files remotely - No local downloads needed
- ✅ Download files/folders - Save to local disk when needed
- ✅ Upload files/folders - Via WebDAV protocol
- ✅ Move & rename - Organize files on Nextcloud
- ✅ 30+ file formats - From CSV to LiDAR point clouds
- ✅ Auto-detection - Automatically detect and read any supported format
- ✅ Memory efficient - Stream files directly into memory
- ✅ Jupyter optimized - Perfect for notebooks and data science workflows
📦 Installation
Basic installation
pip install nextcloud-jupyter
With optional dependencies
For LiDAR/Point Cloud support (.las, .laz):
pip install nextcloud-jupyter[lidar]
For Geospatial support (.shp, .geojson, .kml, .kmz):
pip install nextcloud-jupyter[geo]
For HDF5 support (.hdf5, .h5, .hd5):
pip install nextcloud-jupyter[hdf5]
For Advanced formats (Parquet, NetCDF, Zarr, etc.):
pip install nextcloud-jupyter[advanced]
For Jupyter with visualization:
pip install nextcloud-jupyter[jupyter]
For everything:
pip install nextcloud-jupyter[all]
🚀 Quick Start
1. Generate Nextcloud App Password
- Log in to your Nextcloud web interface
- Go to Settings → Security
- Under "Devices & sessions", create a new app password
- Copy the generated password
2. Read Files from Nextcloud
from nextcloud_jupyter import NextcloudReader
# Initialize reader
nc = NextcloudReader(
nextcloud_url="https://your-nextcloud-server.com",
username="your_username",
app_password="your_app_password"
)
# Read a CSV file directly from Nextcloud
df = nc.read_csv('/inputs/data.csv')
print(df.head())
3. Upload Files to Nextcloud
from nextcloud_jupyter import NextcloudUploader
# Initialize uploader
uploader = NextcloudUploader(
nextcloud_url="https://your-nextcloud-server.com",
username="your_username",
app_password="your_app_password"
)
# Upload a file
uploader.upload_file("local_data.csv", "/inputs/data.csv")
# Upload entire folder
uploader.upload_folder("./my_folder", "/inputs")
4. Download Files from Nextcloud
# Download a single file
nc.download_file('/inputs/data.csv', './downloads/data.csv')
# Download entire folder
nc.download_folder('/inputs/project_data', './downloads')
# Download multiple files
files = ['/data/file1.csv', '/data/file2.csv', '/reports/summary.pdf']
results = nc.download_files(files, './downloads')
print(f"Downloaded: {len(results['successful'])} files")
📚 Supported File Types
Data Formats
- CSV (
.csv) -read_csv() - Excel (
.xlsx,.xls) -read_excel() - JSON (
.json) -read_json() - Parquet (
.parquet) -read_parquet() - Feather (
.feather) -read_feather() - HDF5 (
.hdf5,.h5,.hd5) -read_hdf5()
Arrays
- NumPy (
.npy) -read_numpy() - Compressed NumPy (
.npz) -read_npz()
LiDAR / Point Clouds
- LAS (
.las) -read_las() - LAZ (
.laz) -read_laz()(compressed)
Geospatial
- Shapefile (
.shp) -read_shapefile() - DBF (
.dbf) -read_dbf()(shapefile attributes) - PRJ (
.prj) -read_prj()(projection info) - SHX (
.shx) -read_shx()(shapefile index) - GeoJSON (
.geojson) -read_geojson() - KML (
.kml) -read_kml()(Google Earth) - KMZ (
.kmz) -read_kmz()(compressed KML) - NetCDF (
.nc) -read_netcdf()
Archives
- ZIP (
.zip) -read_zip() - TAR (
.tar,.tar.gz,.tgz) -read_tar()
Configuration
- YAML (
.yaml,.yml) -read_yaml() - XML (
.xml) -read_xml()
Other
- Python Pickle (
.pkl,.pickle) -read_pickle() - Images (
.png,.jpg,.jpeg,.tiff, etc.) -read_image() - Text (
.txt) -read_text_file()
Auto-Detection
# Automatically detect file type and read
data = nc.read_auto('/inputs/unknown_file.csv')
💡 Usage Examples
Working with LiDAR Point Clouds
# Read LAS file
las_data = nc.read_las('/inputs/lidar/scan.las')
x, y, z = las_data.x, las_data.y, las_data.z
print(f"Points: {len(las_data.points):,}")
# Read LAZ (compressed)
laz_data = nc.read_laz('/inputs/lidar/scan.laz')
points = np.vstack([laz_data.x, laz_data.y, laz_data.z]).T
Working with Compressed NumPy Arrays
# Read NPZ with multiple arrays
npz_data = nc.read_npz('/inputs/arrays/data.npz')
array1 = npz_data['array1']
array2 = npz_data['array2']
npz_data.close()
Working with Geospatial Data
# Read GeoJSON
gdf = nc.read_geojson('/inputs/maps/boundaries.geojson')
gdf.plot()
# Read KML
kml_data = nc.read_kml('/inputs/maps/locations.kml')
# Read shapefile components
df_attributes = nc.read_dbf('/inputs/gis/data.dbf')
projection = nc.read_prj('/inputs/gis/data.prj')
Working with HDF5 Files
# Read HDF5
with nc.read_hdf5('/inputs/data/measurements.hdf5') as h5f:
dataset = h5f['temperature'][:]
print(dataset.shape)
Processing Multiple Files
# List files in a folder
files = nc.list_folder('/inputs/data')
# Process all CSV files
for file in files:
if file['name'].endswith('.csv') and not file['is_folder']:
df = nc.read_csv(f"/inputs/data/{file['name']}")
# Process dataframe...
Check File Existence
if nc.file_exists('/inputs/data.csv'):
df = nc.read_csv('/inputs/data.csv')
else:
print("File not found!")
Download Files and Folders
# Download single file
nc.download_file(
remote_path='/inputs/data.csv',
local_path='./downloads/data.csv'
)
# Download entire folder with all contents
nc.download_folder(
remote_path='/inputs/project_data',
local_path='./downloads'
)
# Download multiple files at once
files_to_download = [
'/inputs/data1.csv',
'/inputs/data2.csv',
'/reports/summary.pdf'
]
results = nc.download_files(files_to_download, './downloads')
# Download with preserved folder structure
results = nc.download_files(
remote_files=['/inputs/folder1/file.csv', '/reports/2024/data.pdf'],
local_dir='./downloads',
preserve_structure=True # Keeps Nextcloud folder structure
)
# Download only specific file types
files = nc.list_folder('/inputs/data')
csv_files = [f"/inputs/data/{f['name']}" for f in files if f['name'].endswith('.csv')]
nc.download_files(csv_files, './downloads/csv_only')
Move and Rename Files/Folders
# Move a file
nc.move_file('/inputs/data.csv', '/archive/data.csv')
# Move with overwrite
nc.move_file('/inputs/report.pdf', '/archive/report.pdf', overwrite=True)
# Rename a file
nc.rename_file('/inputs/old_name.csv', 'new_name.csv')
# Move a folder
nc.move_folder('/inputs/project1', '/archive/project1')
# Move multiple files
moves = [
('/inputs/old1.csv', '/archive/old1.csv'),
('/inputs/old2.csv', '/archive/old2.csv'),
]
results = nc.move_files(moves)
🛡️ Security
- Never commit your app password to version control
- Use environment variables for credentials:
import os
from nextcloud_jupyter import NextcloudReader
nc = NextcloudReader(
nextcloud_url=os.getenv('NEXTCLOUD_URL'),
username=os.getenv('NEXTCLOUD_USERNAME'),
app_password=os.getenv('NEXTCLOUD_APP_PASSWORD')
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nextcloud_esamaap-0.1.0.tar.gz.
File metadata
- Download URL: nextcloud_esamaap-0.1.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbc2285237d95696cfbe9c3f2a6c1fc1cf8982e358ba529417a71a6fbfae5304
|
|
| MD5 |
d561811ec1623b3b2af62e566c37ab88
|
|
| BLAKE2b-256 |
69982313743e37bd2c59af879646c7f3a1f51a42d1f1b7a88d898c87d49f431b
|
File details
Details for the file nextcloud_esamaap-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nextcloud_esamaap-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
088ddaa0e23f99ba49b1da98a2827e363822ae078756b88b6ca6c5eac1415f83
|
|
| MD5 |
03f67edf6b1b2563240e167bf0d2e337
|
|
| BLAKE2b-256 |
bc3bb5f0f4c1cb4ae784efd8bc15b73ed7ee13f69e468a4797548649708aee80
|