Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish openstate-core metadata #143

Merged
merged 15 commits into from
Oct 4, 2024
Merged
19 changes: 18 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,28 @@ jobs:
uses: snok/[email protected]
- name: configure pypi credentials
run: poetry config pypi-token.pypi "${{ secrets.PYPI_API_KEY }}"
- name: Publish package
- name: Publish core package
run: poetry publish --build
- name: install dependencies
run: poetry install
- name: update metadata
env:
DATABASE_URL: ${{ secrets.OPENSTATES_DATABASE_URL }}
run: poetry run os-initdb
# Add steps for openstates-metadata package
- name: Create directory and copy openstates-metadata
run: |
mkdir -p /openstates-core-metadata/openstates-metadata
cp -r openstates/metadata /openstates-core-metadata/openstates-metadata
- name: Change directory to openstates-metadata
alexobaseki marked this conversation as resolved.
Show resolved Hide resolved
run: cd /openstates-core-metadata/openstates-metadata
- name: Move configuration files
run: |
mv pyproject.toml.sample pyproject.toml
mv .python-version.sample .python-version
alexobaseki marked this conversation as resolved.
Show resolved Hide resolved
- name: Install dependencies for openstates-metadata
run: poetry install
- name: Configure pypi credentials for metadata package
run: poetry config pypi-token.pypi "${{ secrets.PYPI_API_KEY }}"
- name: Publish openstates-metadata package
run: poetry publish --build
1 change: 1 addition & 0 deletions openstates/metadata/.python-version.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.15
35 changes: 35 additions & 0 deletions openstates/metadata/README.md.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# openstatesmetadata

The `openstatesmetadata` package provides a lightweight solution for accessing legislative metadata from the OpenStates project without needing to install the entire core OpenStates project. It is designed for external projects that rely on this specific subset of data.
alexobaseki marked this conversation as resolved.
Show resolved Hide resolved

## Motivation

There are a couple of key reasons for creating this separate package:

1. **Minimize Dependencies:** If your project only requires access to metadata, this package allows you to avoid installing the larger OpenStates core package.
2. **Simplify Dependency Management:** With a large project like OpenStates core, managing dependencies can be complex. By isolating metadata functionality, dependency resolution becomes much simpler and faster.

## Installation

To install the `openstatesmetadata` package, simply run:

```bash
pip install openstatesmetadata
```

## Usage

Here’s an example of how to use the openstatesmetadata package:

```code
import openstatesmetadata as metadata

jurisdiction_metadata = metadata.lookup(jurisdiction_id="ocd-jurisdiction/country:us/state:ak/government")
print(jurisdiction_metadata)
```

## Features

1. Access to legislative metadata from OpenStates.
2. Lightweight and easy to integrate into projects.
3. Avoid unnecessary dependencies and overhead from the full OpenStates core project.
17 changes: 17 additions & 0 deletions openstates/metadata/pyproject.toml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tool.poetry]
name = "openstates-metadata"
version = "0.1.0"
description = "Openstates metadata"
authors = ["Alex Obaseki <[email protected]>"]
license = "MIT"


[tool.poetry.dependencies]
python = "^3.9"
attr = "^0.3.2"
attrs = "^24.2.0"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading