# Needle 2 Model License: Apache-2.0 and MIT Dual-Licensing Explained

> Understand the Needle 2 model licensing. Explore the dual Apache-2.0 and MIT licenses offering maximum flexibility for your projects. Learn more about Cactus Compute's permissive terms.

- Repository: [Cactus Compute, Inc./needle](https://github.com/cactus-compute/needle)
- Tags: licensing-details
- Published: 2026-08-14

---

**The Needle 2 model is dual-licensed under Apache-2.0 (package metadata) and MIT (repository LICENSE file), giving users the flexibility to choose either permissive license.**

The `cactus-compute/needle` repository distributes its Needle 2 model with an unusual licensing setup that has important implications for how you attribute and redistribute the code. Understanding which license applies—and when—ensures compliance whether you're installing via PyPI or forking the source.

## How the Dual License Works

The project maintains **two distinct license declarations**:

- **[`pyproject.toml`](https://github.com/cactus-compute/needle/blob/main/pyproject.toml) (line 7)** — declares **Apache-2.0** as the package license
- **`LICENSE` file** — contains the full **MIT** license text

This creates an effective dual-licensing arrangement. The Apache-2.0 declaration governs the Python package metadata and PyPI distribution, while the MIT license text ships with the source code itself.

## Retrieving License Information Programmatically

You can verify the declared license directly from installed package metadata:

```python

# Query the license from package metadata (Apache-2.0)

import importlib.metadata as meta

print(meta.metadata("cactus-needle")["License"])

# Output: Apache-2.0

```

For the MIT license text bundled with the source distribution:

```bash

# Locate and display the LICENSE file contents

cat $(python -c "import pkg_resources, pathlib, sys; \
print(pathlib.Path(pkg_resources.resource_filename('needle', '../LICENSE')).resolve())")

# Displays the MIT license full text

```

## Key Files and Their Roles

Understanding each file's purpose clarifies which license terms apply to your use case:

| File | License Content | Purpose |
|------|-----------------|---------|
| [`pyproject.toml`](https://github.com/cactus-compute/needle/blob/main/pyproject.toml) | Apache-2.0 declaration | Package metadata for PyPI and pip installations |
| `LICENSE` | MIT license full text | Source distribution and repository copies |
| [`README.md`](https://github.com/cactus-compute/needle/blob/main/README.md) | Overview only | Project documentation; no license terms |

**Source references**: [[`pyproject.toml`](https://github.com/cactus-compute/needle/blob/main/pyproject.toml)](https://github.com/cactus-compute/needle/blob/main/pyproject.toml) · [`LICENSE`](https://github.com/cactus-compute/needle/blob/main/LICENSE) · [[`README.md`](https://github.com/cactus-compute/needle/blob/main/README.md)](https://github.com/cactus-compute/needle/blob/main/README.md)

## Which License Should You Use?

Both licenses are **permissive open-source licenses** with minimal restrictions:

- **Apache-2.0** (recommended for formal projects)
  - Requires preservation of copyright notice and license text
  - Mandates documentation of any changes made
  - Provides express patent grant protection
  - Preferred for enterprise and commercial redistribution

- **MIT** (simpler for informal use)
  - Requires only copyright notice preservation
  - Shorter, simpler terms
  - No explicit patent provisions
  - Suitable for academic and research contexts

## Compliance Requirements

Regardless of which license you select, you must:

1. **Retain the original copyright notice**
2. **Include a copy of your chosen license text** in distributions
3. **Document any modifications** (Apache-2.0 specific)

For Apache-2.0 compliance, also include the NOTICE file if one exists. For MIT compliance, the single-line copyright notice in the LICENSE file suffices.

## Summary

- The Needle 2 model uses **dual licensing**: Apache-2.0 in [`pyproject.toml`](https://github.com/cactus-compute/needle/blob/main/pyproject.toml), MIT in the `LICENSE` file
- **Apache-2.0** governs PyPI package metadata and is preferred for formal distribution
- **MIT** ships with source code and offers simpler attribution requirements
- Both licenses permit commercial use, modification, and redistribution
- Use `importlib.metadata` to programmatically verify the declared license

## Frequently Asked Questions

### Can I choose either license for my project?

Yes. The dual-licensing structure allows you to comply with either Apache-2.0 or MIT terms. Select based on your project's patent protection needs and attribution complexity preferences.

### Why does the repository use two different licenses?

This appears to be an artifact of packaging decisions—Apache-2.0 for PyPI metadata compatibility and MIT for source distribution simplicity—rather than intentional dual-licensing strategy. Both are valid and binding.

### Does the Needle 2 model have any usage restrictions?

No. Both Apache-2.0 and MIT are permissive licenses with no field-of-use restrictions. You may use, modify, and redistribute the model for commercial, academic, or personal purposes provided you meet the minimal attribution requirements.

### Which license text should I include in my derivative work?

Include the license corresponding to your compliance choice: the full MIT text from the `LICENSE` file, or the Apache-2.0 text available at [apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0). When in doubt, Apache-2.0 provides stronger legal protections.