Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to python 3.10 #18

Merged
merged 2 commits into from
Feb 22, 2023
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
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- 'v*'
- "v*"

jobs:
create_release:
Expand Down Expand Up @@ -43,10 +43,10 @@ jobs:
artifact_name: crypt4gh-gui
os_suffix: macos-amd64
asset_name: crypt4gh-gui
python-version: [3.8]
python-version: ["3.10"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
docker pull cscfi/pyinstaller
docker run --rm -v "${PWD}:/builder" cscfi/pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
sudo chown -R $USER:$GROUP dist/
- name: Build artifact
- name: Build artifact
if: matrix.os != 'ubuntu-latest'
run: |
pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
Expand All @@ -86,7 +86,7 @@ jobs:
cd ./dist
zip --junk-paths ${{ matrix.asset_name }}-python${{ matrix.python-version }}-${{ matrix.os_suffix }}.zip ${{ matrix.artifact_name }}
- name: Upload Release Asset
id: upload-release-asset
id: upload-release-asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8]
python-version: ["3.10"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Black formatting check
run: tox -e black
- name: Flake8 syntax check
run: tox -e flake8
- name: Type hints check
run: tox -e mypy
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Black formatting check
run: tox -e black
- name: Flake8 syntax check
run: tox -e flake8
- name: Type hints check
run: tox -e mypy
32 changes: 26 additions & 6 deletions crypt4gh_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def __init__(self, window: tk.Tk) -> None:
self.my_key_field.grid(column=0, row=1, sticky=tk.W)
self.my_key_field.config(state="disabled")
# Auto-load generated private key if such exists: username_crypt4gh.key (can be changed in UI)
default_private_key_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), f"{getpass.getuser()}_crypt4gh.key")
default_private_key_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
f"{getpass.getuser()}_crypt4gh.key",
)
if os.path.isfile(default_private_key_path):
self.my_key_value.set(default_private_key_path)

Expand Down Expand Up @@ -103,7 +106,12 @@ def __init__(self, window: tk.Tk) -> None:
)
self.load_their_key_button.grid(column=1, row=2, sticky=tk.E, columnspan=2)

self.select_file_button = tk.Button(window, text="Select File", width=OS_CONFIG["config_button_width"], command=partial(self.open_file, "file"))
self.select_file_button = tk.Button(
window,
text="Select File",
width=OS_CONFIG["config_button_width"],
command=partial(self.open_file, "file"),
)
self.select_file_button.grid(column=1, row=3, sticky=tk.E, columnspan=2)

self.encrypt_button = tk.Button(
Expand Down Expand Up @@ -156,7 +164,11 @@ def password_prompt(self, action: Optional[str]) -> None:
# This if-clause is for preventing error messages
if password1 is None:
return
password2 = askstring("Private Key Passphrase", "Re-type Private Key Passphrase to Confirm", show="*")
password2 = askstring(
"Private Key Passphrase",
"Re-type Private Key Passphrase to Confirm",
show="*",
)
if password2 is None:
return
if password1 != password2:
Expand Down Expand Up @@ -191,7 +203,11 @@ def password_prompt(self, action: Optional[str]) -> None:
if password is None:
return
while len(password) == 0:
password = askstring("Private Key Passphrase", "Passphrase can't be empty", show="*")
password = askstring(
"Private Key Passphrase",
"Passphrase can't be empty",
show="*",
)
# This if-clause is for preventing error messages
if password is None:
return
Expand All @@ -207,7 +223,7 @@ def password_prompt(self, action: Optional[str]) -> None:
if private_key is not None:
their_key = get_public_key(self.their_key_value.get())
print("Encrypting...")
encrypted_file: Union[BufferedWriter, BufferedReader]
encrypted_file_wb: Union[BufferedWriter, BufferedReader]
original_file = open(self.file_value.get(), "rb")
encrypted_file_wb = open(f"{self.file_value.get()}.c4gh", "wb")
encrypt([(0, private_key, their_key)], original_file, encrypted_file_wb)
Expand All @@ -230,7 +246,11 @@ def password_prompt(self, action: Optional[str]) -> None:
if password is None:
return
while len(password) == 0:
password = askstring("Private Key Passphrase", "Passphrase can't be empty", show="*")
password = askstring(
"Private Key Passphrase",
"Passphrase can't be empty",
show="*",
)
# This if-clause is for preventing error messages
if password is None:
return
Expand Down