Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4

Expand All @@ -28,6 +28,7 @@ jobs:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_ARCHS_LINUX: "auto64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_SKIP: "pp* *-win32 *i686 *musllinux*"
CIBW_PRERELEASE_PYTHONS: "0"
run: |
Expand Down Expand Up @@ -66,6 +67,10 @@ jobs:
echo "Found Windows wheels."
echo "HAS_WINDOWS_WHEELS=true" >> $GITHUB_ENV
fi
if ls dist/*-macosx_*.whl 1> /dev/null 2>&1; then
echo "Found macOS wheels."
echo "HAS_MACOS_WHEELS=true" >> $GITHUB_ENV
fi

- name: List files in dist
run: ls -l dist
Expand All @@ -91,3 +96,10 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.ASYNCDB_PYPI_API_TOKEN }}
run: twine upload dist/*-win_*.whl

- name: Publish macOS wheels to Production PyPI
if: env.HAS_MACOS_WHEELS == 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.ASYNCDB_PYPI_API_TOKEN }}
run: twine upload dist/*-macosx_*.whl
6 changes: 6 additions & 0 deletions asyncdb/drivers/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ async def query(
collection_name: str,
query: Optional[dict] = None,
*args,
limit: Optional[int] = None,
**kwargs
) -> Iterable[Any]:
"""
Expand All @@ -513,6 +514,8 @@ async def query(
db = await self._select_database()
collection = db[collection_name]
cursor = collection.find(query or {}, *args, **kwargs)
if limit is not None:
cursor = cursor.limit(limit)
result = await cursor.to_list(length=None)
Comment thread
phenobarbital marked this conversation as resolved.
return await self._serializer(result, None)
except Exception as err:
Expand Down Expand Up @@ -557,6 +560,7 @@ async def fetch(
collection_name: str,
query: Optional[dict] = None,
*args,
limit: Optional[int] = None,
**kwargs
) -> Iterable[Any]:
"""
Expand Down Expand Up @@ -585,6 +589,8 @@ async def fetch(
db = await self._select_database()
collection = db[collection_name]
cursor = collection.find(query or {}, *args, **kwargs)
if limit:
cursor = cursor.limit(limit)
async for document in cursor:
result.append(document)
return (result, None)
Expand Down
2 changes: 1 addition & 1 deletion asyncdb/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__title__ = "asyncdb"
__description__ = "Library for Asynchronous data source connections \
Collection of asyncio drivers."
__version__ = "2.13.0"
__version__ = "2.13.1"
__copyright__ = "Copyright (c) 2020-2024 Jesus Lara"
__author__ = "Jesus Lara"
__author_email__ = "jesuslarag@gmail.com"
Expand Down