Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
name: Python CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Test with unittest
run: |
poetry run coverage run -m unittest discover tests
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
#name: Python CI
#
#on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
#
#jobs:
# build:
#
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
#
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install poetry
# poetry install
# - name: Test with unittest
# run: |
# poetry run coverage run -m unittest discover tests
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Python uv CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
run: pip install uv

- name: Install dependencies
run: |
uv sync --all-extras

- name: Run unit tests
run: |
uv run pytest tests/unittests/ -v --cov=passifypdf --cov-report=xml --cov-report=term

- name: Run integration tests
run: |
uv run pytest tests/integrationtests/ -v

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,12 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
.DS_Store
.DS_Store

# Add these lines if not already present
uv.lock
.venv/
*.pyc

# Poetry files are no longer needed
# poetry.lock # Already removed
43 changes: 43 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Install Dependencies
Uses [uv](https://docs.astral.sh/uv/) for dependency management.

```bash
cd passifypdf
pip install uv <--- Not required if you have already installed.
uv sync

Next >>>
>>> switch to virtual env <<<
source .venv/bin/activate
```

## Usage
Run the CLI tool using `uv run`:

```bash
source .venv/bin/activate
uv run passifypdf --help
```

Sample Run:
```bash
uv run passifypdf -i ./passifypdf/Sample_PDF.pdf -o temp_protected.pdf -p qwe123

# -------------------------Sample output----------------------
Congratulations!
PDF file encrypted successfully and saved as 'temp_protected.pdf'

Now "temp_protected.pdf" should be under the pwd folder.

```

# Run Tests:
- Run unit tests
```shell
uv sync --all-extras
uv run pytest tests/unittests/ -v --cov=passifypdf --cov-report=xml --cov-report=term
```
- Run integration tests
```shell
uv run pytest tests/integrationtests/ -v
```
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ But it still does the job, so you can ingore that "char or object error" which y
## Note:
In general you can use passifypdf to protect your PDF files against chance attackers.
But you should not rely on this for mission-critical data or situation.

## Build & Run Locally
Visit [BUILD.md](BUILD.md)
126 changes: 0 additions & 126 deletions poetry.lock

This file was deleted.

31 changes: 18 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
[tool.poetry]
[project]
name = "passifypdf"
version = "1.0.0"
description = "Protect PDF by a password of your choice"
authors = ["Nirmal Chandra <nirmal.fleet@gmail.com>"]
authors = [
{name = "Nirmal Chandra", email = "nirmal.fleet@gmail.com"}
]
readme = "README.md"
packages = [{include = "passifypdf"}]
requires-python = ">=3.8"
dependencies = [
"pypdf>=4.3.1",
]

[tool.poetry.dependencies]
python = "^3.8"
pypdf = "^4.3.1"
[project.optional-dependencies]
dev = [
"coverage>=7.0",
"pytest",
"pytest-cov",
]

[tool.poetry.group.dev.dependencies]
coverage = "^7.0"
[project.scripts]
passifypdf = "passifypdf.encryptpdf:main"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
passifypdf = "passifypdf.encryptpdf:main"
requires = ["hatchling"]
build-backend = "hatchling.build"
Loading