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

Canwaf/issue13 #219

Merged
merged 35 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
73a63aa
Deploy public-facing packages to pypi
Oct 27, 2021
0809385
work in progress, experimentation
Oct 28, 2021
cdecdd5
more work
Oct 28, 2021
0230018
Additional changes to csvcubed-devtools
Oct 28, 2021
953b1ca
csvqubed-models changes
Oct 28, 2021
1acac04
* pyproject (version bump)
Oct 28, 2021
5279edb
Updates to migrate
Oct 28, 2021
c2c0b94
Updates to devtools README.md and pyproject.toml
Oct 28, 2021
2b0a663
FUUUUU
Oct 28, 2021
a3ca003
Most behave tests fixed
Oct 28, 2021
2cd8925
Crack at the Jenkinsfile
Oct 28, 2021
e770611
Documentation updates
Oct 28, 2021
6b20fcf
Packaging changing test fixes
Oct 28, 2021
77d08a7
Upated
Oct 28, 2021
166e3e3
More jenkins changes
Oct 28, 2021
f5300a7
Moar Jenkins
Oct 28, 2021
046ff3a
Bug squashed, pyright ignore updated
Oct 28, 2021
3bfce79
Ignored the wrong thing.
Oct 28, 2021
954a704
Moving back to installing sibling packages as relative path dev depen…
Oct 28, 2021
28ddccd
Some small corrections.
Oct 28, 2021
662e9d6
Fix typo.
Oct 28, 2021
16cd15c
Remove typo
Oct 28, 2021
e118192
Moar corrections.
Oct 28, 2021
0a14e93
And again.
Oct 28, 2021
a050e4f
Slightly tidier.
Oct 28, 2021
c85f1db
I may be stupid.
Oct 28, 2021
25f35e8
Reset all the versions.
Oct 28, 2021
5aadcad
Fix dem unit test.
Oct 28, 2021
cbd6eb0
Removing unnecessary file.
Oct 28, 2021
25e7281
And yet more fixes.
Oct 28, 2021
f28202f
Fix the docs
Oct 28, 2021
c362de2
Fixing some namespacing collision when generating docs.
Oct 28, 2021
3cbfb29
Plz ignore
Oct 28, 2021
224094a
Addressing PR Review
Oct 29, 2021
4ed6c58
Another csvqb to remove.
Oct 29, 2021
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
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,10 @@ dmypy.json
# Cython debug symbols
cython_debug/

#Intellij idea
# IDE ignores
.idea

.jython_cache

.vscode

# Ignore docs folders
docs
60 changes: 29 additions & 31 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ pipeline {
// Clean up any unwanted files lying about after the previous build.
sh "git clean -fxd --exclude='.venv'"

dir('devtools') {
dir('csvcubed-devtools') {
sh 'poetry config virtualenvs.in-project true'
sh 'poetry install'
}

dir('sharedmodels') {
dir('csvcubed-models') {
sh 'poetry config virtualenvs.in-project true'
sh 'poetry install'
}

dir('pmd') {
dir('csvcubed-pmd') {
sh 'poetry config virtualenvs.in-project true'
sh 'poetry install'
// Patch behave so that it can output the correct format for the Jenkins cucumber tool.
Expand All @@ -31,7 +31,7 @@ pipeline {
sh "patch -Nf -d \"${venv_location}/lib/python3.9/site-packages/behave/formatter\" -p1 < /cucumber-format.patch || true"
}

dir('csvqb') {
dir('csvcubed') {
sh 'poetry config virtualenvs.in-project true'
sh 'poetry install'
// Patch behave so that it can output the correct format for the Jenkins cucumber tool.
Expand All @@ -50,40 +50,38 @@ pipeline {
}
}
steps {
dir('devtools') {
dir('csvcubed-devtools') {
sh 'poetry run pyright . --lib'
}

dir('sharedmodels') {
dir('csvcubed-models') {
sh 'poetry run pyright . --lib'
}

dir('pmd') {
dir('csvcubed-pmd') {
sh 'poetry run pyright . --lib'
}

dir('csvqb') {
dir('csvcubed') {
sh 'poetry run pyright . --lib'
}
}
}
stage('Test') {
steps {
dir('sharedmodels') {
dir('sharedmodels/tests/unit') {
sh "poetry run pytest --junitxml=pytest_results_sharedmodels.xml"
}
dir('csvcubed-models/tests/unit') {
sh "poetry run pytest --junitxml=pytest_results_models.xml"
}
dir('pmd') {
sh 'poetry run behave pmd/tests/behaviour --tags=-skip -f json.cucumber -o pmd/tests/behaviour/test-results.json'
dir('pmd/tests/unit') {
dir('csvcubed-pmd') {
sh 'poetry run behave tests/behaviour --tags=-skip -f json.cucumber -o tests/behaviour/test-results.json'
dir('tests/unit') {
sh "poetry run pytest --junitxml=pytest_results_pmd.xml"
}
}
dir('csvqb') {
sh 'poetry run behave csvqb/tests/behaviour --tags=-skip -f json.cucumber -o csvqb/tests/behaviour/test-results.json'
dir('csvqb/tests/unit') {
sh "poetry run pytest --junitxml=pytest_results_csvqb.xml"
dir('csvcubed') {
sh 'poetry run behave tests/behaviour --tags=-skip -f json.cucumber -o tests/behaviour/test-results.json'
dir('tests/unit') {
sh "poetry run pytest --junitxml=pytest_results_csvcubed.xml"
}
}

Expand All @@ -92,19 +90,19 @@ pipeline {
}
stage('Package') {
steps {
dir('devtools') {
dir('csvcubed-devtools') {
sh 'poetry build'
}

dir('sharedmodels') {
dir('csvcubed-models') {
sh 'poetry build'
}

dir('pmd') {
dir('csvcubed-pmd') {
sh 'poetry build'
}

dir('csvqb') {
dir('csvcubed') {
sh 'poetry build'
}

Expand All @@ -114,23 +112,23 @@ pipeline {
stage('Documentation') {
steps {
script {
dir('devtools') {
sh "poetry run sphinx-apidoc -F -M -a -P --tocfile index.rst -d 10 -E -o docs --implicit-namespaces -o docs devtools \"setup*\""
dir('csvcubed-devtools') {
sh "poetry run sphinx-apidoc -F -M -a -P --tocfile index.rst -d 10 -E -o docs --implicit-namespaces -o docs csvcubeddevtools \"setup*\""
sh 'poetry run sphinx-build -W -b html docs docs/_build/html'
}

dir('sharedmodels') {
sh "poetry run sphinx-apidoc -F -M -a -P --tocfile index.rst -d 10 -E --implicit-namespaces -o docs sharedmodels \"setup*\" \"sharedmodels/scripts\" \"sharedmodels/tests\""
dir('csvcubed-models') {
sh "poetry run sphinx-apidoc -F -M -a -P --tocfile index.rst -d 10 -E --implicit-namespaces -o docs csvcubedmodels \"setup*\" \"csvcubedmodels/scripts\" \"/tests\""
sh 'poetry run sphinx-build -W -b html docs docs/_build/html'
}

dir('pmd') {
sh "poetry run sphinx-apidoc -F -M -a -P --tocfile index.rst -d 10 -E --implicit-namespaces -o docs pmd \"setup*\" \"pmd/tests\""
dir('csvcubed-pmd') {
sh "poetry run sphinx-apidoc -F -M -a -P --tocfile index.rst -d 10 -E --implicit-namespaces -o docs csvcubedpmd \"setup*\" \"tests\""
sh 'poetry run sphinx-build -W -b html docs docs/_build/html'
}

dir('csvqb') {
sh "poetry run sphinx-apidoc -F -M -a -P --tocfile index.rst -d 10 -E --implicit-namespaces -o docs csvqb \"setup*\" \"csvqb/tests\""
dir('csvcubed') {
sh "poetry run sphinx-apidoc -F -M -a -P --tocfile index.rst -d 10 -E --implicit-namespaces -o docs csvcubed \"setup*\" \"tests\""
sh 'poetry run sphinx-build -W -b html docs docs/_build/html'
}

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# csvwlib
# csvcubed

A refactored version of the functionality required to build *CSV-qb*s along with the functionality necessary to convert said *CSV-qb*s into RDF compatible with the PMD platform.

## Packages

| Name | Description |
|:------------------------------------------------------|:------------------------------------------------------------------------------------|
| [csvqb](./csvqb/csvqb/README.md) | The key library helping to transform tidy-data into qb-flavoured CSV-W cubes. |
| [sharedmodels](./sharedmodels/sharedmodels/README.md) | Models and RDF serialisation functionality required by the csvqb and pmd packages. |
| [pmd](./pmd/pmd/README.md) | Transforms a CSV-qb into RDF which is compatible with the Publish My Data platform. |
| [devtools](./devtools/devtools/README.md) | Shared test functionality & dev dependencies which are commonly required. |
| Name | Description |
|:--------------------------------------------------------------------|:------------------------------------------------------------------------------------|
| [csvcubed](./csvcubed/csvcubed/README.md) | The key library helping to transform tidy-data into qb-flavoured CSV-W cubes. |
| [csvcubed-models](./csvcubed-models/csvcubedmodels/README.md) | Models and RDF serialisation functionality required by the csvcubed and csvcubed-pmd packages. |
| [csvcubed-pmd](./csvcubed-pmd/csvcubedpmd/README.md) | Transforms a CSV-qb into RDF which is compatible with the Publish My Data platform. |
| [csvcubed-devtools](./csvcubed-devtools/csvcubeddevtools/README.md) | Shared test functionality & dev dependencies which are commonly required. |

We're currently keeping all of the packages in one repository to make life easier whilst we break apart and refactor the existing code we have in [GSS-utils](https://github.com/GSS-Cogs/gss-utils). Once we're confident in how our packages look (and they're stable), it's likely that each individual package will be moved to its own independent repository.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# csvwlib - devtools
# csvcubed - devtools

> Shared test functionality & dev dependencies which are commonly required.
The *devtools* package contains common packages necessary for development of *csvwlib* such as:
The *devtools* package contains common packages necessary for development of *csvcubed* such as:

* behave - for behaviour testing / BDD
* docker - to execute docker containers, used to transform and test csvwlib outputs.
* docker - to execute docker containers, used to transform and test csvcubed outputs.
* black - auto-formatter to ensure consistent code formatting/style.

It also contains shared functionality to support testing, e.g. common *behave* test steps like checking that files exist, using temporary directories when testing as well as tools to copy test files to & from docker containers.

## Installation

This package should be installed as a [dev dependency](https://python-poetry.org/docs/cli#options-3) to ensure that end-users of *csvwlib* are not required to install development tools such as docker.
This package should be installed as a [dev dependency](https://python-poetry.org/docs/cli#options-3) to ensure that end-users of *csvcubed* are not required to install development tools such as docker.



## API Documentation

The latest API Documentation for the package can be found [here](https://ci.floop.org.uk/job/GSS_data/job/csvwlib/job/main/lastSuccessfulBuild/artifact/devtools/docs/_build/html/index.html).
The latest API Documentation for the package can be found [here](https://ci.floop.org.uk/job/GSS_data/job/csvcubed/job/main/lastSuccessfulBuild/artifact/devtools/docs/_build/html/index.html).

TODO: #217 Update API documentation location in csvcubed-devtools
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Contains functionality helpful to the development of the csvwlib tooling.
Contains functionality helpful to the development of the csvcubed tooling.
N.B. This library should always be installed as a `dev-package` and never used by an end-user.
"""
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from tempfile import TemporaryDirectory


from devtools.helpers.tar import dir_to_tar, extract_tar
from devtools.behave.temporarydirectory import get_context_temp_dir_path
from csvcubeddevtools.helpers.tar import dir_to_tar, extract_tar
from csvcubeddevtools.behaviour.temporarydirectory import get_context_temp_dir_path

client = docker.from_env()
client.images.pull("gsscogs/csv2rdf")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import sys
from typing import Tuple

from devtools.helpers.tar import dir_to_tar
from devtools.behave.temporarydirectory import get_context_temp_dir_path
from csvcubeddevtools.helpers.tar import dir_to_tar
from csvcubeddevtools.behaviour.temporarydirectory import get_context_temp_dir_path

client = docker.from_env()
client.images.pull("gsscogs/csvlint")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ def _get_test_cases_dir(start_dir: Path = Path(".")):
f"Found multiple child test-case directories: {', '.join([str(d) for d in child_test_cases_dirs])}"
)

return _get_test_cases_dir(start_dir.parent)
return _get_test_cases_dir(start_dir.absolute().parent)
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from typing import Tuple, List


from devtools.helpers.tar import dir_to_tar
from devtools.behave.temporarydirectory import get_context_temp_dir_path
from csvcubeddevtools.helpers.tar import dir_to_tar
from csvcubeddevtools.behaviour.temporarydirectory import get_context_temp_dir_path

client = docker.from_env()
client.images.pull("gsscogs/gdp-sparql-tests")
Expand Down
Loading