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

Include dependencies in pyproject, update install docs #342

Merged
merged 7 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish to PyPI

# Publish to PyPI when a tag is pushed
on:
push:
tags:
- 'v**'

jobs:
build:
if: github.repository == 'ckan/ckanext-dcat'
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install pypa/build
run: python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish Python distribution on PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ckanext-dcat
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publishSkipped:
if: github.repository != 'ckan/ckanext-dcat'
runs-on: ubuntu-latest
steps:
- run: |
echo "## Skipping PyPI publish on downstream repository" >> $GITHUB_STEP_SUMMARY
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
recursive-include ckanext/dcat/i18n *
recursive-include ckanext/dcat/templates *
recursive-include ckanext *.yaml
recursive-include ckanext *.yml
include requirements.txt
include dev-requirements.txt
5 changes: 2 additions & 3 deletions ckanext/dcat/converters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from past.builtins import basestring
import logging

log = logging.getLogger(__name__)
Expand All @@ -24,7 +23,7 @@ def dcat_to_ckan(dcat_dict):
package_dict['extras'].append({'key': 'guid', 'value': dcat_dict.get('identifier')})

dcat_publisher = dcat_dict.get('publisher')
if isinstance(dcat_publisher, basestring):
if isinstance(dcat_publisher, str):
package_dict['extras'].append({'key': 'dcat_publisher_name', 'value': dcat_publisher})
elif isinstance(dcat_publisher, dict) and dcat_publisher.get('name'):
package_dict['extras'].append({'key': 'dcat_publisher_name', 'value': dcat_publisher.get('name')})
Expand All @@ -39,7 +38,7 @@ def dcat_to_ckan(dcat_dict):
})

dcat_creator = dcat_dict.get('creator')
if isinstance(dcat_creator, basestring):
if isinstance(dcat_creator, str):
package_dict['extras'].append({'key': 'dcat_creator_name', 'value': dcat_creator})
elif isinstance(dcat_creator, dict) and dcat_creator.get('name'):
if dcat_creator.get('name'):
Expand Down
1 change: 0 additions & 1 deletion ckanext/dcat/harvesters/_json.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from builtins import str
import json
import logging
from hashlib import sha1
Expand Down
4 changes: 1 addition & 3 deletions ckanext/dcat/harvesters/rdf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from builtins import str
from past.builtins import basestring
import json
import uuid
import logging
Expand Down Expand Up @@ -136,7 +134,7 @@ def validate_config(self, source_config):
source_config_obj = json.loads(source_config)
if 'rdf_format' in source_config_obj:
rdf_format = source_config_obj['rdf_format']
if not isinstance(rdf_format, basestring):
if not isinstance(rdf_format, str):
raise ValueError('rdf_format must be a string')
supported_formats = RDFParser().supported_formats()
if rdf_format not in supported_formats:
Expand Down
1 change: 0 additions & 1 deletion ckanext/dcat/logic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import division
import math

from ckantoolkit import config
Expand Down
1 change: 0 additions & 1 deletion ckanext/dcat/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-

from builtins import object
from functools import wraps
import os
import json
Expand Down
4 changes: 0 additions & 4 deletions ckanext/dcat/processors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from __future__ import print_function

from builtins import str
from builtins import object
import sys
import argparse
import xml
Expand Down
3 changes: 0 additions & 3 deletions ckanext/dcat/tests/harvester/test_harvester.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# -*- coding: utf-8 -*-

from builtins import str
from builtins import range
from builtins import object
from collections import defaultdict
import re

Expand Down
3 changes: 0 additions & 3 deletions ckanext/dcat/tests/harvester/test_json_harvester.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import absolute_import
from builtins import object

import responses
import pytest
try:
Expand Down
2 changes: 0 additions & 2 deletions ckanext/dcat/tests/logic/test_logic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from builtins import range
from builtins import object

try:
from unittest import mock
Expand Down
2 changes: 0 additions & 2 deletions ckanext/dcat/tests/profiles/base/test_base_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from builtins import str
from builtins import object

import pytest

Expand Down
2 changes: 0 additions & 2 deletions ckanext/dcat/tests/profiles/base/test_base_profile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from builtins import str
from builtins import object

import pytest

Expand Down
1 change: 0 additions & 1 deletion ckanext/dcat/tests/profiles/base/test_base_serializer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from builtins import str

from ckantoolkit import config

Expand Down
1 change: 0 additions & 1 deletion ckanext/dcat/tests/profiles/croissant/test_serialize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from builtins import str
import json
from unittest import mock
import uuid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from builtins import str
from builtins import object
import json

import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from builtins import str
from builtins import object
import json
import uuid
from decimal import Decimal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

from builtins import str
from builtins import object
import os
import json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

from builtins import str
from builtins import object
import json
from decimal import Decimal
import six
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from builtins import str
import json

import pytest
Expand Down
2 changes: 0 additions & 2 deletions ckanext/dcat/tests/test_blueprints.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from builtins import str
from builtins import range
import json
import time

Expand Down
1 change: 0 additions & 1 deletion ckanext/dcat/tests/test_converters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from builtins import object
import os
import json
import difflib
Expand Down
1 change: 0 additions & 1 deletion ckanext/dcat/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-

from builtins import str
import logging
import uuid
import simplejson as json
Expand Down
16 changes: 11 additions & 5 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@

1. Install the extension in your virtualenv:

(pyenv) $ pip install -e git+https://github.com/ckan/ckanext-dcat.git#egg=ckanext-dcat
pip install ckanext-dcat

2. Install the extension requirements:

(pyenv) $ pip install -r ckanext-dcat/requirements.txt
!!! Note

3. Enable the required plugins in your ini file:
For versions older than **ckanext-dcat 2.3.0** use the old legacy version of the install:

pip install -e git+https://github.com/ckan/ckanext-dcat.git#egg=ckanext-dcat

pip install -r ckanext-dcat/requirements.txt


2. Enable the required plugins in your ini file:

ckan.plugins = dcat dcat_rdf_harvester structured_data

4. To use the pre-built schemas, install [ckanext-scheming](https://github.com/ckan/ckanext-scheming):
3. To use the pre-built schemas, install [ckanext-scheming](https://github.com/ckan/ckanext-scheming):

pip install -e "git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming"

Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[project]
name = "ckanext-dcat"
version = "2.2.0"
dynamic = ["dependencies", "optional-dependencies"]
description = "Plugins for exposing and consuming DCAT metadata on CKAN"
authors = [
{name = "Adrià Mercader", email = "[email protected]"}
Expand Down Expand Up @@ -31,7 +32,6 @@ keywords = [
"RDF",
"Semantic data"
]
dependencies = []

[project.urls]
Documentation = "https://docs.ckan.org/projects/ckanext-dcat"
Expand All @@ -40,9 +40,13 @@ Issues = "https://github.com/ckan/ckanext-dcat/issues"
Changelog = "https://docs.ckan.org/projects/ckanext-dcat/en/latest/changelog/"

[build-system]
requires = ["setuptools"]
requires = ["setuptools>=62.6.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {dev = { file = ["dev-requirements.txt"] }}

[project.entry-points."ckan.plugins"]
dcat_xml_harvester = "ckanext.dcat.harvesters:DCATXMLHarvester"
dcat_json_harvester = "ckanext.dcat.harvesters:DCATJSONHarvester"
Expand Down
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
rdflib>=6.1.1,<7.2.0
pyld>=2.0.4,<3.0.0
rdflib>=6.1.1
pyld>=2.0.4
geomet>=0.2.0
ckantoolkit>=0.0.7
future>=0.18.2