Skip to content

Commit

Permalink
Downgrade to Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidPal committed Sep 3, 2023
1 parent a7a8877 commit 160a27c
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 244 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
jobs:
build_and_test:
docker:
- image: python:3.10-bullseye
- image: python:3.8-bullseye

steps:
- checkout
Expand All @@ -20,7 +20,7 @@ jobs:
- run:
name: Install poetry
command: |
pip --verbose install poetry==1.3.2
pip --verbose install poetry==1.6.1
- run:
name: Install dependencies
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build, lint and test
run-name: Build, lint and test triggered by ${{ github.actor }}

on:
pull_request:
push:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: Print information
run: |
echo "The job was automatically triggered by a ${{ github.event_name }} event."
echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!"
echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3

- name: Print more information
run: |
echo "The ${{ github.repository }} repository has been cloned to the runner."
echo "The workflow is now ready to test your code on the runner."
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Print Python version
run: |
python --version
- name: Install dependencies
run: |
pip install --upgrade pip
pip --verbose install poetry==1.6.1
poetry config virtualenvs.create false
make install-dependencies
- name: Lint and test code
run: |
make clean whitespace-format-check isort-check black-check pydocstyle flake8 pylint mypy test coverage
- run: echo "This job's status is ${{ job.status }}."
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: whitespace-format-check whitespace-format black-check pydocstyle black-format pylint flake8 isort-check isort-format mypy test coverage clean install-python create-environment delete-environment install-dependencies build-package

PYTHON_ENVIRONMENT = "bibliography"
PYTHON_VERSION = "3.10.7"
PYTHON_VERSION = "3.8.5"
SOURCE_FILES = *.py

whitespace-format-check:
Expand Down
10 changes: 6 additions & 4 deletions bibliography.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import dataclasses
import re
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple

# Dictionary mapping lower-case type of bibliographic entry to its proper spelling.
ENTRY_TYPES = {
Expand Down Expand Up @@ -84,7 +86,7 @@ def capitalize(text):
return output


def find_matching_closing_brace(text: str) -> tuple[str, str]:
def find_matching_closing_brace(text: str) -> Tuple[str, str]:
"""Finds closing brace in a string that matches '{' + string."""
nesting = 1
end = 0
Expand Down Expand Up @@ -257,7 +259,7 @@ def priority(self):
return 0


def parse_entries(text: str) -> list[Entry]:
def parse_entries(text: str) -> List[Entry]:
"""Parses a list of bibliographic entries from a string."""
entries = []
while True:
Expand All @@ -269,7 +271,7 @@ def parse_entries(text: str) -> list[Entry]:
return entries


def read_file(file_name: str) -> tuple[list[str], str]:
def read_file(file_name: str) -> Tuple[List[str], str]:
"""Reads content of a bibliography file."""
comments = []
lines = []
Expand All @@ -283,7 +285,7 @@ def read_file(file_name: str) -> tuple[list[str], str]:
return comments, text


def write_file(file_name: str, comments: list[str], entries: list[Entry]) -> None:
def write_file(file_name: str, comments: List[str], entries: List[Entry]) -> None:
"""Writes text into a file."""
with open(file_name, "w", encoding="utf-8") as file:
if comments:
Expand Down
Loading

0 comments on commit 160a27c

Please sign in to comment.