gdeltforge 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. gdeltforge-0.4.0/.github/CODE_OF_CONDUCT.md +132 -0
  2. gdeltforge-0.4.0/.github/CONTRIBUTING.md +64 -0
  3. gdeltforge-0.4.0/.github/ISSUE_TEMPLATE/bug_report.yml +77 -0
  4. gdeltforge-0.4.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  5. gdeltforge-0.4.0/.github/ISSUE_TEMPLATE/feature_request.yml +36 -0
  6. gdeltforge-0.4.0/.github/PULL_REQUEST_TEMPLATE.md +25 -0
  7. gdeltforge-0.4.0/.github/SECURITY.md +19 -0
  8. gdeltforge-0.4.0/.github/workflows/ci.yml +66 -0
  9. gdeltforge-0.4.0/.github/workflows/docs.yml +52 -0
  10. gdeltforge-0.4.0/.github/workflows/publish.yml +78 -0
  11. gdeltforge-0.4.0/.gitignore +52 -0
  12. gdeltforge-0.4.0/.pre-commit-config.yaml +25 -0
  13. gdeltforge-0.4.0/CHANGELOG.md +93 -0
  14. gdeltforge-0.4.0/LICENSE +201 -0
  15. gdeltforge-0.4.0/PKG-INFO +558 -0
  16. gdeltforge-0.4.0/README.md +523 -0
  17. gdeltforge-0.4.0/config/settings.example.yaml +383 -0
  18. gdeltforge-0.4.0/docs/architecture.md +91 -0
  19. gdeltforge-0.4.0/docs/assets/emblem.png +0 -0
  20. gdeltforge-0.4.0/docs/assets/favicon.png +0 -0
  21. gdeltforge-0.4.0/docs/assets/terminal-demo.svg +41 -0
  22. gdeltforge-0.4.0/docs/cli-reference.md +323 -0
  23. gdeltforge-0.4.0/docs/comparison.md +39 -0
  24. gdeltforge-0.4.0/docs/configuration.md +152 -0
  25. gdeltforge-0.4.0/docs/filtered-sampling.md +186 -0
  26. gdeltforge-0.4.0/docs/getting-started.md +74 -0
  27. gdeltforge-0.4.0/docs/index.md +54 -0
  28. gdeltforge-0.4.0/docs/limitations-and-roadmap.md +40 -0
  29. gdeltforge-0.4.0/docs/recipes.md +136 -0
  30. gdeltforge-0.4.0/main.py +8 -0
  31. gdeltforge-0.4.0/mkdocs.yml +50 -0
  32. gdeltforge-0.4.0/pyproject.toml +117 -0
  33. gdeltforge-0.4.0/src/gdeltforge/__init__.py +6 -0
  34. gdeltforge-0.4.0/src/gdeltforge/_version.py +24 -0
  35. gdeltforge-0.4.0/src/gdeltforge/cli.py +567 -0
  36. gdeltforge-0.4.0/src/gdeltforge/conversion/__init__.py +0 -0
  37. gdeltforge-0.4.0/src/gdeltforge/conversion/converter.py +445 -0
  38. gdeltforge-0.4.0/src/gdeltforge/crossref/__init__.py +0 -0
  39. gdeltforge-0.4.0/src/gdeltforge/crossref/crossref.py +219 -0
  40. gdeltforge-0.4.0/src/gdeltforge/data/cameo_codes.json +1695 -0
  41. gdeltforge-0.4.0/src/gdeltforge/filtering/__init__.py +0 -0
  42. gdeltforge-0.4.0/src/gdeltforge/filtering/filter.py +363 -0
  43. gdeltforge-0.4.0/src/gdeltforge/py.typed +0 -0
  44. gdeltforge-0.4.0/src/gdeltforge/sampling/__init__.py +0 -0
  45. gdeltforge-0.4.0/src/gdeltforge/sampling/cameo_codes.py +171 -0
  46. gdeltforge-0.4.0/src/gdeltforge/sampling/indexer.py +102 -0
  47. gdeltforge-0.4.0/src/gdeltforge/sampling/rng.py +41 -0
  48. gdeltforge-0.4.0/src/gdeltforge/sampling/samplers.py +617 -0
  49. gdeltforge-0.4.0/src/gdeltforge/scraping/__init__.py +0 -0
  50. gdeltforge-0.4.0/src/gdeltforge/scraping/scraper.py +828 -0
  51. gdeltforge-0.4.0/src/gdeltforge/utils/__init__.py +0 -0
  52. gdeltforge-0.4.0/src/gdeltforge/utils/config.py +68 -0
  53. gdeltforge-0.4.0/src/gdeltforge/utils/io.py +80 -0
  54. gdeltforge-0.4.0/src/gdeltforge/utils/logging.py +26 -0
  55. gdeltforge-0.4.0/tests/test_cameo_codes.py +197 -0
  56. gdeltforge-0.4.0/tests/test_cli.py +502 -0
  57. gdeltforge-0.4.0/tests/test_config.py +27 -0
  58. gdeltforge-0.4.0/tests/test_converter.py +236 -0
  59. gdeltforge-0.4.0/tests/test_crossref.py +273 -0
  60. gdeltforge-0.4.0/tests/test_filter.py +295 -0
  61. gdeltforge-0.4.0/tests/test_indexer.py +64 -0
  62. gdeltforge-0.4.0/tests/test_io.py +65 -0
  63. gdeltforge-0.4.0/tests/test_rng.py +55 -0
  64. gdeltforge-0.4.0/tests/test_samplers.py +582 -0
  65. gdeltforge-0.4.0/tests/test_scraper.py +774 -0
  66. gdeltforge-0.4.0/uv.lock +1449 -0
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail
56
+ address, posting via an official social media account, or acting as an
57
+ appointed representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ vinicius.teixeira.carvalho@usp.br.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited
103
+ interaction with those enforcing the Code of Conduct, is allowed during this
104
+ period. Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,64 @@
1
+ # Contributing to GdeltForge
2
+
3
+ Thanks for considering a contribution. This project is small and welcomes issues, bug fixes, documentation improvements, and new features alike.
4
+
5
+ By participating, you're expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md). For security issues, see [SECURITY.md](SECURITY.md) instead of opening a public issue.
6
+
7
+ ## Getting set up
8
+
9
+ This project uses [uv](https://docs.astral.sh/uv/) for dependency management.
10
+
11
+ ```
12
+ git clone https://github.com/Vinicius-Teixeirac/GdeltForge.git
13
+ cd GdeltForge
14
+ uv sync --group dev
15
+ cp config/settings.example.yaml config/settings.yaml
16
+ uv run pre-commit install
17
+ ```
18
+
19
+ `pre-commit install` wires up git hooks (defined in `.pre-commit-config.yaml`) that run Ruff on every commit and Pyright + pytest on every push, so problems surface locally instead of in CI.
20
+
21
+ Run the test suite (pure unit tests: no network, no browser, no real GDELT data required):
22
+
23
+ ```
24
+ uv run pytest
25
+ ```
26
+
27
+ To work on the documentation site:
28
+
29
+ ```
30
+ uv sync --group docs
31
+ uv run mkdocs serve
32
+ ```
33
+
34
+ See the [full documentation](https://vinicius-teixeirac.github.io/GdeltForge/) for how the pipeline itself is organized and configured.
35
+
36
+ ## Making a change
37
+
38
+ 1. **Open an issue first for anything non-trivial** (new features, behavior changes, architectural changes) so we can agree on the approach before you put work into it. Small fixes and docs corrections can go straight to a PR.
39
+ 2. **Branch off `main`**: don't commit directly to it. Name the branch for what it does (`feat/...`, `fix/...`, `docs/...`).
40
+ 3. **Keep commits atomic and typed**: one logical change per commit, with a conventional-commits-style prefix describing its nature:
41
+ `feat`, `fix`, `perf`, `docs`, `chore`, `refactor`, `test`, or `ci`. Look at the existing git history for the style this repo follows.
42
+ 4. **Add or update tests** for any behavior change. `uv run pytest` should pass before you open a PR.
43
+ 5. **Update the docs** (`docs/`) if you're changing anything user-facing: a new CLI flag, a new config key, a changed default.
44
+ 6. **Open a pull request against `main`** using the PR template. CI (GitHub Actions) runs the test suite and a package build check on Python 3.10 and 3.12 automatically.
45
+
46
+ ## Code style
47
+
48
+ This project uses [Ruff](https://docs.astral.sh/ruff/) for linting and [Pyright](https://microsoft.github.io/pyright/) for type checking; both run in CI and should pass before you open a PR:
49
+
50
+ ```
51
+ uv sync --group lint
52
+ uv run ruff check .
53
+ uv run pyright
54
+ ```
55
+
56
+ Beyond what the tools catch, prefer clarity and small, focused functions over cleverness. Comments should explain *why*, not *what*: the code should already say what it does.
57
+
58
+ ## Reporting bugs / requesting features
59
+
60
+ Use the issue templates (Bug Report / Feature Request) when opening an issue on GitHub: they ask for the details that are usually needed to act on a report (GdeltForge version, Python version, config relevant to the issue, steps to reproduce).
61
+
62
+ ## License
63
+
64
+ By contributing, you agree that your contributions will be licensed under this project's [Apache License 2.0](../LICENSE).
@@ -0,0 +1,77 @@
1
+ name: Bug Report
2
+ description: Something in GdeltForge isn't working as expected
3
+ labels: ["bug"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for taking the time to report a bug. Please fill in as much of this as you can — it's the difference between a fix in a day and a fix in a month.
9
+
10
+ - type: textarea
11
+ id: description
12
+ attributes:
13
+ label: What happened?
14
+ description: A clear description of the bug.
15
+ validations:
16
+ required: true
17
+
18
+ - type: textarea
19
+ id: reproduce
20
+ attributes:
21
+ label: Steps to reproduce
22
+ description: The exact command(s) run, and any relevant config.
23
+ placeholder: |
24
+ 1. `gdeltforge scrape --start-date 2020-01-01 --end-date 2020-01-31`
25
+ 2. `gdeltforge convert`
26
+ 3. ...
27
+ render: shell
28
+ validations:
29
+ required: true
30
+
31
+ - type: textarea
32
+ id: expected
33
+ attributes:
34
+ label: Expected behavior
35
+ validations:
36
+ required: true
37
+
38
+ - type: textarea
39
+ id: logs
40
+ attributes:
41
+ label: Relevant log output
42
+ description: Output from `logs/pipeline.log` or the terminal. This will be rendered as a code block automatically.
43
+ render: shell
44
+
45
+ - type: input
46
+ id: version
47
+ attributes:
48
+ label: GdeltForge version
49
+ description: Output of `gdeltforge --version` if available, or the git commit/tag you're on.
50
+ validations:
51
+ required: true
52
+
53
+ - type: input
54
+ id: python-version
55
+ attributes:
56
+ label: Python version
57
+ description: Output of `python --version`
58
+ validations:
59
+ required: true
60
+
61
+ - type: dropdown
62
+ id: os
63
+ attributes:
64
+ label: Operating System
65
+ options:
66
+ - Windows
67
+ - macOS
68
+ - Linux
69
+ - Other
70
+ validations:
71
+ required: true
72
+
73
+ - type: textarea
74
+ id: context
75
+ attributes:
76
+ label: Additional context
77
+ description: Anything else relevant — relevant settings.yaml sections (redact anything sensitive), whether this happens consistently, etc.
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Security vulnerability
4
+ url: https://github.com/Vinicius-Teixeirac/GdeltForge/security/advisories/new
5
+ about: Please report security vulnerabilities privately instead of opening a public issue.
6
+ - name: Documentation
7
+ url: https://vinicius-teixeirac.github.io/GdeltForge/
8
+ about: Check the docs site before filing — your question might already be answered there.
@@ -0,0 +1,36 @@
1
+ name: Feature Request
2
+ description: Suggest an idea or improvement for GdeltForge
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for the suggestion. For anything non-trivial, opening an issue first (rather than jumping straight to a PR) helps make sure we agree on the approach before work goes into it.
9
+
10
+ - type: textarea
11
+ id: problem
12
+ attributes:
13
+ label: What problem does this solve?
14
+ description: What are you trying to do that GdeltForge doesn't support today?
15
+ validations:
16
+ required: true
17
+
18
+ - type: textarea
19
+ id: solution
20
+ attributes:
21
+ label: Proposed solution
22
+ description: How would you like this to work? A CLI flag, a config option, a new pipeline stage, etc.
23
+ validations:
24
+ required: true
25
+
26
+ - type: textarea
27
+ id: alternatives
28
+ attributes:
29
+ label: Alternatives considered
30
+ description: Any workarounds you're currently using, or other approaches you considered.
31
+
32
+ - type: textarea
33
+ id: context
34
+ attributes:
35
+ label: Additional context
36
+ description: Anything else — links, examples from other tools, related issues.
@@ -0,0 +1,25 @@
1
+ ## Summary
2
+
3
+ <!-- What does this change do, and why? Link any related issue. -->
4
+
5
+ ## Type of change
6
+
7
+ - [ ] `feat`: new feature
8
+ - [ ] `fix`: bug fix
9
+ - [ ] `perf`: performance improvement
10
+ - [ ] `docs`: documentation only
11
+ - [ ] `refactor`: no behavior change
12
+ - [ ] `test`: test-only change
13
+ - [ ] `chore` / `ci`: tooling, dependencies, CI
14
+
15
+ ## Checklist
16
+
17
+ - [ ] `uv run pytest` passes locally
18
+ - [ ] `uv run ruff check .` and `uv run pyright` pass locally
19
+ - [ ] Docs updated (`docs/`) if this changes user-facing behavior (CLI flags, config keys, defaults)
20
+ - [ ] Commits are atomic and follow the type prefixes above
21
+ - [ ] Branched from `main`, not committed directly to it
22
+
23
+ ## Test plan
24
+
25
+ <!-- How did you verify this works? Commands run, output observed, edge cases checked. -->
@@ -0,0 +1,19 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ GdeltForge is pre-1.0 and versioned from git tags (see [Releases](https://github.com/Vinicius-Teixeirac/GdeltForge/releases)). Only the latest released version is supported; please upgrade before reporting an issue if you're on an older one.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ Please **do not** open a public issue for security vulnerabilities.
10
+
11
+ Instead, use GitHub's private vulnerability reporting:
12
+
13
+ 1. Go to the [Security tab](https://github.com/Vinicius-Teixeirac/GdeltForge/security) of this repository.
14
+ 2. Click **"Report a vulnerability"**.
15
+ 3. Describe the issue, including steps to reproduce and potential impact.
16
+
17
+ This opens a private advisory visible only to the maintainer and you, and is the preferred way to report anything security-related.
18
+
19
+ You should expect an initial response within a few days. If the report is confirmed, we'll work with you on a fix and a coordinated disclosure timeline before any public advisory is published.
@@ -0,0 +1,66 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ with:
15
+ fetch-depth: 0 # full history so hatch-vcs can see tags
16
+
17
+ - name: Install uv
18
+ uses: astral-sh/setup-uv@v3
19
+
20
+ - name: Install dependencies
21
+ # setup-uv has no python-version input; uv manages/downloads the
22
+ # interpreter itself via --python (confirmed against its actual
23
+ # input schema, not assumed).
24
+ run: uv sync --group lint --python 3.12
25
+
26
+ - name: Ruff
27
+ run: uv run ruff check .
28
+
29
+ - name: Pyright
30
+ run: uv run pyright
31
+
32
+ test:
33
+ runs-on: ubuntu-latest
34
+ strategy:
35
+ matrix:
36
+ python-version: ["3.10", "3.12"]
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+ with:
40
+ fetch-depth: 0 # full history so hatch-vcs can see tags
41
+
42
+ - name: Install uv
43
+ uses: astral-sh/setup-uv@v3
44
+
45
+ - name: Install dependencies
46
+ # setup-uv has no python-version input; uv manages/downloads the
47
+ # interpreter itself via --python (confirmed against its actual
48
+ # input schema, not assumed).
49
+ run: uv sync --group dev --python ${{ matrix.python-version }}
50
+
51
+ - name: Run tests
52
+ run: uv run pytest -v
53
+
54
+ - name: Verify the package builds
55
+ run: uv build
56
+
57
+ - name: Check package metadata (twine)
58
+ run: uvx twine check dist/*
59
+
60
+ - name: Install built wheel and smoke-test the CLI
61
+ run: |
62
+ uv venv .smoke-venv
63
+ source .smoke-venv/bin/activate
64
+ uv pip install dist/*.whl
65
+ gdeltforge --help
66
+ gdeltforge codes ActionGeo_CountryCode
@@ -0,0 +1,52 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - docs/**
8
+ - mkdocs.yml
9
+ - .github/workflows/docs.yml
10
+ workflow_dispatch: {}
11
+
12
+ permissions:
13
+ contents: read
14
+ pages: write
15
+ id-token: write
16
+
17
+ concurrency:
18
+ group: pages
19
+ cancel-in-progress: false
20
+
21
+ jobs:
22
+ build:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v3
29
+
30
+ - name: Install docs dependencies
31
+ # setup-uv has no python-version input; uv manages/downloads the
32
+ # interpreter itself via --python.
33
+ run: uv sync --group docs --python 3.12
34
+
35
+ - name: Build site
36
+ run: uv run mkdocs build --strict
37
+
38
+ - name: Upload Pages artifact
39
+ uses: actions/upload-pages-artifact@v3
40
+ with:
41
+ path: site
42
+
43
+ deploy:
44
+ needs: build
45
+ runs-on: ubuntu-latest
46
+ environment:
47
+ name: github-pages
48
+ url: ${{ steps.deployment.outputs.page_url }}
49
+ steps:
50
+ - name: Deploy to GitHub Pages
51
+ id: deployment
52
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,78 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [released] # non-prerelease only — a GitHub prerelease won't touch real PyPI
6
+ workflow_dispatch: {} # manual trigger, used only for the TestPyPI rehearsal
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 0 # full history so hatch-vcs can see tags
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v3
21
+
22
+ - name: Build sdist and wheel
23
+ run: uv build
24
+
25
+ - name: Check package metadata (twine)
26
+ run: uvx twine check dist/*
27
+
28
+ - name: Install built wheel and smoke-test the CLI
29
+ run: |
30
+ uv venv .smoke-venv
31
+ source .smoke-venv/bin/activate
32
+ uv pip install dist/*.whl
33
+ gdeltforge --help
34
+ gdeltforge codes ActionGeo_CountryCode
35
+
36
+ - name: Upload built distributions
37
+ uses: actions/upload-artifact@v4
38
+ with:
39
+ name: dist
40
+ path: dist/
41
+
42
+ publish-testpypi:
43
+ # Manual rehearsal only, re-runnable any time via Actions -> Publish -> Run workflow.
44
+ if: github.event_name == 'workflow_dispatch'
45
+ needs: build
46
+ runs-on: ubuntu-latest
47
+ environment:
48
+ name: testpypi
49
+ url: https://test.pypi.org/project/gdeltforge/
50
+ permissions:
51
+ id-token: write
52
+ steps:
53
+ - uses: actions/download-artifact@v4
54
+ with:
55
+ name: dist
56
+ path: dist/
57
+ - name: Publish to TestPyPI
58
+ uses: pypa/gh-action-pypi-publish@release/v1
59
+ with:
60
+ repository-url: https://test.pypi.org/legacy/
61
+
62
+ publish-pypi:
63
+ # The real thing — fires only when a non-prerelease GitHub Release is published.
64
+ if: github.event_name == 'release'
65
+ needs: build
66
+ runs-on: ubuntu-latest
67
+ environment:
68
+ name: pypi
69
+ url: https://pypi.org/project/gdeltforge/
70
+ permissions:
71
+ id-token: write
72
+ steps:
73
+ - uses: actions/download-artifact@v4
74
+ with:
75
+ name: dist
76
+ path: dist/
77
+ - name: Publish to PyPI
78
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,52 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ *.egg-info/
7
+ *.egg
8
+ dist/
9
+ build/
10
+ .eggs/
11
+
12
+ # Generated at build time by hatch-vcs
13
+ src/gdeltforge/_version.py
14
+
15
+ # MkDocs build output
16
+ site/
17
+
18
+ # Virtual environments
19
+ .venv/
20
+ venv/
21
+ env/
22
+ ENV/
23
+
24
+ # uv
25
+ .python-version
26
+
27
+ # Config (contains local paths — copy from settings.example.yaml)
28
+ config/settings.yaml
29
+
30
+ # Pipeline data directories
31
+ *.zip
32
+ *.csv
33
+ *.parquet
34
+
35
+ # Logs
36
+ logs/
37
+
38
+ # IDE
39
+ .vscode/
40
+ .idea/
41
+ *.code-workspace
42
+
43
+ # OS
44
+ .DS_Store
45
+ Thumbs.db
46
+
47
+ # Jupyter
48
+ .ipynb_checkpoints/
49
+ *.ipynb
50
+
51
+ # Personal notes (not part of the public project)
52
+ ROADMAP.md
@@ -0,0 +1,25 @@
1
+ default_install_hook_types: [pre-commit, pre-push]
2
+
3
+ repos:
4
+ - repo: https://github.com/astral-sh/ruff-pre-commit
5
+ rev: v0.16.0
6
+ hooks:
7
+ - id: ruff-check
8
+ args: [--fix]
9
+ stages: [pre-commit]
10
+
11
+ - repo: local
12
+ hooks:
13
+ - id: pyright
14
+ name: pyright
15
+ entry: uv run pyright
16
+ language: system
17
+ pass_filenames: false
18
+ stages: [pre-push]
19
+
20
+ - id: pytest
21
+ name: pytest
22
+ entry: uv run pytest -q
23
+ language: system
24
+ pass_filenames: false
25
+ stages: [pre-push]