Skip to content

Commit

Permalink
Merge branch 'main' into fix-repo-id-type-for-user-streams
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon authored Jul 5, 2024
2 parents 5c23820 + f41b66d commit 33d894b
Show file tree
Hide file tree
Showing 9 changed files with 985 additions and 826 deletions.
33 changes: 33 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
day: monday
reviewers:
- "edgarrmondragon"
versioning-strategy: increase-if-necessary
groups:
development-dependencies:
dependency-type: development
runtime-dependencies:
dependency-type: production
update-types:
- "patch"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: monday
reviewers:
- "edgarrmondragon"
groups:
actions:
patterns:
- "*"
2 changes: 1 addition & 1 deletion .github/workflows/project_add.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/add-to-project@v0.5.0
- uses: actions/add-to-project@v1.0.2
with:
project-url: https://github.com/orgs/MeltanoLabs/projects/3
github-token: ${{ secrets.MELTYBOT_PROJECT_ADD_PAT }}
27 changes: 21 additions & 6 deletions .github/workflows/test_tap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@ name: Test tap-github
on:
# Run on all pull requests and on pushes to main.
pull_request:
paths:
- .github/workflows/test_tap.yml
- poetry.lock
- pyproject.toml
- 'tap_github/**'
push:
branches:
- main
paths:
- .github/workflows/test_tap.yml
- poetry.lock
- pyproject.toml
- 'tap_github/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -20,20 +30,25 @@ jobs:
ORG_LEVEL_TOKEN: ${{secrets.ORG_LEVEL_TOKEN}}
strategy:
matrix:
python-version: [3.11, "3.10", 3.9, 3.8, 3.7]
python-version:
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
# run the matrix jobs one after the other so they can benefit from caching
max-parallel: 1

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash

- name: Cache github API responses
uses: actions/cache@v3
uses: actions/cache@v4
with:
# must match the path in tests/__init__.py
path: '.cache/api_calls_tests_cache.sqlite'
Expand All @@ -43,19 +58,19 @@ jobs:
key: api-cache-v4-${{ steps.get-date.outputs.date }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
# Version of Poetry to use
version: 1.2.2
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key: venv-4-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
Expand Down
1,696 changes: 903 additions & 793 deletions poetry.lock

Large diffs are not rendered by default.

41 changes: 23 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Typing :: Typed",
]
Expand All @@ -24,27 +24,26 @@ classifiers = [
"Issue Tracker" = "https://github.com/MeltanoLabs/tap-github/issues"

[tool.poetry.dependencies]
PyJWT = "2.7.0"
python = "<3.12,>=3.7.2"
requests = "^2.31.0"
PyJWT = "2.8.0"
python = ">=3.8"
requests = "~=2.32.3"
# For local SDK dev:
# singer-sdk = {path = "../singer-sdk", develop = true}
# singer-sdk = "^0.30.0"
singer-sdk = { git = "https://github.com/meltano/sdk.git", rev = "c3a8f90ac4d79eb5c655740d0fd88f393af7f306" }
types-simplejson = "^3.19.0"
types-python-dateutil = "^2.8.6"
nested-lookup = "^0.2.25"
beautifulsoup4 = "^4.12.0"
singer-sdk = { version = "~=0.32.0", python = "<4" }
types-simplejson = "~=3.19.0"
types-python-dateutil = "~=2.9.0"
nested-lookup = "~=0.2.25"
beautifulsoup4 = "~=4.12.0"

[tool.poetry.dev-dependencies]
pytest = "^7.3.1"
mypy = "^1.3.0"
flake8 = "^5.0.4"
black = "^23.3.0"
types-beautifulsoup4 = "^4.12.0"
types-requests = "^2.30.0"
requests-cache = "^1.0.1"
isort = "^5.10.1"
pytest = ">=7.3.1"
mypy = ">=1.3.0"
flake8 = ">=5.0.4"
black = ">=23.3.0"
types-beautifulsoup4 = ">=4.12.0"
types-requests = ">=2.30.0"
requests-cache = ">=1.0.1"
isort = ">=5.10.1"

[[tool.mypy.overrides]]
module = ["backoff"]
Expand All @@ -65,3 +64,9 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts]
# CLI declaration
tap-github = 'tap_github.tap:cli'

[tool.pytest.ini_options]
markers = [
"repo_list: mark a test as using a list of repos in config",
"username_list: mark a test as using a list of usernames in config",
]
4 changes: 0 additions & 4 deletions pytest.ini

This file was deleted.

4 changes: 2 additions & 2 deletions tap_github/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def get_url_params(
since = self.get_starting_timestamp(context)
since_key = "since" if not self.use_fake_since_parameter else "fake_since"
if self.replication_key and since:
params[since_key] = since
params[since_key] = since.isoformat(sep="T")
# Leverage conditional requests to save API quotas
# https://github.community/t/how-does-if-modified-since-work/139627
self._http_headers["If-modified-since"] = email.utils.format_datetime(since)
Expand Down Expand Up @@ -401,7 +401,7 @@ def get_url_params(

since = self.get_starting_timestamp(context)
if self.replication_key and since:
params["since"] = str(since)
params["since"] = since.isoformat(sep="T")

return params

Expand Down
2 changes: 1 addition & 1 deletion tap_github/tests/test_tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_get_a_user_in_user_usernames_mode(
)
# these 2 are inequalities as number will keep changing :)
assert captured_out.count('{"type": "RECORD", "stream": "starred"') > 150
assert captured_out.count('{"type": "RECORD", "stream": "user_contributed_to"') > 50
assert captured_out.count('{"type": "RECORD", "stream": "user_contributed_to"') > 25
assert '{"username": "aaronsteers"' in captured_out
assert '{"username": "aaRONsTeeRS"' not in captured_out
assert '{"username": "EricBoucher"' not in captured_out
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
isolated_build = true
envlist = py36, py38, py39
envlist = py3{8,9,10,11,12}

[testenv]
whitelist_externals = poetry
Expand Down

0 comments on commit 33d894b

Please sign in to comment.