Skip to content

Commit

Permalink
feat: second version of package
Browse files Browse the repository at this point in the history
  • Loading branch information
A.Shpak committed Nov 14, 2024
1 parent 0517dc8 commit 8a3c6a0
Show file tree
Hide file tree
Showing 17 changed files with 338 additions and 780 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/lint.yml

This file was deleted.

41 changes: 17 additions & 24 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
---
name: PyPI upload

on:
push:
tags:
- '*'
release:
types: [created]

jobs:
build:
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
-
name: Set up Python 3.9
uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: "3.9"
-
name: Checkout
uses: actions/checkout@v2
-
name: dependencies
run: |
python -m pip install poetry==1.1.7
-
name: build
run: poetry build
-
name: publish
python-version: "3.10"
- uses: actions/checkout@v3
- name: Extract branch name
shell: bash
run: |
poetry config http-basic.pypi ${{ secrets.PYPI_LOGIN }} ${{ secrets.PYPI_PASS }}
poetry publish
echo "##[set-output name=ver;]$(echo ${GITHUB_REF#refs/*/})"
id: extract_name_and_version
- run: sed -i 's/0.1.0/'"${{ steps.extract_name_and_version.outputs.ver }}"'/' pyproject.toml
- run: head -n 10 pyproject.toml
- run: sed -i 's/0.1.0/'"${{ steps.extract_name_and_version.outputs.ver }}"'/' curlify3/__init__.py
- run: python -m pip install poetry~=1.8.0
- run: poetry build
- run: poetry config http-basic.pypi __token__ ${{ secrets.PYPI_PASS }}
- run: poetry publish
34 changes: 0 additions & 34 deletions .github/workflows/tests.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
SOURCE_DIR := "winregistry"
SOURCE_DIR := "winregistry.py"

tests: pytest
fmt: black isort

isort:
poetry run isort {{ SOURCE_DIR }} --diff
poetry run isort {{ SOURCE_DIR }}
# poetry run isort test_curlify3.py --diff

black:
poetry run isort {{ SOURCE_DIR }}
poetry run black {{ SOURCE_DIR }}
# poetry run isort test_curlify3.py

pytest:
Expand Down
41 changes: 16 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![PyPI](https://img.shields.io/pypi/v/winregistry.svg)](https://pypi.python.org/pypi/winregistry)
[![PyPI](https://img.shields.io/pypi/dm/winregistry.svg)](https://pypi.python.org/pypi/winregistry)

Minimalist Python library aimed at working with Windows Registry.
Python library aimed at working with Windows Registry

## Installation

Expand All @@ -14,31 +14,22 @@ pip install winregistry
## Usage

```py
from winregistry import WinRegistry

TEST_REG_PATH = r"HKLM\SOFTWARE\_REMOVE_ME_"
import winreg
from winregistry import connect_registry

_SUB_KEY_NAME = "SOFTWARE\_REMOVE_ME_"

if __name__ == "__main__":
with WinRegistry() as client:
client.create_key(TEST_REG_PATH)
client.write_entry(TEST_REG_PATH, "remove_me", "test")
test_entry = client.read_entry(TEST_REG_PATH, "remove_me")
assert test_entry.value == "test"
client.delete_entry(TEST_REG_PATH, "remove_me")
```

Usage with ``Robot Testing Framework`` Library
----------------------------------------------

```
*** Settings ***
Library winregistry.robot
*** Test Cases ***
Valid Login
${path} = Set Variable HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run
Write Registry Entry ${path} Notepad notepad.exe
${autorun} = Read Registry Key ${path}
Delete Registry Entry ${path} Notepad
with connect_registry(winreg.HKEY_LOCAL_MACHINE) as hklm:
hklm.create_key(_SUB_KEY_NAME)
with hklm.open_key(_SUB_KEY_NAME) as subkey:
subkey.set_value("remove_me", winreg.REG_SZ, "Don't forget remove me!")
value = subkey.read_value("remove_me")
print(f"{value=}: {value.data}")
value.data = "remove me again!"
print(f"{value=}: {value.data}")
print(f"{list(subkey.values)=}")
subkey.delete_value("remove_me")
print(f"{list(subkey.values)=}")
hklm.delete_key(_SUB_KEY_NAME)
```
Loading

0 comments on commit 8a3c6a0

Please sign in to comment.