Skip to content
Draft
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
23 changes: 11 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Permacache Poetry
id: cache-poetry
- name: Permacache PDM
id: cache-pdm
uses: actions/cache@v3
with:
path: ~/.poetry
key: poetry
- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: curl -sSL https://install.python-poetry.org | python - -y
- name: Add Poetry to path
run: echo "${HOME}/.poetry/bin" >> $GITHUB_PATH
path: ~/.pdm
key: pdm
- name: Install PDM
if: steps.cache-pdm.outputs.cache-hit != 'true'
run: curl -sSL https://pdm-project.org/install-pdm.py | python3 -
- name: Add PDM to path
run: echo "${HOME}/.pdm/bin" >> $GITHUB_PATH
- name: Install venv
run: poetry install --with test
run: pdm install --with test --with dhlab-namespace --with dhlab-meta
- name: Test
run: poetry run pytest tests --cov=dhlab

run: pdm run pytest
162 changes: 162 additions & 0 deletions dhlab-meta-package/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm-project.org/#use-with-ide
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
49 changes: 49 additions & 0 deletions dhlab-meta-package/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[project]
name = "dhlab"
version = "2.42.0"
description = "Text and image analysis of the digital collection (books, newspapers, periodicals, and images) at the National Library of Norway"
authors = [
{name = "The Digital Humanities Lab at The National Library of Norway (NB)", email = "dh-lab@nb.no"},
]
dependencies = [
"dhlab-api",
"dhlab-core",
"dhlab-future",
"dhlab-legacy",
"dhlab-utils",
]
requires-python = ">=3.10"
# readme = "README.md"
license = {text = "MIT"}

[dependency-groups]
docs = [
"Sphinx>=7.2.6",
"furo",
"myst-parser",
"readthedocs-sphinx-search",
"sphinx-copybutton",
"sphinx-togglebutton",
"sphinx_design",
"sphinx_inline_tabs",
"mkdocs",
# "mkdocstrings",
# "mkdocs-material",
# "mkdocs-section-index",
"mkdocs-autorefs",
"sphinx-autodoc2",
"sphinx-book-theme",
"linkify-it-py",
]

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"


[tool.pdm]
distribution = true

# [tool.pdm.build]
# includes = ["src"]
# package-dir = "src"
13 changes: 6 additions & 7 deletions dhlab/__init__.py → dhlab-meta-package/src/dhlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

The dhlab python package calls the [DHLAB API](https://api.nb.no/dhlab/) under the hood to retrieve data.
"""

# api
from dhlab.api.dhlab_api import totals

Expand All @@ -19,11 +18,11 @@
token_map,
)

# metadata
from dhlab.metadata.natbib import metadata_from_urn, metadata_query
# # metadata
# from dhlab.metadata.natbib import metadata_from_urn, metadata_query

# ngram
from dhlab.ngram.ngram import Ngram, NgramBook, NgramNews
# # ngram
# from dhlab.ngram.ngram import Ngram, NgramBook, NgramNews

# text
from dhlab.text import nbtokenizer
Expand All @@ -37,5 +36,5 @@
from dhlab.utils.display import css
from dhlab.utils.files import download_from_github, get_file_from_github

# wordbank
from dhlab.wordbank.wordbank import WordForm, WordLemma, WordParadigm
# # wordbank
# from dhlab.wordbank.wordbank import WordForm, WordLemma, WordParadigm
6 changes: 6 additions & 0 deletions dhlab-meta-package/src/dhlab/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# XXX: Backwards-compatibility
from dhlab.api.constants import (
BASE_URL,
NGRAM_API,
GALAXY_API,
)
Loading
Loading