-
Notifications
You must be signed in to change notification settings - Fork 0
[Sis integration] params for import/export #47
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
94bae48
[SIS-Import] add params and fix overloads
EssKayz d6314ee
[sis-integration] Tests for integration
EssKayz 2a48b52
[SIS-integration] add overload for calling without as_generator
EssKayz 6f409d8
[sis-integration] Refactor tests
EssKayz e9ac72d
[workflow] Add gh workflow for tests
EssKayz 2740b41
Remove redundant cross-referencing from requirements files
EssKayz 635ebb0
[feat] python-3.11 support
EssKayz da4038b
[tests] dockerized tests for python 3.11 ... 3.13
EssKayz 3805e35
[sis-integration] flip param merge to not allow since/limit overriding
EssKayz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Run pytest on supported python versions | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.11", "3.12", "3.13"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v3 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| - name: Test with pytest | ||
| run: | | ||
| pytest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| ARG PYTHON_VERSION=3.11 | ||
|
|
||
|
|
||
| FROM python:$PYTHON_VERSION | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY pyproject.toml . | ||
| COPY README.md . | ||
| COPY requirements* . | ||
|
|
||
| RUN pip install -r requirements.txt | ||
| RUN pip install . | ||
|
|
||
|
|
||
| ENTRYPOINT ["python", "-m", "pytest"] | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| x-tests-common: &tests-common | ||
| volumes: | ||
| - ./tests:/app/tests | ||
| - ./funidata_utils:/app/funidata_utils | ||
|
|
||
|
|
||
| services: | ||
| pytest_311: | ||
| build: | ||
| context: . | ||
| args: | ||
| - PYTHON_VERSION=3.11 | ||
| <<: *tests-common | ||
|
|
||
| pytest_312: | ||
| build: | ||
| context: . | ||
| args: | ||
| - PYTHON_VERSION=3.12 | ||
| <<: *tests-common | ||
|
|
||
| pytest_313: | ||
| build: | ||
| context: . | ||
| args: | ||
| - PYTHON_VERSION=3.13 | ||
| <<: *tests-common |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from collections import defaultdict | ||
| from functools import reduce | ||
| from typing import Callable, Any | ||
|
|
||
|
|
||
| def group_by[T]( | ||
| seq: list[T], | ||
| key: Callable | ||
| ) -> dict[Any, list[T]]: | ||
| return reduce(lambda grp, val: grp[key(val)].append(val) or grp, seq, defaultdict(list)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| from collections import defaultdict | ||
| from functools import reduce | ||
| from typing import Callable, Any, TypeVar | ||
|
|
||
|
|
||
| T = TypeVar('T') | ||
|
|
||
|
|
||
| def group_by( | ||
| seq: list[T], | ||
| key: Callable | ||
| ) -> dict[Any, list[T]]: | ||
| return reduce(lambda grp, val: grp[key(val)].append(val) or grp, seq, defaultdict(list)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,7 @@ | ||
| from typing import Iterable | ||
| import sys | ||
|
|
||
|
|
||
| def serialize_as_list[typevar](v: set[typevar] | list[typevar] | None) -> list[typevar] | None: | ||
| if v is None: | ||
| return None | ||
|
|
||
| try: | ||
| return list(set(v)) | ||
| except Exception as e: | ||
| # If it can't be hashed to set, just return as list | ||
| return list(v) | ||
| if sys.version_info >= (3, 12): | ||
| from .compat.common_serializers_312 import serialize_as_list # noqa: F401 ("Unused import") | ||
| else: | ||
| from .compat.common_serializers_legacy import serialize_as_list # noqa: F401 ("Unused import") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Python > 3.12 implementations | ||
|
|
||
|
|
||
| def serialize_as_list[typevar](v: set[typevar] | list[typevar] | None) -> list[typevar] | None: | ||
| if v is None: | ||
| return None | ||
|
|
||
| try: | ||
| return list(set(v)) | ||
| except Exception as e: | ||
| # If it can't be hashed to set, just return as list | ||
| return list(v) | ||
15 changes: 15 additions & 0 deletions
15
funidata_utils/schemas/compat/common_serializers_legacy.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| from typing import TypeVar | ||
|
|
||
|
|
||
| T = TypeVar('T') | ||
|
|
||
|
|
||
| def serialize_as_list(v: set[T] | list[T] | None) -> list[T] | None: | ||
| if v is None: | ||
| return None | ||
|
|
||
| try: | ||
| return list(set(v)) | ||
| except Exception as e: | ||
| # If it can't be hashed to set, just return as list | ||
| return list(v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.