Skip to content

Commit

Permalink
Merge branch 'release/0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
rlskoeser committed Apr 24, 2024
2 parents bac8434 + 894837e commit 3d73af7
Show file tree
Hide file tree
Showing 16 changed files with 440 additions and 277 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "CodeQL"

on:
push:
branches: [ main, develop ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, develop ]
schedule:
- cron: '34 21 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
45 changes: 45 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will upload a Python Package when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
# normal behavior: run when a new release is created
release:
types: [published]
# allow running manually on main
workflow_dispatch:
branches: [main]

permissions:
contents: read

jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/viapy/
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
55 changes: 55 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: unit tests

on:
push: # run on every push or PR to any branch
pull_request:
schedule: # run automatically on main branch each Tuesday at 11am
- cron: "0 16 * * 2"

jobs:
python-unit:
name: Python unit tests
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
django: [0, "3.2", "4.0", "4.1", "4.2", "5.0"]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

# Base python cache on the hash of pyproject.toml with requirements
# if the file changes, the cache is invalidated.
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-${{ hashFiles('pyproject.toml') }}
pip-
- name: Install package with dependencies
run: |
if [ "${{ matrix.django }}" -gt "0"]; then pip install -q Django==${{ matrix.django }} '.[django_test]'; fi
pip install .
pip install '.[test]'
pip install codecov
- name: Setup test settings
run: |
cp ci/testsettings.py testsettings.py
python -c "import uuid; print('SECRET_KEY = \'%s\'' % uuid.uuid4())" >> testsettings.py
- name: Run pytest
env:
SOLR_VERSION: "${{ matrix.solr }}"
run: py.test --cov=viapy --cov-report=xml

- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v3
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
CHANGELOG
=========

0.3
---

* Handle negative years when parsing birth and death dates
* Now tested on python 3.9 through 3.12
* Now tested against Django 3.2 through 5.0
* Migrate continous integration to GitHub Actions

0.2
---

Expand Down
19 changes: 9 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Authority File) data and APIs.
**viapy** provides optional Django integration; this currently includes a
django-autocomplete-light lookup view and a VIAF url widget.

.. image:: https://travis-ci.org/Princeton-CDH/viapy.svg
:target: https://travis-ci.org/Princeton-CDH/viapy
.. image:: https://github.com/Princeton-CDH/viapy/actions/workflows/unit_tests.yml/badge.svg
:target: https://github.com/Princeton-CDH/viapy/actions/workflows/unit_tests.yml
:alt: Build status

.. image:: https://codecov.io/gh/Princeton-CDH/viapy/branch/master/graph/badge.svg
Expand Down Expand Up @@ -65,7 +65,7 @@ Include the viapy urls at the desired base url with the namespace::

urlpatterns = [
...
url(r'^viaf/', include('viapy.urls', namespace='viaf')),
path(r'viaf/', include('viapy.urls', namespace='viaf')),
...
]

Expand All @@ -79,15 +79,14 @@ This git repository uses `git flow`_ branching conventions.

Initial setup and installation:

- Recommended: create and activate a python 3.5 virtualenv::
- Recommended: create and activate a python 3.11 virtualenv::

virtualenv viapy -p python3.5
python3 -m venv viapy
source viapy/bin/activate

- pip install the package with its python dependencies::
- pip install the package with all development and test dependencies::

pip install -e .
pip install -e ".[django]""
pip install -e ".[dev]""


Unit Testing
Expand Down Expand Up @@ -115,7 +114,7 @@ Documentation
Documentation is generated using `sphinx <http://www.sphinx-doc.org/>`_.
To generate documentation, first install development requirements::

pip install -e ".[docs]"
pip install -e ".[dev]"

Then build the documentation using the customized make file in the `docs`
directory::
Expand All @@ -133,7 +132,7 @@ License

**viapy** is distributed under the Apache 2.0 License.

©2017 Trustees of Princeton University. Permission granted via
©2024 Trustees of Princeton University. Permission granted via
Princeton Docket #18-3449-1 for distribution online under a standard Open Source
license. Ownership rights transferred to Rebecca Koeser provided software
is distributed online via open source.
59 changes: 59 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "viapy"
description = "Python module for interacting with VIAF data & APIs"
authors = [
{name = "Center for Digital Humanities at Princeton", email = "[email protected]"},
]
requires-python = ">=3.9"
readme = "README.rst"
license = {text = "Apache-2"}
classifiers = [
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dynamic = ["version"]
dependencies = [
"requests", "rdflib", "cached_property", "attrdict3"
]

[project.urls]
#Documentation = "https://readthedocs.org"
Repository = "https://github.com/Princeton-CDH/viapy"
Changelog = "https://github.com/Princeton-CDH/viapy/blob/main/CHANGELOG.rst"

[tool.hatch.version]
path = "viapy/__init__.py"

[project.optional-dependencies]
test = [
"pytest",
"pytest-cov"
]
django = ["django>=3.2", "django-autocomplete-light"]
django_test = ["pytest-django", "viapy[django]"]
docs = ["sphinx"]
test_all = ["viapy[test]", "viapy[django_test]"]
dev = ["pre-commit", "viapy[django]", "viapy[test_all]", "viapy[docs]"]

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "testsettings"
2 changes: 0 additions & 2 deletions pytest.ini

This file was deleted.

56 changes: 0 additions & 56 deletions setup.py

This file was deleted.

Loading

0 comments on commit 3d73af7

Please sign in to comment.