Metadata-Version: 2.1
Name: getargv
Version: 0.11
Summary: Python bindings to libgetargv, a library to correctly and quickly get other process's args
Home-page: https://getargv.narzt.cam
Author: Camden Narzt
Author-email: Camden Narzt <getargv@narzt.cam>
License: BSD 3-Clause License
        
        Copyright (c) 2023, 2024 Camden Narzt <getargv@narzt.cam>. All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Source, https://github.com/getargv/getargv.py
Project-URL: Bug Reports, https://github.com/getargv/getargv.py/issues
Project-URL: Homepage, https://getargv.narzt.cam
Project-URL: Funding, https://github.com/sponsors/CamJN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Environment :: MacOS X
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: Python
Classifier: Programming Language :: C
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: importlib-metadata ; python_version < "3.8"

<h1><img src="logo.svg" width="200" alt="getargv"></h1>

[![Python package](https://github.com/getargv/getargv.py/actions/workflows/python-package.yml/badge.svg)](https://github.com/getargv/getargv.py/actions/workflows/python-package.yml)

This module uses libgetargv to obtain binary string representations of the arguments of other processes on macOS.

## Motivation

On macOS you must use the KERN_PROCARGS2 sysctl to obtain other proc's args, however the returned representation is badly documented and a naive approach doesn't deal with leading empty args. libgetargv parses the results of the sysctl correctly, and this module provides Python bindings to libgetargv.

## Installation

Install the module with pip by executing:

    $ pip install getargv

## Usage

```python
import os
import getargv
getargv.as_bytes(os.getpid()) #=> b'arg0\x00arg1\x00'
getargv.as_list(os.getpid()) #=> [b'arg0',b'arg1']
```

## Development

After checking out the repo, run `python setup.py build`. Then run `python setup.py install`. Then, run `python test.py` to run the tests. You can also run `python -i load.py` for an interactive prompt that will allow you to experiment. Python code goes in the file `src/getargv/__init__.py`, C code goes in the file `src/getargv/getargvmodule.c`.

To install this module onto your local machine, run `python setup.py build && python setup.py install`. To release a new version, update the version number in `pyproject.toml`, and then run `make upload-production`, which will create a git tag for the version, push git commits and the created tag, and push the `.whl` file to [pypi.org](https://pypi.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/getargv/getargv.py.

## License

The module is available as open source under the terms of the [BSD 3-clause License](https://opensource.org/licenses/BSD-3-Clause).
