Skip to content

Commit

Permalink
Merge branch 'develop' into joss_paper
Browse files Browse the repository at this point in the history
* develop:
  Update CHANGES.rst
  Remove dependency in docs on mkvirtualenv. Refs #773 (#775)
  remove unused dependency
  #767 op.execute oneline instead of get bind
  move property to options
  #767 update language name Flemish to Vlaams
  rename param
  #766 add extra id field to language dropdown
  Update changelog.
  Update Changelog.
  #738 more flexible analytics tracking (#762)
  Upgrade language-tags. (#761)
  Updates for sqlalchemy 2.0, skosprovider_sqlalchemy 2.0.0
  Update contributing.md file. Refs #756 (#757)
  Update changelog.
  Remove universal flag for wheel creation. (#753)
  • Loading branch information
koenedaele committed Feb 23, 2023
2 parents 2b2cc21 + 293f801 commit 4a9a684
Show file tree
Hide file tree
Showing 83 changed files with 63,904 additions and 58,876 deletions.
11 changes: 11 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
in progress
-----------

- Easier and more flexible configuration of analytics snippets, such as `Plausible Analytics <https://plausible.io>`_. (#738)
- Show acutal language tags in admin interface drop downs, as opposed to just the labels to reduce confusion. (#766)
- Update label of default language `vls` to `Vlaams` to be inline with the normal IANA label. (#767)
- Update language-tags to latest version. (#754)
- Stop building universal wheels (#752)
- Update docs to no longer reference mkvirtualenv, use standard venv instead (#773)
- Update CONTRIBUTING.md file (#756)

1.3.0 (04-01-2023)
-------------------

Expand Down
37 changes: 29 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
Contributing
============

Atramhasis is being developed as open source software by the
[Flanders Heritage Agency]. All development is done on the agency's
[Github page for Atramhasis].
Atramhasis is an open source SKOS editor developed by [Flanders Heritage].
Consult the [Atramhasis documentation] for more information. All development
is done through our [Github page for Atramhasis]. If you run into bugs or
would like to request a new feature, please open a [Github issue]. Please
provide some context to your question such as the operating system,
Python and Atramhasis versions you are running. If you have specific questions
about the software or the datasets hosted at [Flanders Heritage Thesaurus]
you would rather not address in a public forum, please mail us at
<ict@onroerenderfgoed.be>.

Since we place a lot of importance of code quality, we expect to have a good
If you have some
exerience with Python, Javascript, RDF or SKOS, feel free to contribute
where you can. If you are unsure if a particular change would be welcome,
create a [Github issue] first. When doing so, we recommend you follow these
guidelines.

Please setup a local installation according to the [development guidelines] in
our online documentation, especially if you are looking to make a major
contribution. For certain changes, such as updating a part of the documentation
this is not necessary.

We place a lot of importance on code quality, expect to have a good
amount of code coverage present and run frequent unit tests. All commits and
pull requests will be tested with [Travis-ci]. Code coverage is being
monitored with [Coveralls].
Expand Down Expand Up @@ -33,17 +50,21 @@ bugfix/<ticketnumber>_description_of_fix
feature/<ticketnumber>_description_of_feature
````

Branches should be branched from develop and merged back into develop once approved
through a pull request.
Feature and bugfix branches should be branched from develop and will be merged
back into develop once approved through a pull request.

Every pull request will be run through [Travis-ci]. When providing a pull
request, please run the unit tests first and make sure they all pass. Please
provide new unit tests to maintain 100% coverage. If you send us a pull request
and this build doesn't function, please correct the issue at hand or let us
that doesn't pass all tests, please correct the issue at hand or let us
know why it's not working.

[Flanders Heritage Agency]: https://www.onroerenderfgoed.be
[Flanders Heritage]: https://www.onroerenderfgoed.be
[Atramhasis documentation]: https://atramhasis.readthedocs.io/en/latest
[Flanders Heritage Thesaurus]: https://thesaurus.onroerenderfgoed.be
[Github page for Atramhasis]: https://github.com/OnroerendErfgoed/atramhasis
[Github issue]: https://github.com/OnroerendErfgoed/atramhasis/issues
[development guidelines]: https://atramhasis.readthedocs.io/en/latest/development.html
[Travis-ci]: https://travis-ci.org/OnroerendErfgoed/atramhasis
[Coveralls]: https://coveralls.io/r/OnroerendErfgoed/atramhasis
[pytest]: http://pytest.org
Expand Down
40 changes: 21 additions & 19 deletions atramhasis/alembic/env.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
try:
import configparser
except ImportError:
import ConfigParser as configparser
from alembic import context
from sqlalchemy import engine_from_config, pool
import configparser
from logging.config import fileConfig
from atramhasis.data.models import Base
from os import path

from alembic import context
from skosprovider_sqlalchemy.models import Base as SkosBase
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from sqlalchemy.schema import MetaData
from os import path

from atramhasis.data.models import Base

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand All @@ -29,18 +29,22 @@
# my_important_option = config.get_main_option("my_important_option")
# ... etc.


def load_app_ini(ini_file):
"""Load the settings for the application.ini file."""
ini = configparser.ConfigParser()
ini.readfp(open(ini_file))
with open(ini_file) as f:
ini.read_file(f)
here = path.abspath(path.dirname(ini_file))
ini.set('app:main', 'here', here)
ini.set("app:main", "here", here)
return ini

app_ini = config.get_main_option('ini_location')

app_ini = config.get_main_option("ini_location")
app_config = load_app_ini(app_ini)
sa_url = app_config.get('app:main', 'sqlalchemy.url')
config.set_main_option('sqlalchemy.url', sa_url)
sa_url = app_config.get("app:main", "sqlalchemy.url")
config.set_main_option("sqlalchemy.url", sa_url)


def run_migrations_offline():
"""Run migrations in 'offline' mode.
Expand Down Expand Up @@ -70,8 +74,9 @@ def run_migrations_online():
"""
engine = engine_from_config(
config.get_section(config.config_ini_section),
prefix='sqlalchemy.',
poolclass=pool.NullPool)
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)

metadata = MetaData()
for md in target_metadata:
Expand All @@ -80,9 +85,7 @@ def run_migrations_online():

connection = engine.connect()
context.configure(
connection=connection,
target_metadata=metadata,
render_as_batch=True
connection=connection, target_metadata=metadata, render_as_batch=True
)

try:
Expand All @@ -96,4 +99,3 @@ def run_migrations_online():
run_migrations_offline()
else:
run_migrations_online()

8 changes: 4 additions & 4 deletions atramhasis/alembic/script.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Create Date: ${create_date}

"""

# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}

from alembic import op
import sqlalchemy as sa
${imports if imports else ""}

# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}

def upgrade():
${upgrades if upgrades else "pass"}

Expand Down
21 changes: 21 additions & 0 deletions atramhasis/alembic/versions/0978347c16f9_rename_flemish_vlaams.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""rename flemish vlaams
Revision ID: 0978347c16f9
Revises: 88214d86a9d1
Create Date: 2023-02-06 13:23:27.009952
"""

from alembic import op


# revision identifiers, used by Alembic.
revision = '0978347c16f9'
down_revision = '88214d86a9d1'

def upgrade():
op.execute("UPDATE language SET name = 'Vlaams' WHERE id = 'vls'")

def downgrade():
op.execute("UPDATE language SET name = 'Flemish' WHERE id = 'vls'")
28 changes: 10 additions & 18 deletions atramhasis/alembic/versions/184f1bbcb916_language_und.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,27 @@
Create Date: 2017-07-25 16:38:39.439673
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.orm import Session
from sqlalchemy.sql import column
from sqlalchemy.sql import table

# revision identifiers, used by Alembic.
revision = '184f1bbcb916'
down_revision = '6dfc3e2324aa'
revision = "184f1bbcb916"
down_revision = "6dfc3e2324aa"

from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from sqlalchemy.orm import Session

language_table = table('language',
column('id', sa.String),
column('name', sa.String)
)
language_table = table("language", column("id", sa.String), column("name", sa.String))


def upgrade():

op.bulk_insert(language_table,
[
{'id': 'und', 'name': 'Undetermined'}
]
)
op.bulk_insert(language_table, [{"id": "und", "name": "Undetermined"}])


def downgrade():
connection = op.get_bind()
session = Session(bind=connection)
connection.execute(
language_table.delete().where(language_table.c.id == 'und')
)
connection.execute(language_table.delete().where(language_table.c.id == "und"))
session.flush()
62 changes: 38 additions & 24 deletions atramhasis/alembic/versions/1a4d62b02630_199_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,56 @@
Create Date: 2015-12-08 12:06:20.303601
"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = '1a4d62b02630'
down_revision = '2a38d364113b'

from alembic import op
import sqlalchemy as sa
revision = "1a4d62b02630"
down_revision = "2a38d364113b"


def upgrade():

op.create_table('source',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('citation', sa.Text(), nullable=False),
sa.PrimaryKeyConstraint('id')
op.create_table(
"source",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("citation", sa.Text(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)

op.create_table('conceptscheme_source',
sa.Column('conceptscheme_id', sa.Integer(), nullable=False),
sa.Column('source_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['conceptscheme_id'], ['conceptscheme.id'], ),
sa.ForeignKeyConstraint(['source_id'], ['source.id'], ),
sa.PrimaryKeyConstraint('conceptscheme_id', 'source_id')
op.create_table(
"conceptscheme_source",
sa.Column("conceptscheme_id", sa.Integer(), nullable=False),
sa.Column("source_id", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["conceptscheme_id"],
["conceptscheme.id"],
),
sa.ForeignKeyConstraint(
["source_id"],
["source.id"],
),
sa.PrimaryKeyConstraint("conceptscheme_id", "source_id"),
)

op.create_table('concept_source',
sa.Column('concept_id', sa.Integer(), nullable=False),
sa.Column('source_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['concept_id'], ['concept.id'], ),
sa.ForeignKeyConstraint(['source_id'], ['source.id'], ),
sa.PrimaryKeyConstraint('concept_id', 'source_id')
op.create_table(
"concept_source",
sa.Column("concept_id", sa.Integer(), nullable=False),
sa.Column("source_id", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["concept_id"],
["concept.id"],
),
sa.ForeignKeyConstraint(
["source_id"],
["source.id"],
),
sa.PrimaryKeyConstraint("concept_id", "source_id"),
)


def downgrade():

op.drop_table('conceptscheme_source')
op.drop_table('concept_source')
op.drop_table('source')
op.drop_table("conceptscheme_source")
op.drop_table("concept_source")
op.drop_table("source")
42 changes: 22 additions & 20 deletions atramhasis/alembic/versions/1ad2b6fbcf22_visit_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,32 @@
"""

# revision identifiers, used by Alembic.
revision = '1ad2b6fbcf22'
down_revision = '441c5a16ef8'

from alembic import op
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "1ad2b6fbcf22"
down_revision = "441c5a16ef8"


def upgrade():
op.create_table('conceptscheme_visit_log',
sa.Column('id', sa.Integer(), primary_key=True, autoincrement=True),
sa.Column('conceptscheme_id', sa.String(), nullable=False),
sa.Column('visited_at', sa.DateTime(), nullable=False),
sa.Column('origin', sa.String, nullable=False)
)
op.create_table('concept_visit_log',
sa.Column('id', sa.Integer(), primary_key=True, autoincrement=True),
sa.Column('concept_id', sa.Integer(), nullable=False),
sa.Column('conceptscheme_id', sa.String(), nullable=False),
sa.Column('visited_at', sa.DateTime(), nullable=False),
sa.Column('origin', sa.String, nullable=False)
)
op.create_table(
"conceptscheme_visit_log",
sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
sa.Column("conceptscheme_id", sa.String(), nullable=False),
sa.Column("visited_at", sa.DateTime(), nullable=False),
sa.Column("origin", sa.String, nullable=False),
)
op.create_table(
"concept_visit_log",
sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
sa.Column("concept_id", sa.Integer(), nullable=False),
sa.Column("conceptscheme_id", sa.String(), nullable=False),
sa.Column("visited_at", sa.DateTime(), nullable=False),
sa.Column("origin", sa.String, nullable=False),
)


def downgrade():
op.drop_table('concept_visit_log')
op.drop_table('conceptscheme_visit_log')
op.drop_table("concept_visit_log")
op.drop_table("conceptscheme_visit_log")

0 comments on commit 4a9a684

Please sign in to comment.