Skip to content

Commit c2f9772

Browse files
authored
Merge pull request #23 from newsdataapi/release/0.2.0
Release/0.2.0
2 parents db8fb64 + 3171747 commit c2f9772

32 files changed

Lines changed: 4918 additions & 1325 deletions

.github/workflows/ci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
# Cancel in-progress runs for the same branch when a new push arrives.
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
test:
19+
name: pytest (Python ${{ matrix.python-version }})
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v6
30+
with:
31+
enable-cache: true
32+
33+
- name: Install Python ${{ matrix.python-version }}
34+
run: uv python install ${{ matrix.python-version }}
35+
36+
- name: Sync dependencies
37+
run: uv sync --python ${{ matrix.python-version }}
38+
39+
- name: Run unit tests
40+
run: uv run --python ${{ matrix.python-version }} pytest
41+
42+
lint:
43+
name: ruff + mypy
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Install uv
49+
uses: astral-sh/setup-uv@v6
50+
with:
51+
enable-cache: true
52+
53+
- name: Sync dependencies
54+
run: uv sync
55+
56+
- name: Ruff
57+
run: uv run ruff check src/ tests/ examples/
58+
59+
- name: Mypy
60+
run: uv run mypy src/
61+
62+
integration:
63+
# Only run live API tests on the canonical repository, on push to main.
64+
# Forks won't have the secret and would fail otherwise.
65+
name: live API tests
66+
runs-on: ubuntu-latest
67+
needs: [test, lint]
68+
if: github.repository == 'bytesview/python-client' && github.event_name == 'push'
69+
steps:
70+
- uses: actions/checkout@v4
71+
72+
- name: Install uv
73+
uses: astral-sh/setup-uv@v6
74+
75+
- name: Sync dependencies
76+
run: uv sync
77+
78+
- name: Run integration tests
79+
env:
80+
PYTEST_TOKEN: ${{ secrets.PYTEST_NEWSDATA_API }}
81+
run: |
82+
if [ -z "${PYTEST_TOKEN}" ]; then
83+
echo "PYTEST_NEWSDATA_API secret not set; skipping integration tests."
84+
exit 0
85+
fi
86+
uv run pytest -m integration

.github/workflows/publish.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
name: Build distributions
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v6
19+
20+
- name: Sync dependencies
21+
run: uv sync
22+
23+
- name: Run unit tests
24+
run: uv run pytest
25+
26+
- name: Build sdist + wheel
27+
run: uv build
28+
29+
- name: Upload distributions
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: dist
33+
path: dist/
34+
35+
publish:
36+
name: Publish to PyPI
37+
runs-on: ubuntu-latest
38+
needs: build
39+
# OIDC trusted publishing — no API token required.
40+
# One-time setup at:
41+
# https://pypi.org/manage/project/newsdataapi/settings/publishing/
42+
# Workflow filename = "publish.yml", environment = "pypi".
43+
permissions:
44+
id-token: write
45+
environment:
46+
name: pypi
47+
url: https://pypi.org/p/newsdataapi
48+
steps:
49+
- name: Download distributions
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: dist
53+
path: dist/
54+
55+
- name: Publish to PyPI
56+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/python-publish.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.gitignore

Lines changed: 15 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,26 @@
1-
# Created by https://www.toptal.com/developers/gitignore/api/python
2-
# Edit at https://www.toptal.com/developers/gitignore?templates=python
3-
4-
### Python ###
5-
# Byte-compiled / optimized / DLL files
6-
project_env
7-
my_test.py
8-
.vscode/
1+
# Python bytecode
92
__pycache__/
10-
*.py[cod]
11-
*$py.class
123

13-
# C extensions
14-
*.so
4+
# Virtual env (uv)
5+
.venv/
156

16-
# Distribution / packaging
17-
.Python
18-
build/
19-
develop-eggs/
7+
# Build artifacts (uv build / hatchling)
208
dist/
21-
downloads/
22-
eggs/
23-
.eggs/
24-
lib/
25-
lib64/
26-
parts/
27-
sdist/
28-
var/
29-
wheels/
30-
pip-wheel-metadata/
31-
share/python-wheels/
9+
build/
3210
*.egg-info/
33-
.installed.cfg
34-
*.egg
35-
MANIFEST
3611

37-
# PyInstaller
38-
# Usually these files are written by a python script from a template
39-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
40-
*.manifest
41-
*.spec
42-
43-
# Installer logs
44-
pip-log.txt
45-
pip-delete-this-directory.txt
46-
47-
# Unit test / coverage reports
48-
htmlcov/
49-
.tox/
50-
.nox/
51-
.coverage
52-
.coverage.*
53-
.cache
54-
nosetests.xml
55-
coverage.xml
56-
*.cover
57-
*.py,cover
58-
.hypothesis/
12+
# Tool caches
5913
.pytest_cache/
60-
pytestdebug.log
61-
62-
# Translations
63-
*.mo
64-
*.pot
65-
66-
# Django stuff:
67-
*.log
68-
local_settings.py
69-
db.sqlite3
70-
db.sqlite3-journal
71-
72-
# Flask stuff:
73-
instance/
74-
.webassets-cache
75-
76-
# Scrapy stuff:
77-
.scrapy
78-
79-
# Sphinx documentation
80-
docs/_build/
81-
doc/_build/
82-
83-
# PyBuilder
84-
target/
85-
86-
# Jupyter Notebook
87-
.ipynb_checkpoints
88-
89-
# IPython
90-
profile_default/
91-
ipython_config.py
92-
93-
# pyenv
94-
.python-version
95-
96-
# pipenv
97-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
98-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
99-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
100-
# install all needed dependencies.
101-
#Pipfile.lock
102-
103-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
104-
__pypackages__/
105-
106-
# Celery stuff
107-
celerybeat-schedule
108-
celerybeat.pid
109-
110-
# SageMath parsed files
111-
*.sage.py
112-
113-
# Environments
114-
.env
115-
.venv
116-
env/
117-
venv/
118-
ENV/
119-
env.bak/
120-
venv.bak/
121-
pythonenv*
122-
123-
# Spyder project settings
124-
.spyderproject
125-
.spyproject
126-
127-
# Rope project settings
128-
.ropeproject
129-
130-
# mkdocs documentation
131-
/site
132-
133-
# mypy
13414
.mypy_cache/
135-
.dmypy.json
136-
dmypy.json
15+
.ruff_cache/
16+
.coverage
13717

138-
# Pyre type checker
139-
.pyre/
18+
# Project scratch
19+
temp.py
14020

141-
# pytype static type analyzer
142-
.pytype/
21+
# Claude Code
22+
CLAUDE.md
23+
.claude/
14324

144-
# profiling data
145-
.prof
25+
# IDE
26+
.vscode/

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) [year] [fullname]
3+
Copyright (c) 2023-2026 NewsData.io
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MANIFEST.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)