Skip to content

Commit 083a842

Browse files
committed
Use pyproject
Also, switch from using from `pkg_resources.iter_entry_points` to `importlib.metadata`. Since is removed in Python 3.12. I had a report that this was causing a problem. I guess people are still using twarc, I suppose with keys that they pay for...
1 parent 7420be3 commit 083a842

19 files changed

Lines changed: 65 additions & 85 deletions

.github/workflows/main.yml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: [3.8]
16+
python-version: [3.12]
1717
steps:
1818

1919
- uses: actions/checkout@v2
@@ -25,10 +25,8 @@ jobs:
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727

28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install -r requirements.txt
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v6
3230

3331
- name: Test with pytest
3432
env:
@@ -38,27 +36,15 @@ jobs:
3836
ACCESS_TOKEN_SECRET: ${{ secrets.access_token_secret }}
3937
BEARER_TOKEN: ${{ secrets.bearer_token }}
4038
SKIP_ACADEMIC_PRODUCT_TRACK: true
41-
run: python setup.py test
39+
run: uv run pytest
4240

4341
- name: Ensure packages can be built
4442
run: |
45-
python -m pip install wheel
46-
python setup.py sdist bdist_wheel
43+
uv build
4744
4845
- name: Publish to PyPI
4946
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
5047
uses: pypa/gh-action-pypi-publish@release/v1
5148
with:
5249
user: __token__
5350
password: ${{ secrets.PYPI_API_TOKEN }}
54-
55-
- name: Slack Notification
56-
uses: rtCamp/action-slack-notify@v2
57-
env:
58-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
59-
SLACK_USERNAME: docnow-build
60-
SLACK_ICON_EMOJI: ":test-tube:"
61-
SLACK_COLOR: "${{ job.status == 'success' && 'good' || 'danger' }}"
62-
SLACK_MESSAGE: "Tests Results: ${{ job.status }}"
63-
64-

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ twarc.egg-info
1111
.vscode
1212
.env
1313
site
14+
uv.lock

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# twarc
22

3-
[![DOI](https://zenodo.org/badge/7605723.svg)](https://zenodo.org/badge/latestdoi/7605723) [![Build Status](https://github.com/docnow/twarc/workflows/tests/badge.svg)](https://github.com/DocNow/twarc/actions/workflows/main.yml) [![Standard](https://img.shields.io/endpoint?url=https%3A%2F%2Ftwbadges.glitch.me%2Fbadges%2Fstandard)](https://developer.twitter.com/en/docs/twitter-api) [![Premium](https://img.shields.io/endpoint?url=https%3A%2F%2Ftwbadges.glitch.me%2Fbadges%2Fpremium)](https://developer.twitter.com/) [![v2](https://img.shields.io/endpoint?url=https%3A%2F%2Ftwbadges.glitch.me%2Fbadges%2Fv2)](https://developer.twitter.com/en/docs/twitter-api)
3+
**Note: twarc is no longer actively supported after changes to Twitter's API quotas made it unusable.**
4+
5+
---
6+
7+
[![DOI](https://zenodo.org/badge/7605723.svg)](https://zenodo.org/badge/latestdoi/7605723)
48

59
twarc is a command line tool and Python library for collecting and archiving Twitter JSON
610
data via the Twitter API. It has separate commands (twarc and twarc2) for working with the older
@@ -41,7 +45,6 @@ If you are interested in adding functionality to twarc or fixing something that'
4145

4246
git clone https://github.com/docnow/twarc
4347
cd twarc
44-
pip install -r requirements.txt
4548

4649
Create a .env file that included Twitter App keys to use during testing:
4750

@@ -53,7 +56,7 @@ Create a .env file that included Twitter App keys to use during testing:
5356

5457
Now run the tests:
5558

56-
python setup.py test
59+
uv run pytest
5760

5861
Add your code and some new tests, and send a pull request!
5962

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[project]
2+
name = "twarc"
3+
version = "2.14.1"
4+
description = "Archive tweets from the command line"
5+
license = "MIT"
6+
readme = "README.md"
7+
requires-python = ">=3.13"
8+
dependencies = [
9+
"click>=7,<9",
10+
"click-config-file>=0.6",
11+
"click-plugins>=1",
12+
"humanize>=3.9",
13+
"python-dateutil>=2.8",
14+
"requests_oauthlib>=1.3",
15+
"tqdm>=4.62",
16+
"twarc-csv>=0.7.2",
17+
]
18+
19+
[dependency-groups]
20+
dev = [
21+
"black>=25.9.0",
22+
"pytest>=8.4.2",
23+
"pytest-black>=0.6.0",
24+
"python-dotenv>=1.2.1",
25+
"pytz>=2025.2",
26+
"toml>=0.10.2",
27+
]
28+
29+
[project.scripts]
30+
twarc = "twarc.command:main"
31+
twarc2 = "twarc.command2:twarc2"
32+
33+
[tool.pytest.ini_options]
34+
addopts = "--verbose --black"
35+
36+
[tool.uv.workspace]
37+
members = [
38+
"tmp/twarc",
39+
]
40+
41+
[build-system]
42+
requires = ["uv_build>=0.8.3,<0.9.0"]
43+
build-backend = "uv_build"

requirements.txt

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

setup.py

Lines changed: 0 additions & 45 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)