Skip to content

Commit

Permalink
Merge pull request #57 from sbliven/typing-fixes
Browse files Browse the repository at this point in the history
Check typing with mypy
  • Loading branch information
dylanmcreynolds authored Dec 12, 2023
2 parents fdf3e34 + 73458bf commit 926f744
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 121 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ jobs:
run: |
set -vxeuo pipefail
python -m flake8
- name: Lint with black
shell: bash -l {0}
run: black --check .

- name: Lint with isort
shell: bash -l {0}
run: isort --check .

- name: Lint with mypy
shell: bash -l {0}
run: mypy --check pyscicat

- name: Test with pytest
shell: bash -l {0}
Expand Down
6 changes: 3 additions & 3 deletions examples/ingest_dataset.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from pathlib import Path

from pyscicat.client import encode_thumbnail, ScicatClient
from pyscicat.client import ScicatClient, encode_thumbnail
from pyscicat.model import Attachment, Datablock, DataFile, Dataset, Ownable

# Create a client object. The account used should have the ingestor role in SciCat
Expand Down Expand Up @@ -31,7 +31,7 @@
sourceFolder="/foo/bar",
scientificMetadata={"a": "field"},
sampleId="gargleblaster",
**ownable.dict()
**ownable.dict(),
)
dataset_id = scicat.upload_raw_dataset(dataset)

Expand All @@ -47,6 +47,6 @@
datasetId=dataset_id,
thumbnail=encode_thumbnail(thumb_path),
caption="scattering image",
**ownable.dict()
**ownable.dict(),
)
scicat.upload_attachment(attachment)
4 changes: 2 additions & 2 deletions examples/ingestion_simulation_dataset_ess.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

# libraries
import json

import pyscicat.client as pyScClient
import pyscicat.model as pyScModel


# scicat configuration file
# includes scicat instance URL
# scicat user and password
Expand Down Expand Up @@ -68,7 +68,7 @@
pyScModel.DataFile(**file)
for file in dataset_information["orig_datablock"]["dataFileList"]
],
**ownable.dict()
**ownable.dict(),
)

# create origDatablock associated with dataset in SciCat
Expand Down
30 changes: 12 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ dev = [
"twine",
"black",
"requests_mock",
"isort",
"mypy",
"types-requests",
]
docs = [
"ipython",
Expand All @@ -56,25 +59,16 @@ docs = [

[tool.black]
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
# The following are specific to Black, you probably don't want those.
| blib2to3
| tests/data
)/
'''
extend_exclude = 'pyscicat/_version.py'

[tool.isort]
profile = "black"
skip_glob = ["__pycache__", "pyscicat/_version.py"]

[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "pyscicat/_version.py"
build.hooks.vcs.version-file = "pyscicat/_version.py"

[tool.mypy]
# TODO Add type annotations and include this file
exclude = ["pyscicat/_version.py", "pyscicat/hdf5/scientific_metadata.py"]
Loading

0 comments on commit 926f744

Please sign in to comment.