semvec/pypi-packages huggingface dataset:
pypho 0.0.4
Interactive photogrammetric design for geological objects
Requires Python: >=3.10
Keywords: photography, photogrammetry, geology

# PyPho

This repository provides a Python package dedicated to photogrammetric design called **PyPho**.  
Notebooks for testing and using pypho online are provided in a twin repository: [PyPho_notebooks](https://github.com/GeoISTO/PyPho_notebooks)

## Development ##

Current version: 0.0.4  
Main repository for PyPho is at: [GitHub/PyPho](https://github.com/GeoISTO/PyPho)

### Dependencies ###

**PyPho** primarilly depends on the incredible [pyvista](https://pyvista.org/) package for the interactive scenes and 3D visualisation.  
**Pyvista** in turns relies on [trame](https://kitware.github.io/trame/guide/) and interfaces [vtk](https://vtk.org) for this.  
Note that **trame** comes with a main package, but requires companion packages to be installed as well to support the various backends.

Some computational aspects such as rotations are imported from [scipy](https://scipy.org)  
and dataframes manipulations rely on [pandas](https://pandas.pydata.org/).  
Note that [numpy](https://numpy.org/) is also used, but should be already installed as a dependence of pandas.

Please refer to the [pyproject.toml](./pyproject.toml) file for a complete list of requirements and versions.  
Check the ```project.dependencies``` variable.

### Environment and Install ###

It is recommended to create an environment to separate contexts when using python packages.  
You can either create a [venv](https://docs.python.org/3/library/venv.html) or use a [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) env.

#### Installation
See below for creating your environment if needed: [Python Virtual Env](#python-virtual-env)

For installing **PyPho** simply run:
```
python -m pip install pypho
```

If you want additional dependencies installed, you can add ```[option]```.  
Here are the available options:
* for notebook support (recommended for pypho):
    ```
    python -m pip install pypho[nb]
    ```

#### Python Virtual Env

* Make sure the python version installed complies with the specifications in the [toml file](pyproject.toml)
* Go to where you'd like to create the env: ```cd where_you_have_your_envs```
* Create the environment: ```python -m venv .\pypho```
* Activate it by running the activate script ```.\pypho\Scripts\activate```
* then install pypho with pip: [see installation](#installation)

#### Conda Env

* Start your conda command line.
* Create and environment based on the desired python version: ```conda create -c conda-forge -n pypho python=3.11```
* Activate it: ```conda activate pypho```
* then install pypho with pip: [see installation](#installation)

See the conda documentation for a detailed view of environments: [conda envs](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)
streamlit-downloader 0.0.3
Streamlit component to download a file programmatically, without user input.
Requires Python: >=3.7

# Streamlit Downloader

A Streamlit component that triggers an automatic download of one or more files without requiring user interaction.

## Installation

```bash
pip install streamlit-downloader
```
# Usage

Use the downloader function to initiate a download. The component will automatically trigger the browser's download dialog when the page loads or when the component is rendered.

### Downloading a Single File

```python
import streamlit as st
from streamlit_downloader import downloader

# The `downloader` function returns True when the download is complete.
st.subheader("Download a single file")

data_to_download = b'Hello, this is the content of the file.'
filename = "my_text_file.txt"
content_type = "text/plain"

if st.button("Start Download"):
    download_complete = downloader(
        data=data_to_download,
        filename=filename,
        content_type=content_type
    )

    if download_complete:
        st.success(f"File '{filename}' has been downloaded!")
```

### Downloading Multiple Files

The downloader component can handle multiple files by being called multiple times.

```python
import streamlit as st
from streamlit_downloader import downloader

st.subheader("Download multiple files")

# File 1 details
data_file1 = b"This is the first file."
filename_file1 = "file1.txt"
content_type_file1 = "text/plain"

# File 2 details
data_file2 = b"This is the second file."
filename_file2 = "file2.csv"
content_type_file2 = "text/csv"

if st.button("Download Both Files"):
    # The component must be called for each file you want to download.
    download_complete_1 = downloader(
        data=data_file1,
        filename=filename_file1,
        content_type=content_type_file1,
    )
    
    download_complete_2 = downloader(
        data=data_file2,
        filename=filename_file2,
        content_type=content_type_file2,
    )

    if download_complete_1 and download_complete_2:
        st.success("All files have been downloaded!")
```


### Parameters

The `downloader` function accepts the following parameters:

* `data`: The raw data of the file to be downloaded. This can be a string, bytes, or a similar data type.
* `filename`: The name the downloaded file will have.
* `content_type`: The MIME type of the file (e.g., `text/csv`, `application/pdf`).
* `key`: (Optional) A unique key for the component, required when you have multiple downloaders on the same page.

---

## How It Works

The component leverages the browser's ability to trigger downloads using a hidden link element. When the Streamlit component is rendered, it uses JavaScript to create a `Blob` from the data, creates a temporary `<a>` element, sets its `href` to a URL created from the Blob, and simulates a click to initiate the download. The component is visually hidden to provide a seamless user experience.

---

## Development

To run the example app and test changes:

1.  Navigate to the `streamlit_downloader` directory.
2.  Run `streamlit run example.py`.