semvec/pypi-packages huggingface dataset:
profile-me 0.1.0
Enable external profiler attachment for Python processes
Requires Python: >=3.8
Keywords: debugging, performance, profiling, ptrace, py-spy, yantra

# profile-me

Enable external profiler attachment for Python processes on Linux.

## The Problem

Modern Linux distributions use [Yama LSM](https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html) to restrict which processes can use `ptrace`. By default (`ptrace_scope=1`), only parent processes can attach to their children.

This means tools like **py-spy**, **Yantra**, **gdb**, and other profilers/debuggers cannot attach to your Python process unless you either:
- Run as root
- Change system-wide ptrace settings
- Have the target process explicitly opt-in

## The Solution

`profile-me` provides a simple one-liner to opt your process in:

```python
import profile_me
profile_me.enable_profiling()
```

This calls `prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY)` which tells the kernel "allow any process owned by my user to attach to me."

## Installation

```bash
pip install profile-me
```

## Usage

### Basic Usage

Add this near the top of your script:

```python
import profile_me
profile_me.enable_profiling()

# Your code here...
```

### One-liner (no import needed at top)

```python
__import__('profile_me').enable_profiling()
```

### Environment Variable

Set `PROFILE_ME=1` to auto-enable when the module is imported:

```bash
PROFILE_ME=1 python my_script.py
```

Add `PROFILE_ME_QUIET=1` to suppress the message.

### Context Manager

```python
import profile_me

with profile_me.profiling_enabled():
    # Code you want to profile
    run_computation()
```

### Check Status

```python
import profile_me

profile_me.enable_profiling()
print(f"Enabled: {profile_me.is_profiling_enabled()}")
print(f"PID: {profile_me.get_pid()}")
```

## Example with py-spy

```bash
# Terminal 1
PROFILE_ME=1 python my_server.py

# Terminal 2
py-spy record -p <PID> -o profile.svg
```

## API Reference

### `enable_profiling(quiet=False) -> bool`

Enable external profiler attachment. Returns `True` on success.

- `quiet`: If `True`, suppress the informational message to stderr.

### `is_profiling_enabled() -> bool`

Check if profiling has been enabled for this process.

### `get_pid() -> int`

Get the current process ID (convenience wrapper around `os.getpid()`).

### `profiling_enabled(quiet=False)`

Context manager that calls `enable_profiling()` on entry.

## Platform Support

- **Linux**: Full support
- **macOS**: No-op (macOS doesn't have Yama)
- **Windows**: No-op (Windows doesn't have Yama)

## Security Considerations

Calling `enable_profiling()` allows any process running as your user to attach to your Python process. This is the same permission model as running with `ptrace_scope=0`.

Only use this in development/debugging scenarios or when you trust all processes running under your user account.

## License

MIT
sphinx-inline-tabs 2025.12.21.14
Add inline tabbed content to your Sphinx documentation.
Requires Python: >=3.8

# Sphinx Inline Tabs

![demo image](https://raw.githubusercontent.com/pradyunsg/sphinx-inline-tabs/main/docs/_static/demo.png)

<!-- start-include-here -->

Add inline tabbed content to your Sphinx documentation.

## Installation

This project is available on PyPI, and can be installed using pip:

```
pip install sphinx-inline-tabs
```

You'll also want to add the extension to `extensions` in `conf.py`:

```python
extensions = [
    ...,
    "sphinx_inline_tabs",
    ...,
]
```

## Features

- **Elegant design**: Small footprint in the markup and generated website, while looking good.
- **Configurable**: All the colors can be configured using CSS variables.
- **Synchronisation**: Tabs with the same label all switch with a single click.
- **Works without JavaScript**: JavaScript is not required for the basics, only for synchronisation.

<!-- end-include-here -->

## Contributing

sphinx-inline-tabs is a volunteer maintained open source project, and we welcome contributions of all forms.

The [Code of Conduct](CODE_OF_CONDUCT.md) applies within all community spaces. If you are not familiar with our Code of Conduct policy, take a minute to read the policy before starting with your first contribution.
hbin 0.1.0
Save Bash history as snippets / history tooling
Requires Python: >=3.9

# hbin

> Save your Bash history as snippets!

`hbin` (or history-bin) is a CLI tool that allows you to save snippets of your Bash history. You can list, view, edit, delete, export, share, or run your saved history snippets at any time, using a simple command line interface (with zero external package deps). It works by viewing and slicing your history to extract specific lines you want to save as a snippet.

## Install

```bash
pip install hbin
```

## Usage

```
ℹ `hbin` command actions. NOTE: actions cannot be combined: 
----------------------------------------------------------
-r (refresh history) 
-n NUM (show last NUM lines of history - goes into buffer) 
       (no flag: equivalent to -n 100) 
-c LIST (snip history; eg 1,3,5-9 - goes into buffer) 
        (COMMA-SEP lines or ranges, ignores unmatched) 
-b (show what's in the buffer - from last -n or -c) 
-s NAME (save latest output - the buffer - as a snippet) 
        (saving overwrites on name without warning!) 
-k NUM (delete the saved snippet) 
       (deleting does so without warning!) 
-l (list saved snippets) 
-d NUM (display saved snippet) 
-e NUM (edit saved snippet) 
-x NUM (execute saved snippet) 
-p NUM (paste saved snippet to paste.rs) 
-f NUM (export saved snippet as a shell script file) 
-u [USER] (get or set username) 
-h (this help)
```

## FAQ

### Only Bash?

Yes, for now.

### Can I get involved?

Yes, you can. Pick a fix or enhancement from Codeberg, fork the repo, and issue a pull request when ready.

## Future features

- Support for other shells / switch between shells (zsh, fish, csh, etc..)
- Back-up / restore your snippets
- Search history to find relevant lines
- Multi-lingual