Skip to content

Commit 8a4f2be

Browse files
authored
Migrate to uv (#570)
* Switch to uv * Use uv in test pypi upload * Add "explicit" to testpypi * Use hatchling for building * Use uv for real pypi publish * Rework usage/install
1 parent 6c7e3f4 commit 8a4f2be

File tree

7 files changed

+246
-1460
lines changed

7 files changed

+246
-1460
lines changed

.github/workflows/pypi-release.yml

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,26 @@ name: Release on PyPI
22

33
on:
44
release:
5-
types: [released]
5+
types: [ released ]
66
workflow_dispatch:
7-
branches: [main]
8-
inputs:
9-
version:
10-
description: 'Version'
11-
required: true
7+
branches: [ main ]
128

139
jobs:
1410
pypi_release:
1511
runs-on: ubuntu-latest
1612
steps:
17-
- uses: actions/checkout@v4
18-
- uses: actions/setup-python@v5
13+
- name: Checkout code
14+
uses: actions/checkout@v4
1915

20-
- name: Install Poetry
21-
run: |
22-
curl -sSL https://install.python-poetry.org | python3 -
23-
echo "${HOME}/.poetry/bin" >> $GITHUB_PATH
24-
25-
- name: Add Poetry to path
26-
run: echo "${HOME}/.poetry/bin" >> $GITHUB_PATH
27-
28-
- name: Install dependencies
29-
run: |
30-
poetry install
31-
sudo apt-get install progress
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v5
3218

33-
- name: Run tests
34-
run: poetry run pytest
19+
- name: Setup Python
20+
uses: actions/setup-python@v5
3521

36-
- name: Set version based on tag or input
22+
- name: Publish to PyPi
23+
env:
24+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
3725
run: |
38-
if [[ $GITHUB_EVENT_NAME == 'release' ]]; then
39-
VERSION=${GITHUB_REF#refs/tags/}
40-
else
41-
VERSION=${{ github.event.inputs.version }}
42-
fi
43-
poetry version $VERSION
44-
45-
- name: Configure Poetry
46-
run: poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}"
47-
48-
- name: Publish package
49-
run: poetry publish --build
26+
uv build
27+
uv publish

.github/workflows/pytest.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: tests
1+
name: Run tests
22

33
on: [ push, pull_request ]
44

@@ -15,6 +15,11 @@ jobs:
1515
- name: Checkout code
1616
uses: actions/checkout@v4
1717

18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v5
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
1823
- name: Setup Python
1924
uses: actions/setup-python@v5
2025
with:
@@ -24,14 +29,11 @@ jobs:
2429
- name: Install dependencies
2530
shell: bash
2631
run: |
27-
python -m pip install poetry && python -m pip install poetry-plugin-export
28-
python -m pip install --upgrade pip
29-
poetry export --dev --without-hashes --output requirements.txt
30-
python -m pip install -r requirements.txt
32+
uv sync
3133
sudo apt install progress -y
3234
3335
- name: Run tests
34-
run: pytest
36+
run: uv run pytest
3537

3638
automerge-dependabot:
3739
runs-on: ubuntu-latest
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test release upload
1+
name: Test release on PyPI
22

33
on:
44
workflow_dispatch:
@@ -13,20 +13,15 @@ jobs:
1313
- name: Checkout code
1414
uses: actions/checkout@v4
1515

16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v5
18+
1619
- name: Setup Python
1720
uses: actions/setup-python@v5
1821

19-
- name: Install Poetry
20-
run: |
21-
curl -sSL https://install.python-poetry.org | python3 -
22-
echo "${HOME}/.poetry/bin" >> $GITHUB_PATH
23-
24-
- name: Install dependencies
25-
run: |
26-
poetry install
27-
28-
- name: Setup and Publish to Test PyPi
22+
- name: Publish to Test PyPi
23+
env:
24+
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
2925
run: |
30-
poetry config repositories.testpypi https://test.pypi.org/legacy/
31-
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }}
32-
poetry publish --build --repository testpypi --dry-run
26+
uv build
27+
uv publish --index testpypi

README.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@
2525
---
2626

2727
<!--ts-->
28-
* [Demo](#Demo)
29-
* [Installation](#Installation)
30-
* [Dependencies](#dependencies)
31-
* [Run with pipx](#run-with-pipx)
32-
* [Installation from pip](#installation-from-pip)
33-
* [Installation from AUR](#installation-from-aur)
34-
* [Usage](#Usage)
35-
* [Tips](#Tips)
36-
* [Contributing](#Contributing)
28+
29+
* [Demo](#Demo)
30+
* [Installation](#Installation)
31+
* [Dependencies](#dependencies)
32+
* [Run with pipx](#run-with-pipx)
33+
* [Installation from pip](#installation-from-pip)
34+
* [Installation from AUR](#installation-from-aur)
35+
* [Usage](#Usage)
36+
* [Tips](#Tips)
37+
* [Contributing](#Contributing)
38+
3739
<!--te-->
3840

3941
---
@@ -45,54 +47,51 @@ RecoverPy is a powerful tool that leverages your system capabilities to recover
4547
Unlike others, you can not only recover deleted files but also **overwritten** data.
4648

4749
Every block of your partition will be scanned. You can even find a string in binary files.
50+
4851
## Demo
4952

5053
<p align="center">
5154
<img src="docs/assets/demo.gif">
5255
</p>
5356

54-
## Installation
57+
## Setup
5558

5659
:penguin: RecoverPy is currently only available on Linux systems.
5760
:red_circle: **You must be root or use sudo**.
5861

5962
### Dependencies
6063

61-
**Mandatory:** To list and search through your partitions, recoverpy uses `grep`, `dd`, and `lsblk` commands. Although, if you're running a major Linux distrucition these tools should already be installed.
64+
**Mandatory:** To list and search through your partitions, recoverpy uses `grep`, `dd`, and `lsblk` commands. Although,
65+
if you're running a major Linux distrucition these tools should already be installed.
6266

6367
**Optional:** To display real time grep progress, you can install `progress`.
6468

6569
To install all dependencies:
70+
6671
- Debian-like: `apt install grep coreutils util-linux progress`
6772
- Arch: `pacman -S grep coreutils util-linux progress`
6873
- Fedora: `dnf install grep coreutils util-linux progress`
6974

75+
## Usage
7076

71-
### Run with pipx
77+
### Run with uvx
7278

73-
You can **directly run recoverpy with pipx in an isolated environment** without installing it.
74-
To install pipx, follow the [official documentation](https://pipxproject.github.io/pipx/installation/).
75-
To run recoverpy with pipx, simply run:
79+
`sudo uvx recoverpy`
80+
81+
### Run with pipx
7682

7783
`sudo pipx run recoverpy`
7884

79-
#### Installation from pip
85+
### Installation from pip
8086

8187
`python3 -m pip install recoverpy`
8288

83-
#### Installation from AUR
84-
85-
`yay -S python-recoverpy`
86-
87-
## Usage
88-
89-
```bash
90-
python3 -m recoverpy
91-
```
89+
then run `sudo python3 -m recoverpy`
9290

9391
---
9492

95-
- **Select the system partition** in which your file was. If you are out of luck, you can alternatively search in your home partition, maybe your IDE, text editor, etc. made a backup at some point.
93+
- **Select the system partition** in which your file was. If you are out of luck, you can alternatively search in your
94+
home partition, maybe your IDE, text editor, etc. made a backup at some point.
9695

9796
- **Type a text string to search**. See tips below for better results.
9897

@@ -102,12 +101,14 @@ python3 -m recoverpy
102101

103102
- Once you have found your precious, **select `Open`**.
104103

105-
- You can now either save this block individually or explore neighboring blocks for the remaining parts of the file. You could then save it all in one file.
104+
- You can now either save this block individually or explore neighboring blocks for the remaining parts of the file. You
105+
could then save it all in one file.
106106

107107
## Tips
108108

109109
- Always do backups! Yes, maybe too late...
110-
- **Unmount your partition before you do anything!** Although you can search with your partition still mounted, it is highly recommended to unmount your partition to avoid any alteration to your file.
110+
- **Unmount your partition before you do anything!** Although you can search with your partition still mounted, it is
111+
highly recommended to unmount your partition to avoid any alteration to your file.
111112

112113
Regarding the searched string:
113114

@@ -117,7 +118,8 @@ Regarding the searched string:
117118

118119
When you have found your file:
119120

120-
- You might see multiple results. Your system often use different partion blocks to save successive versions of a file. Make sure you've found the last version.
121+
- You might see multiple results. Your system often use different partion blocks to save successive versions of a file.
122+
Make sure you've found the last version.
121123
- Try exploring neighboring blocks to be sure to save your whole file.
122124

123125
## Contributing

0 commit comments

Comments
 (0)