Skip to content

Commit

Permalink
Add dev dependencies, formatting fixes, requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
bltravis authored and btravisebsco committed Sep 4, 2024
1 parent 86dc841 commit 285f902
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ ignore =
B905,
S113
max-complexity = 16
max-line-length = 99
max-line-length = 120
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,tests, src/folio_data_import/report_blurbs.py
statistics = True
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
poetry install --with dev
- name: Run tests
run: |
poetry run pytest
poetry run pytest
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
run: |
poetry build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: check-ast
- id: check-added-large-files
- id: check-docstring-first
- id: requirements-txt-fixer
- repo: local
hooks:
- id: black
name: black
language: system
entry: black
types: [python]
- id: flake8
name: flake8
language: system
entry: flake8
types: [python]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ inquirer = "^3.4.0"
tqdm = "^4.66.5"
tabulate = "^0.9.0"
aiofiles = "^24.1.0"
flake8-black = "^0.3.6"
flake8-bugbear = "^24.8.19"
flake8-bandit = "^4.1.1"
flake8-isort = "^6.1.1"
flake8-docstrings = "^1.7.0"


[tool.poetry.group.dev.dependencies]
pytest = "^8.3.2"
flake8 = "^7.1.1"
black = "^24.8.0"

[build-system]
requires = ["poetry-core"]
Expand Down
87 changes: 57 additions & 30 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,57 @@
aiofiles==24.1.0 ; python_version >= "3.10" and python_version < "4.0"
ansicon==1.89.0 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
anyio==4.4.0 ; python_version >= "3.10" and python_version < "4.0"
blessed==1.20.0 ; python_version >= "3.10" and python_version < "4.0"
certifi==2024.7.4 ; python_version >= "3.10" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
editor==1.6.6 ; python_version >= "3.10" and python_version < "4.0"
exceptiongroup==1.2.2 ; python_version >= "3.10" and python_version < "3.11"
folioclient==0.60.5 ; python_version >= "3.10" and python_version < "4.0"
h11==0.14.0 ; python_version >= "3.10" and python_version < "4.0"
httpcore==0.16.3 ; python_version >= "3.10" and python_version < "4.0"
httpx==0.23.3 ; python_version >= "3.10" and python_version < "4.0"
idna==3.7 ; python_version >= "3.10" and python_version < "4.0"
inquirer==3.4.0 ; python_version >= "3.10" and python_version < "4.0"
jinxed==1.3.0 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
py-openapi-schema-to-json-schema==0.0.3 ; python_version >= "3.10" and python_version < "4.0"
pyhumps==3.8.0 ; python_version >= "3.10" and python_version < "4.0"
pymarc==5.2.2 ; python_version >= "3.10" and python_version < "4.0"
python-dateutil==2.9.0.post0 ; python_version >= "3.10" and python_version < "4.0"
pyyaml==6.0.2 ; python_version >= "3.10" and python_version < "4.0"
readchar==4.2.0 ; python_version >= "3.10" and python_version < "4.0"
rfc3986[idna2008]==1.5.0 ; python_version >= "3.10" and python_version < "4.0"
runs==1.2.2 ; python_version >= "3.10" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
sniffio==1.3.1 ; python_version >= "3.10" and python_version < "4.0"
tabulate==0.9.0 ; python_version >= "3.10" and python_version < "4.0"
tqdm==4.66.5 ; python_version >= "3.10" and python_version < "4.0"
typing-extensions==4.12.2 ; python_version >= "3.10" and python_version < "3.11"
wcwidth==0.2.13 ; python_version >= "3.10" and python_version < "4.0"
xmod==1.8.1 ; python_version >= "3.10" and python_version < "4.0"
aiofiles==24.1.0 ; python_version >= "3.9" and python_version < "4.0"
ansicon==1.89.0 ; python_version >= "3.9" and python_version < "4.0" and platform_system == "Windows"
anyio==4.4.0 ; python_version >= "3.9" and python_version < "4.0"
attrs==24.2.0 ; python_version >= "3.9" and python_version < "4.0"
bandit==1.7.9 ; python_version >= "3.9" and python_version < "4.0"
black==24.8.0 ; python_version >= "3.9" and python_version < "4.0"
blessed==1.20.0 ; python_version >= "3.9" and python_version < "4.0"
certifi==2024.7.4 ; python_version >= "3.9" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.9" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0" and platform_system == "Windows"
editor==1.6.6 ; python_version >= "3.9" and python_version < "4.0"
exceptiongroup==1.2.2 ; python_version >= "3.9" and python_version < "3.11"
flake8==7.1.1 ; python_version >= "3.9" and python_version < "4.0"
flake8-bandit==4.1.1 ; python_version >= "3.9" and python_version < "4.0"
flake8-black==0.3.6 ; python_version >= "3.9" and python_version < "4.0"
flake8-bugbear==24.8.19 ; python_version >= "3.9" and python_version < "4.0"
flake8-docstrings==1.7.0 ; python_version >= "3.9" and python_version < "4.0"
flake8-isort==6.1.1 ; python_version >= "3.9" and python_version < "4.0"
folioclient==0.60.5 ; python_version >= "3.9" and python_version < "4.0"
h11==0.14.0 ; python_version >= "3.9" and python_version < "4.0"
httpcore==0.16.3 ; python_version >= "3.9" and python_version < "4.0"
httpx==0.23.3 ; python_version >= "3.9" and python_version < "4.0"
idna==3.7 ; python_version >= "3.9" and python_version < "4.0"
inquirer==3.4.0 ; python_version >= "3.9" and python_version < "4.0"
isort==5.13.2 ; python_version >= "3.9" and python_version < "4.0"
jinxed==1.3.0 ; python_version >= "3.9" and python_version < "4.0" and platform_system == "Windows"
markdown-it-py==3.0.0 ; python_version >= "3.9" and python_version < "4.0"
mccabe==0.7.0 ; python_version >= "3.9" and python_version < "4.0"
mdurl==0.1.2 ; python_version >= "3.9" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.9" and python_version < "4.0"
packaging==24.1 ; python_version >= "3.9" and python_version < "4.0"
pathspec==0.12.1 ; python_version >= "3.9" and python_version < "4.0"
pbr==6.1.0 ; python_version >= "3.9" and python_version < "4.0"
platformdirs==4.2.2 ; python_version >= "3.9" and python_version < "4.0"
py-openapi-schema-to-json-schema==0.0.3 ; python_version >= "3.9" and python_version < "4.0"
pycodestyle==2.12.1 ; python_version >= "3.9" and python_version < "4.0"
pydocstyle==6.3.0 ; python_version >= "3.9" and python_version < "4.0"
pyflakes==3.2.0 ; python_version >= "3.9" and python_version < "4.0"
pygments==2.18.0 ; python_version >= "3.9" and python_version < "4.0"
pyhumps==3.8.0 ; python_version >= "3.9" and python_version < "4.0"
pymarc==5.2.2 ; python_version >= "3.9" and python_version < "4.0"
python-dateutil==2.9.0.post0 ; python_version >= "3.9" and python_version < "4.0"
pyyaml==6.0.2 ; python_version >= "3.9" and python_version < "4.0"
readchar==4.2.0 ; python_version >= "3.9" and python_version < "4.0"
rfc3986[idna2008]==1.5.0 ; python_version >= "3.9" and python_version < "4.0"
rich==13.8.0 ; python_version >= "3.9" and python_version < "4.0"
runs==1.2.2 ; python_version >= "3.9" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.9" and python_version < "4.0"
sniffio==1.3.1 ; python_version >= "3.9" and python_version < "4.0"
snowballstemmer==2.2.0 ; python_version >= "3.9" and python_version < "4.0"
stevedore==5.3.0 ; python_version >= "3.9" and python_version < "4.0"
tabulate==0.9.0 ; python_version >= "3.9" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.9" and python_version < "3.11"
tqdm==4.66.5 ; python_version >= "3.9" and python_version < "4.0"
typing-extensions==4.12.2 ; python_version >= "3.9" and python_version < "3.11"
wcwidth==0.2.13 ; python_version >= "3.9" and python_version < "4.0"
xmod==1.8.1 ; python_version >= "3.9" and python_version < "4.0"
4 changes: 2 additions & 2 deletions src/folio_data_import/UserImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ async def map_departments(self, user_obj, line_number) -> None:
mapped_departments.append(self.department_map[department])
except KeyError:
print(
f'Row {line_number}: Department "{department}" not found, '
f'Row {line_number}: Department "{department}" not found, ' # noqa: B907
f"excluding department from user"
)
await self.logfile.write(
f'Row {line_number}: Department "{department}" not found, '
f'Row {line_number}: Department "{department}" not found, ' # noqa: B907
f"excluding department from user\n"
)
user_obj["departments"] = mapped_departments
Expand Down
10 changes: 8 additions & 2 deletions src/folio_data_import/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ async def main():
parser.add_argument(
"--consolidate",
action="store_true",
help="Consolidate records into a single job. Default is to create a new job for each MARC file.",
help=(
"Consolidate records into a single job. "
"Default is to create a new job for each MARC file."
),
)
parser.add_argument(
"--no-progress",
Expand Down Expand Up @@ -96,7 +99,10 @@ async def main():
print("Error importing files: " + str(e))
raise
elif args.record_type.lower() == "users":
print("User import not yet implemented. Run UserImport.py directly or use folio-user-import CLI.")
print(
"User import not yet implemented. Run UserImport.py directly "
"or use folio-user-import CLI."
)
else:
print("Record type not supported. Supported types are: MARC21")

Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

PROJECT_PATH = os.getcwd()
SOURCE_PATH = os.path.join(PROJECT_PATH, "src")
sys.path.append(SOURCE_PATH)
sys.path.append(SOURCE_PATH)
4 changes: 3 additions & 1 deletion tests/test_marc_data_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
from folioclient import FolioClient
import pytest


@pytest.fixture
def folio_client():
folio_client = Mock(spec=FolioClient)
return folio_client


@pytest.fixture
def marc_import_job(folio_client):
marc_import_job = Mock(spec=MARCImportJob)
return marc_import_job
return marc_import_job

0 comments on commit 285f902

Please sign in to comment.