This document describes the changes made to migrate the project to modern Python packaging standards and improve the API.
The project has been migrated from setup.py to pyproject.toml, following PEP 517/518 standards for modern Python packaging.
- New file:
pyproject.toml- Contains all project metadata, dependencies, and build configuration - Status of setup.py: The old
setup.pyfile is still present for compatibility but is no longer the primary packaging configuration
The implementation code has been moved from setlr/__init__.py to setlr/core.py following best practices:
- setlr/core.py: Contains all implementation code (916+ lines)
- setlr/init.py: Now serves as a clean public API interface (~90 lines)
This separation provides:
- Better code organization
- Clearer public API surface
- Easier maintenance
- Improved IDE support and code navigation
A new, well-documented public function run_setl() has been introduced:
from rdflib import ConjunctiveGraph
from setlr import run_setl
# Load a SETL script
setl_graph = ConjunctiveGraph()
setl_graph.parse("my_script.setl.ttl", format="turtle")
# Execute the script
resources = run_setl(setl_graph)
# Access generated resources
output_graph = resources['http://example.com/output']Features:
- Comprehensive docstring with examples
- Proper type hints in documentation
- Clear description of parameters and return values
- Usage examples
The old _setl() function is still available for backward compatibility:
from setlr import _setl # Still works, but deprecated
# Old code continues to work
resources = _setl(setl_graph)Deprecation Warning:
- Using
_setl()will emit aDeprecationWarning - The warning suggests using
run_setl()instead - No breaking changes - existing code continues to work
The following are now officially exported from the setlr package:
Main Functions:
run_setl()- Primary API function (recommended)_setl()- Deprecated, userun_setl()insteadmain()- CLI entry point
Utility Functions:
read_csv(),read_excel(),read_json(),read_xml(),read_graph()extract(),json_transform(),transform(),load()isempty(),hash(),camelcase(),get_content()
Namespaces:
csvw,ov,setl,prov,pv,sp,sd,dc,void,shacl,api_vocab
Before:
from setlr import _setl
resources = _setl(setl_graph)After (recommended):
from setlr import run_setl
resources = run_setl(setl_graph)Note: Your old code will continue to work, but you'll see a deprecation warning. Update at your convenience.
Before:
from setlr import read_csv, extractAfter:
from setlr import read_csv, extract # Still works!No changes needed - all utility functions are properly exported.
With pyproject.toml, you can now build the package using modern tools:
# Install build tool
pip install build
# Build the package
python -m buildThis creates both wheel and source distributions in the dist/ directory.
# Development installation
pip install -e .
# Regular installation
pip install .# Install test dependencies
pip install nose2 coverage
# Run tests
nose2 --verbose- Modern Standards: Uses PEP 517/518 standards for Python packaging
- Better Documentation: Clear, comprehensive API documentation
- Improved Structure: Cleaner separation between public API and implementation
- Backward Compatible: No breaking changes for existing users
- Future-Proof: Follows current Python best practices
- Better IDE Support: Clearer module structure aids code completion and navigation
If you encounter any issues with the migration or have questions about the new API, please open an issue on GitHub.