Skip to content

Commit

Permalink
Switch to uv (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjkuson authored Sep 28, 2024
1 parent ba8700a commit 4c9d7a2
Show file tree
Hide file tree
Showing 5 changed files with 392 additions and 86 deletions.
60 changes: 36 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,16 @@ name: CI

on:
push:
branches: ["main"]
branches: [main]
pull_request:
branches: ["main"]
permissions:
contents: read
workflow_dispatch:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "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 export --with dev -f requirements.txt --output /tmp/requirements.txt
pip install -r /tmp/requirements.txt
- name: Test
run: |
source scripts/test.sh

pre-commit:
name: "pre-commit"
runs-on: ubuntu-latest
Expand All @@ -52,3 +36,31 @@ jobs:
exit_code="${PIPESTATUS[0]}"
echo '```' >> "$GITHUB_STEP_SUMMARY"
exit "$exit_code"
mypy:
name: "mypy"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: checkout the repository
uses: actions/checkout@v4
- name: install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: test
run: uv run --frozen mypy src tests

pytest:
name: "pytest"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: checkout the repository
uses: actions/checkout@v4
- name: install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: test
run: uv run --frozen pytest
30 changes: 0 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Screener

[![image](https://img.shields.io/pypi/v/screener.svg)](https://pypi.python.org/pypi/screener)
[![image](https://img.shields.io/pypi/pyversions/screener.svg)](https://pypi.python.org/pypi/screener)

Check e-book files for security and privacy issues.

## Motivation
Expand All @@ -23,28 +20,13 @@ peace of mind!

## Get started

### Prerequisites

Screener requires [Python](https://www.python.org/about/gettingstarted/).

### Installing

Screener is available on [PyPI](https://pypi.org/project/screener/). To install,
run

```bash
pip install screener
```

#### Development installation

To install Screener for development, ensure you have [Poetry](https://python-poetry.org/)
clone the repository and run:

```bash
poetry install
```

### Usage

To check a file, try:
Expand All @@ -66,15 +48,3 @@ issue first to discuss what you would like to change. Please make sure to update
tests as appropriate.

If you have found a bug or have a feature request, please open an issue.

## Versioning

This project uses [SemVer](http://semver.org/) for versioning.

## Authors

Screener was created by Tom Kuson ([@tjkuson](https://github.com/tjkuson)).

## Licence

[MIT](LICENCE)
59 changes: 31 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
[tool.poetry]
name = "Screener"
[project]
name = "screener"
version = "0.5.1"
description = "Check e-book files for security and privacy issues."
authors = ["Tom Kuson <mail@tjkuson.me>"]
license = "MIT"
readme = "README.md"
packages = [
{ include = "screener", from = "src" },
authors = [
{ name = "Tom Kuson", email = "mail@tjkuson.me" }
]
requires-python = ">=3.10"
keywords = [
"ebook",
"security",
"privacy",
"epub",
"mobi",
"kindle",
]
repository = "https://github.com/tjkuson/screener/"
keywords = ["ebook", "security", "privacy", "epub", "mobi", "kindle"]
classifiers = [
"Topic :: Security",
"Topic :: Utilities",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.10",
"Topic :: Security",
"Topic :: Utilities",
]
dependencies = [
"beautifulsoup4>=4.12.2",
"Ebooklib>=0.18",
"mobi>=0.3.3",
]

[tool.poetry.dependencies]
python = "^3.10"
EbookLib = "^0.18"
beautifulsoup4 = "^4.12.2"
mobi = "^0.3.3"

[tool.poetry.group.dev.dependencies]
pytest = "^7.3.1"
coverage = "^7.2.5"
mypy = "^1.2.0"
types-beautifulsoup4 = "^4.12.0.5"
[tool.uv]
dev-dependencies = [
"mypy>=1.2.0",
"pytest>=7.3.1",
"types-beautifulsoup4>=4.12.0.5",
]

[tool.ruff]
select = [
Expand Down Expand Up @@ -79,10 +89,3 @@ ignore_missing_imports = true

[tool.pytest.ini_options]
pythonpath = "src"

[tool.poetry.scripts]
screener = "screener.__main__:main"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
4 changes: 0 additions & 4 deletions scripts/test.sh

This file was deleted.

Loading

0 comments on commit 4c9d7a2

Please sign in to comment.