Skip to content

Commit e2c4b5e

Browse files
authored
Merge pull request #123 from FormalLanguageConstrainedPathQuerying/dev
Release v5.0.0
2 parents 635b92a + f6dde71 commit e2c4b5e

252 files changed

Lines changed: 12847 additions & 2403 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/ISSUE_TEMPLATE/graph-add-template.md‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,22 @@ assignees: rustam-azimov, vadyushkins
1616
| Version | ``<Current version of CFPQ_Data>`` |
1717
| Origin | [link](``<Link to download the graph>``) |
1818

19-
## CSV File Structure
19+
## Data format
2020

21-
| Column Number | Column Type | Column Description |
22-
|:---:|:---:|---|
23-
| 1 | int | The tail of the edge |
24-
| 2 | int | The head of the edge |
25-
| 3 | str | The label of the edge |
21+
The archive must follow the standard layout described in the "File structure" section of the [Graphs page](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/index.html): `<name>.tar.gz` unpacks to `<name>/{README.md, grammar/, graph/}`, where `graph/` holds one Boolean MatrixMarket pattern file per edge label.
2622

2723
## Graph Statistics
2824
| Num Nodes | Num Edges |
2925
|:---:|:---:|
30-
| ``<The number of nodes in the new graph>`` | ``<The number of edges in the new graph>`` |
26+
| ``<The number of nodes in the new graph>`` | ``<The number of stored edges in the new graph>`` |
3127

3228
## Edges Statistics
3329
| Edge Label | Num Edge Label |
3430
|---:|---:|
3531
| ``<The type of the edge label of the new graph >`` | ``<The number of edges in the new graph of this type>`` |
3632

33+
List the stored labels only (no `_r` reversed-edge rows). A family of indexed labels (e.g. `load_0`, ..., `load_857`) is listed once with a placeholder subscript (e.g. `load_f`) and a note listing the index set.
34+
3735
## Canonical grammars
3836

3937
<LaTeX format of grammar>

‎.github/PULL_REQUEST_TEMPLATE/new_graph.md‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,22 @@
77
| Version | ``<Current version of CFPQ_Data>`` |
88
| Origin | [link](``<Link to download the graph>``) |
99

10-
## CSV File Structure
10+
## Data format
1111

12-
| Column Number | Column Type | Column Description |
13-
|:---:|:---:|---|
14-
| 1 | int | The tail of the edge |
15-
| 2 | int | The head of the edge |
16-
| 3 | str | The label of the edge |
12+
The archive must follow the standard layout described in the "File structure" section of the [Graphs page](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/index.html): `<name>.tar.gz` unpacks to `<name>/{README.md, grammar/, graph/}`, where `graph/` holds one Boolean MatrixMarket pattern file per edge label.
1713

1814
## Graph Statistics
1915
| Num Nodes | Num Edges |
2016
|:---:|:---:|
21-
| ``<The number of nodes in the new graph>`` | ``<The number of edges in the new graph>`` |
17+
| ``<The number of nodes in the new graph>`` | ``<The number of stored edges in the new graph>`` |
2218

2319
## Edges Statistics
2420
| Edge Label | Num Edge Label |
2521
|---:|---:|
2622
| ``<The type of the edge label of the new graph >`` | ``<The number of edges in the new graph of this type>`` |
2723

24+
List the stored labels only (no `_r` reversed-edge rows). A family of indexed labels (e.g. `load_0`, ..., `load_857`) is listed once with a placeholder subscript (e.g. `load_f`) and a note listing the index set.
25+
2826
## Canonical grammars
2927

3028
<LaTeX format of grammar>

‎.github/workflows/coverage.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
matrix:
1010
python-version: [ 3.11 ]
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v7
1313

1414
- name: Set up Python ${{ matrix.python-version }}
15-
uses: actions/setup-python@v4
15+
uses: actions/setup-python@v7
1616
with:
1717
python-version: ${{ matrix.python-version }}
1818

@@ -37,4 +37,4 @@ jobs:
3737
poetry run pytest --cov=cfpq_data --doctest-modules -vv -s cfpq_data tests
3838
3939
- name: Upload coverage to Codecov
40-
uses: codecov/codecov-action@v3
40+
uses: codecov/codecov-action@v7

‎.github/workflows/deploy_docs.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
matrix:
1414
python-version: [ 3.11 ]
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v7
1717

1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v7
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222

@@ -39,7 +39,7 @@ jobs:
3939
run: poetry run make -C docs/ html
4040

4141
- name: Deploy
42-
uses: JamesIves/github-pages-deploy-action@4.1.3
42+
uses: JamesIves/github-pages-deploy-action@v4
4343
with:
4444
branch: gh-pages # The branch the action should deploy to.
4545
folder: docs/_build/html # The folder the action should deploy.

‎.github/workflows/docs.yml‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Docs build check
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
docs:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [ 3.11 ]
11+
steps:
12+
- uses: actions/checkout@v7
13+
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v7
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
19+
- name: Install Poetry
20+
run: |
21+
pip install poetry
22+
23+
- name: Install dependencies with Poetry
24+
run: |
25+
poetry install --no-interaction --no-ansi --with docs
26+
27+
- name: Show installed packages
28+
run: poetry show
29+
30+
- name: Install packages
31+
run: poetry run pip install .
32+
33+
# No-warnings policy: the build runs with -W --keep-going (see
34+
# docs/Makefile), so any warning — including an unresolved
35+
# cross-reference under nitpicky — exits non-zero on its own.
36+
- name: Build
37+
run: poetry run make -C docs/ html
38+
39+
# The linkcheck builder exits non-zero on broken or timed-out links.
40+
- name: Check links
41+
run: poetry run sphinx-build -b linkcheck docs docs/_build/linkcheck

‎.github/workflows/lint.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
matrix:
1010
python-version: [ 3.9 ]
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v7
1313

1414
- name: Set up Python ${{ matrix.python-version }}
15-
uses: actions/setup-python@v4
15+
uses: actions/setup-python@v7
1616
with:
1717
python-version: ${{ matrix.python-version }}
1818

‎.github/workflows/publish.yml‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
workflow_dispatch: {}
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v7
17+
18+
- uses: actions/setup-python@v7
19+
with:
20+
python-version: '3.11'
21+
22+
- name: Verify tag matches package version
23+
if: startsWith(github.ref, 'refs/tags/v')
24+
run: |
25+
set -euo pipefail
26+
ver=$(python3 -c "import sys; sys.path.insert(0, 'utils'); import check_version_sync as c; print(c.config_version())")
27+
tag="${GITHUB_REF_NAME#v}"
28+
if [ "$tag" != "$ver" ]; then
29+
echo "::error::Tag ${GITHUB_REF_NAME} does not match package version ${ver}"
30+
exit 1
31+
fi
32+
echo "Tag ${GITHUB_REF_NAME} matches package version ${ver}"
33+
34+
- name: Build distributions
35+
run: |
36+
python3 -m pip install --upgrade build
37+
python3 -m build
38+
39+
- name: Upload dist
40+
uses: actions/upload-artifact@v7
41+
with:
42+
name: dist
43+
path: dist/
44+
45+
publish-testpypi:
46+
needs: build
47+
if: github.event_name == 'workflow_dispatch'
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Download dist
51+
uses: actions/download-artifact@v8
52+
with:
53+
name: dist
54+
path: dist/
55+
56+
- name: Publish to TestPyPI
57+
uses: pypa/gh-action-pypi-publish@release/v1
58+
with:
59+
repository-url: https://test.pypi.org/
60+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
61+
62+
publish-pypi:
63+
needs: build
64+
if: startsWith(github.ref, 'refs/tags/v')
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Download dist
68+
uses: actions/download-artifact@v8
69+
with:
70+
name: dist
71+
path: dist/
72+
73+
- name: Publish to PyPI (Trusted Publishing / OIDC)
74+
uses: pypa/gh-action-pypi-publish@release/v1
75+
# No `password`: uses OIDC Trusted Publishing (configured once on PyPI).
76+
# Fallback if not using Trusted Publishing: set the PYPI_API_TOKEN
77+
# secret and uncomment the `with` block below.
78+
# with:
79+
# password: ${{ secrets.PYPI_API_TOKEN }}
80+
81+
- name: Create GitHub Release
82+
env:
83+
GH_TOKEN: ${{ github.token }}
84+
run: |
85+
set -euo pipefail
86+
ver="${GITHUB_REF_NAME#v}"
87+
awk -v v="$ver" '
88+
index($0, "## [" v "]") == 1 {insec=1; next}
89+
/^## / && insec {exit}
90+
insec {print}
91+
' CHANGELOG.md > release_notes.md
92+
gh release create "${GITHUB_REF_NAME}" --title "${GITHUB_REF_NAME}" \
93+
--notes-file release_notes.md dist/*

‎.github/workflows/tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
]
1515
python-version: [ 3.11 ]
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v7
1818

1919
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v4
20+
uses: actions/setup-python@v7
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# Data
55
cfpq_data/data
66

7+
# Temporal CFPQ reference-answer tool (local-only, not part of the package)
8+
temporal_cfpq/
9+
710
# Byte-compiled / optimized / DLL files
811
__pycache__/
912
*.py[cod]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: add-grammar
3+
description: Use when adding a new grammar template to CFPQ_Data. Covers the generator/readwrite/converter module conventions and the PR/issue templates.
4+
---
5+
6+
# Add a grammar template
7+
8+
## Source of truth
9+
10+
The required fields and metadata live in the GitHub templates — do **not**
11+
duplicate them here:
12+
13+
- `.github/PULL_REQUEST_TEMPLATE/new_grammar.md`
14+
- `.github/ISSUE_TEMPLATE/grammar-add-template.md`
15+
16+
Fill in every field in the triangle brackets (`<>`) of those templates.
17+
18+
## Package conventions
19+
20+
Grammar code lives in `cfpq_data/grammars/`:
21+
22+
- `generators/` — template factories (e.g. `dyck_grammar`, `c_alias_grammar`).
23+
- `readwrite/` — (de)serialization (`cfg_*`, `cnf_*`, `rsa_*`, `regex_*`).
24+
- `converters/` — conversions between formalisms (`cfg_from_cnf`, ...).
25+
- `utils/` — helpers (e.g. `change_terminals_in_cfg`).
26+
27+
Each new module must:
28+
29+
1. Define `__all__` listing its public functions.
30+
2. Export it from the relevant `__init__.py`
31+
(`generators/__init__.py`, `readwrite/__init__.py`, etc.).
32+
3. Provide numpydoc docstrings with `Examples` (these are run as doctests).
33+
4. Add a mirroring test under `tests/grammars/<submodule>/test_*.py`.
34+
5. Add the template name to `GRAMMAR_TEMPLATES` in
35+
`cfpq_data/dataset/data.py` if it should be downloadable.
36+
37+
Use `pyformlang` types (`CFG`, `CNF`, `RSA`, `Regex`) as the interchange
38+
format. See `.opencode/skills/run-tests` to verify.

0 commit comments

Comments
 (0)