Skip to content

Commit

Permalink
Merge version 2.0.0 for release
Browse files Browse the repository at this point in the history
* develop: (24 commits)
  Fix typo
  Prepare for release
  Update docs with upgrade info.
  Test Python 3.11 compatibility.
  Update changelog with constructor update.
  Feature/95 provider super (#96)
  Remove nose.collector
  Stop building universal wheels.
  Update HISTORY
  Upgrade requirements + sqlachemy 2.0 prep (#94)
  Update HISTORY
  Change concept.concept_id from int to str. (#91)
  Update HISTORY.
  Drop pyup config file. (#92)
  Project housekeeping.
  Add HISTORY entry for 1.0.0. Fixes #89
  Update setup.py
  Drop python 3.6 and 3.7. Add python 3.9 and 3.10. (#93)
  Remove Scrutinizer.
  Add Scrutinizer config.
  ...
  • Loading branch information
koenedaele committed Jan 19, 2023
2 parents f77eef6 + 4e5c94e commit d363065
Show file tree
Hide file tree
Showing 20 changed files with 473 additions and 322 deletions.
4 changes: 0 additions & 4 deletions .pyup.yml

This file was deleted.

9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
language: python
sudo: false
os: linux
dist: bionic
python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
services:
- postgresql
env:
- DB="sqlite" SAURL="sqlite:///:memory:"
- DB="postgres" SAURL="postgresql://postgres:postgres@localhost/skosprovider_sqlalchemy"
install:
- pip install --upgrade pip setuptools importlib-metadata
- pip install -r requirements-dev.txt
- python setup.py -q develop
before_script:
Expand Down
8 changes: 6 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ authors:
email: koen.vandaele@vlaanderen.be
affiliation: Flanders Heritage Agency
orcid: 'https://orcid.org/0000-0002-8153-2978'
- given-names: Bart
family-names: Saelen
- given-names: Wim
family-names: De Clercq
abstract: >-
A SQLAlchemy implementation of the Skosprovider interface. It allows
storing and querying a SKOS vocabulary in a SQL database.
Expand All @@ -20,5 +24,5 @@ keywords:
- python
- sqlalchemy
license: MIT
version: 1.0.0
date-released: "2021-12-12"
version: 2.0.0
date-released: "2023-01-19"
21 changes: 21 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
2.0.0 (2023-01-19)
------------------

* **Major BC break**: Change concept.concept_id from Integer to String to allow
storing concepts and collections with a non-numeric id. Existing instance will
need to update their SQL database. Please consult the docs or the README for
some help in doing so. (#87)
* Skosprovider_sqlalchemy now depends on SQLAlchemy 1.4 or higher and should be
compatible with SQLAlchemy 2. Older versions of SQLAlchemy are no longer
supported. (#90)
* Refactored the Skosprovider_sqlalchemy constructor to call the super constructor. (#95)
* Drop support for Python 3.6 and 3.7. Add support for Python 3.11. (#86)
* Drop pyup support. (#85)

1.0.0 (2021-12-21)
-------------------

* Drop python 2 support (#80)
* Upgrade requirements (#78)
* Add a CITATION.cff file

0.6.0 (2020-07-29)
------------------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013-2015 Koen Van Daele
Copyright (c) 2013-2023 Flanders Heritage Agency

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
17 changes: 13 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ A SQLAlchemy implementation of the skosprovider_ interface.
.. image:: https://readthedocs.org/projects/skosprovider_sqlalchemy/badge/?version=latest
:target: https://readthedocs.org/projects/skosprovider_sqlalchemy/?badge=latest

.. image:: https://travis-ci.org/koenedaele/skosprovider_sqlalchemy.png?branch=master
:target: https://travis-ci.org/koenedaele/skosprovider_sqlalchemy
.. image:: https://app.travis-ci.com/OnroerendErfgoed/skosprovider_sqlalchemy.svg?branch=develop
:target: https://app.travis-ci.com/OnroerendErfgoed/skosprovider_sqlalchemy
.. image:: https://img.shields.io/coveralls/koenedaele/skosprovider_sqlalchemy.svg
:target: https://coveralls.io/r/koenedaele/skosprovider_sqlalchemy
.. image:: https://scrutinizer-ci.com/g/koenedaele/skosprovider_sqlalchemy/badges/quality-score.png?b=master
:target: https://scrutinizer-ci.com/g/koenedaele/skosprovider_sqlalchemy/?branch=master


Migrating to skosprovider_sqlalchemy 2.0.0
------------------------------------------
A change in the models has been made which requires a database upgrade.
The "concept" table's "concept_id" column has changed from being an int to a string.

Existing databases will therefor require a small change to update table scheme.
Typically this will look like::

ALTER TABLE concept ALTER COLUMN concept_id TEXT NOT NULL;


Building the docs
Expand Down
16 changes: 8 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@

# General information about the project.
project = 'Skosprovider_sqlalchemy'
copyright = '2013-2021, Koen Van Daele'
copyright = '2013-2023, Flanders Heritage'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X(.Y version.
version = '1.0'
version = '2.0'
# The full version, including alpha/beta/rc tags.
release = '1.0.0'
release = '2.0.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -181,7 +181,7 @@
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Skosprovider_sqlalchemy.tex', 'Skosprovider\\_sqlalchemy Documentation',
'Koen Van Daele', 'manual'),
'Flanders Heritage', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -211,7 +211,7 @@
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'skosprovider_sqlalchemy', 'Skosprovider_sqlalchemy Documentation',
['Koen Van Daele'], 1)
['Flanders Heritage'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -225,7 +225,7 @@
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Skosprovider_sqlalchemy', 'Skosprovider_sqlalchemy Documentation',
'Koen Van Daele', 'Skosprovider_sqlalchemy', 'One line description of project.',
'Flanders Heritage', 'Skosprovider_sqlalchemy', 'One line description of project.',
'Miscellaneous'),
]

Expand All @@ -244,8 +244,8 @@
# Bibliographic Dublin Core info.
epub_title = 'Skosprovider_sqlalchemy'
epub_author = 'Koen Van Daele'
epub_publisher = 'Koen Van Daele'
epub_copyright = '2013, Koen Van Daele'
epub_publisher = 'Flanders Heritage'
epub_copyright = '2013-2023, Flanders Heritage'

# The language of the text. It defaults to the language option
# or en if the language is not set.
Expand Down
12 changes: 12 additions & 0 deletions docs/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ Let's have a look at what this script did.
conceptscheme notetype
conceptscheme_label visitation
Upgrading from skosprovider_sqlalchemy 1.x to 2.x
=================================================

A change in the models has been made which requires a database upgrade.
The "concept" table's "concept_id" column has changed from being an int to a string.

Existing databases will therefor require a small change to update table scheme.
Typically this will look like::

ALTER TABLE concept ALTER COLUMN concept_id TEXT NOT NULL;

.. _SkosProvider: http://skosprovider.readthedocs.org
.. _SQLAlchemy: http://docs.sqlalchemy.org/
.. _SQLite: http://www.sqlite.org
Expand Down
13 changes: 5 additions & 8 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
--requirement requirements.txt

# Postgresql database access
psycopg2==2.9.2
psycopg2==2.9.5

# Documentation
Sphinx==4.3.1
Sphinx==6.0.0

# Testing
pytest==6.2.5
pytest-cov==3.0.0
pytest==7.2.0
pytest-cov==4.0.0
coveralls==3.3.1

# Linting
flake8==4.0.1
mccabe==0.6.1
pep8==1.7.1
pyflakes==2.4.0
flake8==6.0.0
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SQLAlchemy==1.4.28
skosprovider==1.1.0
SQLAlchemy==1.4.45
skosprovider==1.2.0
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

15 changes: 6 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env python

import os
import sys

try:
from setuptools import setup
except ImportError:
Expand All @@ -13,13 +10,13 @@
]

requires = [
'skosprovider>=1.1.0',
'skosprovider>=1.2.0',
'sqlalchemy',
]

setup(
name='skosprovider_sqlalchemy',
version='1.0.0',
version='2.0.0',
description='A sqlAlchemy implementation of skosprovider.',
long_description=open('README.rst').read(),
long_description_content_type='text/x-rst',
Expand All @@ -34,16 +31,16 @@
license='MIT',
zip_safe=False,
classifiers=[
'Development Status :: 4 - Beta',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
test_suite='nose.collector',
entry_points="""\
[console_scripts]
init_skos_db = skosprovider_sqlalchemy.scripts.init_skos_db:main
Expand Down
22 changes: 13 additions & 9 deletions skosprovider_sqlalchemy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
from sqlalchemy import Text
from sqlalchemy import UniqueConstraint
from sqlalchemy import event
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import orm
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import backref
from sqlalchemy.orm import relationship

log = logging.getLogger(__name__)
Base = declarative_base()
Base = orm.declarative_base()

concept_label = Table(
'concept_label',
Expand Down Expand Up @@ -172,7 +172,7 @@ class Thing(Base):
id = Column(Integer, primary_key=True)
type = Column(String(30))
concept_id = Column(
Integer,
String,
nullable=False,
index=True
)
Expand All @@ -199,7 +199,9 @@ class Thing(Base):
single_parent=True
)

conceptscheme = relationship('ConceptScheme', backref='concepts')
conceptscheme = relationship(
'ConceptScheme', backref=orm.backref('concepts', cascade_backrefs=False)
)
conceptscheme_id = Column(
Integer,
ForeignKey('conceptscheme.id'),
Expand Down Expand Up @@ -253,19 +255,21 @@ class Concept(Thing):
narrower_concepts = relationship(
'Concept',
secondary=concept_hierarchy_concept,
backref=backref('broader_concepts', collection_class=set),
backref=backref('broader_concepts', collection_class=set, cascade_backrefs=False),
primaryjoin='Concept.id==concept_hierarchy_concept.c.concept_id_broader',
secondaryjoin='Concept.id==concept_hierarchy_concept.c.concept_id_narrower',
collection_class=set
collection_class=set,
cascade_backrefs=False,
)

narrower_collections = relationship(
'Collection',
secondary=concept_hierarchy_collection,
backref=backref('broader_concepts', collection_class=set),
backref=backref('broader_concepts', collection_class=set, cascade_backrefs=False),
primaryjoin='Concept.id==concept_hierarchy_collection.c.concept_id_broader',
secondaryjoin='Concept.id==concept_hierarchy_collection.c.collection_id_narrower',
collection_class=set
collection_class=set,
cascade_backrefs=False,
)

__mapper_args__ = {
Expand Down Expand Up @@ -325,7 +329,7 @@ class Collection(Thing):
members = relationship(
'Thing',
secondary=collection_concept,
backref=backref('member_of', collection_class=set),
backref=backref('member_of', collection_class=set, cascade_backrefs=False),
primaryjoin='Thing.id==collection_concept.c.collection_id',
secondaryjoin='Thing.id==collection_concept.c.concept_id',
collection_class=set
Expand Down
Loading

0 comments on commit d363065

Please sign in to comment.