Skip to content

Commit

Permalink
#314 - Switch to poetry
Browse files Browse the repository at this point in the history
- Use ruff
- Address linter issues in json.py
  • Loading branch information
reckart committed May 6, 2024
1 parent 3bf380c commit 804540d
Show file tree
Hide file tree
Showing 6 changed files with 461 additions and 366 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v4
Expand Down
13 changes: 5 additions & 8 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ build:
os: ubuntu-22.04
tools:
python: "3.11"

jobs:
post_create_environment:
- python -m pip install poetry
post_install:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --only main,docs
sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- doc
11 changes: 3 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,17 @@ coverage:

# Static analysis/linting
format:
black cassis/
black tests/
isort --profile black $(PYTHON_FILES) --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=120
poetry run ruff format $(PYTHON_FILES)

lint:
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 --select=E9,F63,F7,F82 --show-source $(PYTHON_FILES)
poetry run ruff check --select=E9,F63,F7,F82 --output-format=full $(PYTHON_FILES)
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
poetry run flake8 --exit-zero $(PYTHON_FILES)
poetry run ruff check --exit-zero $(PYTHON_FILES)

# Docs
docs:
poetry run mkdocs serve

html:
cd docs && make html

# Building and publishing
Expand Down
11 changes: 9 additions & 2 deletions cassis/json.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import base64
import json
import math
from collections import OrderedDict
from collections import OrderedDict, defaultdict
from io import TextIOBase, TextIOWrapper
from math import isnan
from typing import Union, IO, Optional, Dict, List
from toposort import toposort_flatten

from cassis.cas import NAME_DEFAULT_SOFA, Cas, IdGenerator, Sofa, View
from cassis.typesystem import *
from cassis.typesystem import TYPE_NAME_ANNOTATION, TypeSystem, is_predefined, merge_typesystems, TYPE_NAME_SOFA, \
FEATURE_BASE_NAME_SOFAARRAY, array_type_name_for_type, FEATURE_BASE_NAME_SOFASTRING, FEATURE_BASE_NAME_SOFAID, \
FEATURE_BASE_NAME_SOFAMIME, FEATURE_BASE_NAME_SOFANUM, FEATURE_BASE_NAME_SOFAURI, TYPE_NAME_FS_ARRAY, \
TYPE_NAME_BYTE_ARRAY, TYPE_NAME_FLOAT_ARRAY, TYPE_NAME_DOUBLE_ARRAY, TypeSystemMode, TYPE_NAME_DOCUMENT_ANNOTATION, \
Type, Feature, TYPE_NAME_TOP, is_primitive_array, TYPE_NAME_FLOAT, TYPE_NAME_DOUBLE, \
element_type_name_for_array_type, is_primitive, is_array

RESERVED_FIELD_PREFIX = "%"
REF_FEATURE_PREFIX = "@"
Expand Down
Loading

0 comments on commit 804540d

Please sign in to comment.