Skip to content

Commit

Permalink
Merge pull request #25 from prompt-security/prepare_pypi_package_fix_…
Browse files Browse the repository at this point in the history
…naming

Prepare pypi release distribution and update executable and package n…
  • Loading branch information
vitaly-ps authored Apr 16, 2024
2 parents c85cfdf + cb0bf95 commit 1b7e0bb
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 11 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@ jobs:
- name: Build distribution
run: bash build_package.sh

- name: Create GitHub Release
- name: Upload artifacts to GitHub Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
name: Release ${{ env.PKG_VERSION }} of ${{ github.repository }}
body: This is the release of ${{ github.repository }} for version ${{ env.PKG_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install twine
run: python -m pip install twine

- name: Publish package to PyPI
run: twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ venv
.env
__pycache__
*.egg-info/
prompt_security_fuzzer.log
prompt-security-fuzzer.log
.prompt-security-fuzzer-config.json
.pytest_cache
build/
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ needing a separate installation step for testing changes.

To execute the tool, use the following command:
```bash
prompt_security_fuzzer --help
prompt-security-fuzzer --help
```

Or alternatively, execute directly from subdirectory:
Expand Down Expand Up @@ -176,7 +176,7 @@ from .attacks import (

#### 6. Open a PR! Submit your changes for review by opening a pull request.

#### That’s all it takes to contribute a new test to the PS-Fuzz project!
#### That’s all it takes to contribute a new test to the Prompt Security Fuzzer project!

## Submitting a pull request

Expand Down
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include LICENSE
include README.md
include CONTRIBUTING.md
include pytest.ini
recursive-include ps_fuzz/attack_data *
recursive-include system_prompt.examples *
recursive-include tests *
global-exclude *.pyc
global-exclude __pycache__/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
### 💻 Usage

```
usage: prompt_security_fuzzer [-h] [--list-providers] [--list-attacks] [--attack-provider ATTACK_PROVIDER] [--attack-model ATTACK_MODEL] [--target-provider TARGET_PROVIDER]
usage: prompt-security-fuzzer [-h] [--list-providers] [--list-attacks] [--attack-provider ATTACK_PROVIDER] [--attack-model ATTACK_MODEL] [--target-provider TARGET_PROVIDER]
[--target-model TARGET_MODEL] [-n NUM_ATTEMPTS] [-t NUM_THREADS] [-a ATTACK_TEMPERATURE] [-d DEBUG_LEVEL] [-b]
[system_prompt_file]
Expand Down Expand Up @@ -85,10 +85,10 @@ We're fully LLM agnostic.
## 🔫 Sample system prompts
Run tests against the system prompt (in non-interactive batch mode):
```
prompt_security_fuzzer.py -b ./system_prompt.examples/medium_system_prompt.txt
prompt-security-fuzzer -b ./system_prompt.examples/medium_system_prompt.txt
```

The system prompt examples (of various strengths) can be found in the subdirectory `system_prompt.examples`
The system prompt examples (of various strengths) can be found in the subdirectory `system_prompt.examples` in the sources.


<a id="usage"></a>
Expand Down
2 changes: 1 addition & 1 deletion ps_fuzz/prompt_injection_fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def fuzz_prompt_injections(client_config: ClientConfig, attack_config: AttackCon
print(f"Your system prompt passed {int(resilient_tests_percentage)}% ({resilient_tests_count} out of {total_tests_count}) of attack simulations.")
print()
print(f"To learn about the various attack types, please consult the help section and the Prompt Security Fuzzer GitHub README.")
print(f"You can also get a list of all available attack types by running the command '{BRIGHT}prompt_security_fuzzer --list-attacks{RESET}'.")
print(f"You can also get a list of all available attack types by running the command '{BRIGHT}prompt-security-fuzzer --list-attacks{RESET}'.")

# Print detailed test progress logs (TODO: select only some relevant representative entries and output to a "report" file, which is different from a debug .log file!)
"""
Expand Down
2 changes: 1 addition & 1 deletion ps_fuzz/ps_logging.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from logging.handlers import RotatingFileHandler

LOG_FILE_PATH = "prompt_security_fuzzer.log"
LOG_FILE_PATH = "prompt-security-fuzzer.log"

def setup_logging(debug_level: int):
# Set up logging with specific debug_level
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
long_description = fh.read()

setup(
name="ps_fuzz",
name="prompt-security-fuzzer",
version=os.getenv('PKG_VERSION', '0.0.1'),
author="Prompt Security",
author_email="support@prompt.security",
Expand Down Expand Up @@ -50,7 +50,8 @@
},
entry_points={
'console_scripts': [
'prompt_security_fuzzer=ps_fuzz.cli:main',
'prompt-security-fuzzer=ps_fuzz.cli:main',
],
},
license="MIT",
)

0 comments on commit 1b7e0bb

Please sign in to comment.