Skip to content

Commit

Permalink
Merge pull request #4305 from acl-org/python-dev
Browse files Browse the repository at this point in the history
Merge v0.5.1 release, changes package name to acl-anthology
  • Loading branch information
mbollmann authored Jan 3, 2025
2 parents 6ecf1e3 + dfda10f commit e31ad50
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![GitHub contributors](https://img.shields.io/github/contributors/acl-org/acl-anthology)](https://github.com/acl-org/acl-anthology/graphs/contributors)
[![Good first project issues](https://img.shields.io/github/issues/acl-org/acl-anthology/good%20first%20project)](https://github.com/acl-org/acl-anthology/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+project%22)
[![License](https://img.shields.io/github/license/acl-org/acl-anthology)](LICENSE)
[![acl-anthology-py on PyPI](https://img.shields.io/pypi/v/acl-anthology-py?logo=python&label=acl-anthology-py&labelColor=lightgray&color=3776AB)](https://pypi.org/project/acl-anthology-py/)
[![acl-anthology on PyPI](https://img.shields.io/pypi/v/acl-anthology?logo=python&label=acl-anthology&labelColor=lightgray&color=3776AB)](https://pypi.org/project/acl-anthology/)

This repository contains:

Expand All @@ -14,7 +14,7 @@ This repository contains:

The official home of this repository is <https://github.com/acl-org/acl-anthology>.

## Using the acl-anthology-py Python package
## Using the acl-anthology Python package

Please see the separate [README for the Python package](python/README.md) for detailed information.

Expand Down
2 changes: 1 addition & 1 deletion README_detailed.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ comprise:
defines which author names should be treated as identical for purposes of
generating "author" pages.

The "acl-anthology-py" module under [`python/`](python/) is responsible
The "acl-anthology" module under [`python/`](python/) is responsible
for parsing and interpreting all these data files. Some information that is not
explicitly stored in any of these files is *derived automatically* by this
module during Step 1 of building the website.
Expand Down
2 changes: 1 addition & 1 deletion bin/anthology/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import warnings

warnings.warn(
"""Your code uses the legacy Anthology library. Consider migrating to acl-anthology-py <https://acl-anthology-py.readthedocs.io/>""",
"""Your code uses the legacy Anthology library. Consider migrating to acl-anthology <https://acl-anthology.readthedocs.io/>""",
FutureWarning,
stacklevel=2,
)
2 changes: 1 addition & 1 deletion .readthedocs.yaml → python/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build:
- pip install poetry
- poetry config virtualenvs.create false
post_install:
- poetry install --directory=python --with dev
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --directory=python --with dev

# Build documentation with MkDocs
mkdocs:
Expand Down
8 changes: 8 additions & 0 deletions python/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## [Unreleased]

## [0.5.1] — 2025-01-02

This release changes the PyPI package name from acl-anthology-py to acl-anthology.

### Added

- VenueIndex can now set `no_item_ids=True` to skip reverse-indexing volumes. This avoids parsing all XML files if all you want to access is basic venue information, but means that `Venue.item_ids` will be empty. _You probably don't want to use this unless you know that you are not going to need this information._

### Changed

- LaTeX encoding now uses [pylatexenc](https://pylatexenc.readthedocs.io/) instead of latexcodec, and wraps all macros in braces. This should address problems with BibTeX handling, see [#4280](https://github.com/acl-org/acl-anthology/issues/4280).
Expand Down
18 changes: 9 additions & 9 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# acl-anthology-py
# acl-anthology

[![License](https://img.shields.io/github/license/acl-org/acl-anthology)](LICENSE)
[![Build Status](https://img.shields.io/github/actions/workflow/status/acl-org/acl-anthology/code-quality.yml)](https://github.com/acl-org/acl-anthology/actions/workflows/code-quality.yml)
[![Documentation](https://img.shields.io/readthedocs/acl-anthology-py)](https://acl-anthology-py.readthedocs.io/en/latest/)
[![Documentation](https://img.shields.io/readthedocs/acl-anthology)](https://acl-anthology.readthedocs.io/en/latest/)
[![Code Coverage](https://img.shields.io/codecov/c/gh/acl-org/acl-anthology)](https://codecov.io/gh/acl-org/acl-anthology)
![Supported Python Versions](https://img.shields.io/pypi/pyversions/acl-anthology-py)
![Development Status](https://img.shields.io/pypi/status/acl-anthology-py)
[![Package on PyPI](https://img.shields.io/pypi/v/acl-anthology-py)](https://pypi.org/project/acl-anthology-py/)
![Supported Python Versions](https://img.shields.io/pypi/pyversions/acl-anthology)
![Development Status](https://img.shields.io/pypi/status/acl-anthology)
[![Package on PyPI](https://img.shields.io/pypi/v/acl-anthology)](https://pypi.org/project/acl-anthology/)

This package accesses data from the [ACL
Anthology](https://aclanthology.org).

- [**Documentation**](https://acl-anthology-py.readthedocs.io/en/latest/)
- [**Package on PyPI**](https://pypi.org/project/acl-anthology-py/)
- [**Documentation**](https://acl-anthology.readthedocs.io/en/latest/)
- [**Package on PyPI**](https://pypi.org/project/acl-anthology/)

## How to use

Install via `pip`:

```bash
$ pip install acl-anthology-py
$ pip install acl-anthology
```

Instantiate the library, automatically fetching data files from the [ACL
Expand Down Expand Up @@ -53,7 +53,7 @@ Two-Level Morphology with Composition
```

Find more examples and details on the API in the [**official
documentation**](https://acl-anthology-py.readthedocs.io/en/latest/).
documentation**](https://acl-anthology.readthedocs.io/en/latest/).

## Developing

Expand Down
2 changes: 1 addition & 1 deletion python/acl_anthology/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ class DefaultConfig:
config = OmegaConf.structured(DefaultConfig)
"""A [structured configuration instance](https://omegaconf.readthedocs.io/en/latest/structured_config.html) that is used by all `acl_anthology` classes."""

dirs = PlatformDirs("acl-anthology-py")
dirs = PlatformDirs("acl-anthology")
"""A [PlatformDirs instance](https://platformdirs.readthedocs.io/en/latest/api.html#platformdirs) that returns platform-specific directories for storing data."""
2 changes: 1 addition & 1 deletion python/acl_anthology/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ class SchemaMismatchWarning(UserWarning):
def __init__(self) -> None:
super().__init__(
"Data directory contains a different schema.rnc as this library; "
"you might need to update the data or the acl-anthology-py library."
"you might need to update the data or the acl-anthology library."
)
4 changes: 4 additions & 0 deletions python/acl_anthology/venues.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ class VenueIndex(SlottedDict[Venue]):
Attributes:
parent: The parent Anthology instance to which this index belongs.
no_item_ids: If set to True, skips parsing all XML files, which means the reverse-indexing of Volumes via `Venue.item_ids` will not be available.
is_data_loaded: A flag indicating whether the venue YAML files have been loaded and the index has been built.
"""

parent: Anthology = field(repr=False, eq=False)
no_item_ids: bool = field(repr=False, default=False)
is_data_loaded: bool = field(init=False, repr=False, default=False)

def load(self) -> None:
Expand Down Expand Up @@ -153,6 +155,8 @@ def build(self) -> None:
Raises:
ValueError: If a volume lists a venue ID that doesn't exist (i.e., isn't defined in the venue YAML files).
"""
if self.no_item_ids:
return
for volume in self.parent.volumes():
for venue_id in volume.venue_ids:
if venue_id not in self.data:
Expand Down
2 changes: 1 addition & 1 deletion python/docs/api/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# API Documentation

This is the API documentation for acl-anthology-py.
This is the API documentation for the acl-anthology Python package.
7 changes: 2 additions & 5 deletions python/docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ fetching data from the main ACL Anthology repository, you will also need to have
## Installation

The library is available as a [PyPI
package](https://pypi.org/project/acl-anthology-py/) and can therefore simply be
package](https://pypi.org/project/acl-anthology/) and can therefore simply be
installed via pip:

```bash
pip install acl-anthology-py
pip install acl-anthology
```

Alternatively, you can [download releases from
Github](https://github.com/acl-org/acl-anthology/releases/).

## Instantiating the Anthology

### From the official repository
Expand Down
2 changes: 1 addition & 1 deletion python/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ can even use this library to programmatically make changes to the metadata.
This package requires **Python 3.10 or newer**. Install via pip:

```bash
pip install acl-anthology-py
pip install acl-anthology
```

Instantiate the library, automatically fetching data files from the [ACL
Expand Down
4 changes: 2 additions & 2 deletions python/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
site_name: acl-anthology-py
site_name: acl-anthology
site_author: Marcel Bollmann
repo_url: https://github.com/acl-org/acl-anthology
repo_name: acl-org/acl-anthology
Expand Down Expand Up @@ -101,7 +101,7 @@ extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/acl-org/acl-anthology
name: acl-anthology-py on Github
name: acl-anthology on Github
- icon: material/web
link: https://aclanthology.org/
name: ACL Anthology Website
Expand Down
8 changes: 4 additions & 4 deletions python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ target-version = 'py310'
ignore = ['E501'] # "Line too long" is black's job

[tool.poetry]
name = "acl-anthology-py"
name = "acl-anthology"
packages = [
{ include = "acl_anthology" },
]
version = "0.5.0"
version = "0.5.1"
description = "A library for accessing the ACL Anthology"
authors = ["Marcel Bollmann <[email protected]>"]
license = "Apache-2.0"
Expand Down Expand Up @@ -92,6 +92,7 @@ mypy = "^1.3.0"
types-python-slugify = "^8.0.0.3"
types-pyyaml = "^6.0.12.11"
types-lxml = "^2023.3.28"
pymdown-extensions = "^10.13"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
9 changes: 9 additions & 0 deletions python/tests/venues_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
import pytest
from pathlib import Path
from acl_anthology.venues import VenueIndex, Venue
Expand Down Expand Up @@ -80,3 +81,11 @@ def test_venueindex_iter(anthology):
index = VenueIndex(anthology)
venue_ids = index.keys()
assert set(venue_ids) == set(all_toy_venue_ids)


def test_venueindex_noindex(anthology, caplog):
"""Accessing venues with no_item_ids=True should not load XML files."""
with caplog.at_level(logging.DEBUG):
index = VenueIndex(anthology, no_item_ids=True)
_ = index.get("cl").name
assert not any("XML data file" in rec.message for rec in caplog.records)

0 comments on commit e31ad50

Please sign in to comment.