Skip to main content

mapu

A native Python implementation of the classic R package vegan for community ecology.

This package aims to provide ecologists and data scientists using Python with rapid, pure-Python ports of popular vegan functions, including diversity indices, distance matrices (vegdist), ordination techniques, and multivariate statistical tests.

Installation

You can install mapu using pip:

pip install mapu

Or using uv for ultra-fast dependency resolution and installation:

uv pip install mapu

Development Installation

To install from source for development using uv:

git clone https://github.com/pedropablosilvaa/mapu.git
cd mapu
uv venv
source .venv/bin/activate  # On Unix/macOS
uv pip install -e ".[dev]"

Features

The library currently supports a wide array of functions mirroring R vegan:

  • Diversity Analysis: diversity (Shannon, Simpson, etc.), fisher_alpha, specnumber, renyi, tsallis, rarefaction functions (rarefy, rrarefy), and species accumulation curves.
  • Distance Matrices: vegdist (Bray-Curtis, Jaccard, Euclidean, Manhattan, Gower, etc.), designdist.
  • Ordination: Unconstrained (PCoA/cmdscale, PCA, NMDS/metaMDS, isomap) and Constrained (rda, cca, capscale).
  • Data Transformation: decostand, wisconsin.
  • Statistical Tests: adonis (PERMANOVA), anosim, mantel, mrpp, simper, betadisper.
  • Clustering: spantree, cascadeKM, cophenetic.

Example Usage

import numpy as np
import pandas as pd
from mapu import vegdist, metaMDS, diversity

# Create a mock species abundance matrix (sites x species)
np.random.seed(42)
community_data = pd.DataFrame(np.random.poisson(lam=2, size=(10, 20)))

# Calculate Bray-Curtis distance
bray_dist = vegdist(community_data, method="bray")

# Perform Non-metric Multidimensional Scaling (NMDS)
nmds_result = metaMDS(community_data, distance="bray", k=2)
print("Stress:", nmds_result.stress)

# Calculate Shannon diversity
shannon_h = diversity(community_data, index="shannon")
print("Shannon Diversity:\\n", shannon_h)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for mapu 0.1.0

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

Source distribution (sdist)

Source distribution for mapu 0.1.0
File Size Uploaded Provenance Actions
mapu-0.1.0.tar.gz 31.0 kB With provenance Details for mapu-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 64.7 kB

Release files / mapu-0.1.0.tar.gz

Download URL mapu-0.1.0.tar.gz
Size 31.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a4827b37d5c56d31e6bb000aef3bd98061d9946eda999b864ce3e22df7127ffa
BLAKE2b-256 checksum
How to use checksums
dd66ffee898e0714a76b573ece6d53f81e7148b2b655daeca543ba5659f2280f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Release files / mapu-0.1.0-py3-none-any.whl

Download URL mapu-0.1.0-py3-none-any.whl
Size 33.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50c0d9660157ed44bd9bee5d02a4bf95e7d01b811ddb5958ea3ae0ae803c1bef
BLAKE2b-256 checksum
How to use checksums
3ab839833056563055a9944e27ba050b793b643f5884704f70442eaa91e3b42f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

Security for mapu 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mapu-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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