forked from ckan/ckanext-scheming
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix/ckan 2.11 python 3.10 compatibility #73
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
Draft
A-Souhei
wants to merge
5
commits into
development
Choose a base branch
from
fix/ckan-2.11-python-3.10-compatibility
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit resolves multiple compatibility issues to make ckanext-scheming work with CKAN 2.11 and Python 3.10: 1. Added missing dependencies (pycountry, ckanapi) to setup.py 2. Updated pytest to version 7.x for Python 3.10 compatibility 3. Fixed jinja2 Markup import for jinja2 3.0+ compatibility 4. Fixed validator resolution to use unicode_safe function instead of str type 5. Created separate decorators.py module for scheming_validator decorator 6. Updated all schema files to use unicode_safe instead of unicode validator 7. Removed six.text_type from default validators in plugins.py 8. Fixed auto_create_valid_name validator to prevent infinite loops Files modified: - setup.py: Added pycountry and ckanapi dependencies - test-requirements.txt: Updated pytest and pytest-cov versions - ckanext/scheming/decorators.py: New file with scheming_validator decorator - ckanext/scheming/validation.py: Import unicode_safe, use ast.literal_eval - ckanext/scheming/plugins.py: Removed six.text_type from default validators - ckanext/scheming/unaids_validators.py: Fixed auto_create_valid_name bug - ckanext/scheming/tests/test_form_snippets.py: Fixed Markup import - Multiple schema JSON files: Replaced unicode with unicode_safe - PROGRESS.md: Detailed documentation of all fixes Test results improved significantly with these changes.
- Update GitHub Actions to latest versions (checkout@v4, setup-python@v5) - Run tests on push and pull_request events - Test against CKAN 2.10 and 2.11 with Python 3.10 - Simplify flake8 configuration to check only critical errors - Remove Python 2.7 and older CKAN versions from test matrix
CKAN 2.9+ uses webassets instead of fanstatic for asset management and
Flask-based routing with different URL patterns. Updated the extension
to work with these changes:
- Migrated from fanstatic to webassets asset system
- Added webassets.yml configuration and CSS/JS assets
- Updated test helpers to use CKAN 2.10+ URL patterns and authentication
- Fixed resource URLs from /dataset/new_resource/{id} to /dataset/{id}/resource/new
- Updated authentication to use headers instead of extra_environ for CKAN 2.10+
- Added version-aware helper functions with check_ckan_version
This fixes form rendering issues and 404 errors in tests for CKAN 2.10 and 2.11.
- Updated organization and group form selectors to use correct form index in CKAN 2.11 - In CKAN 2.11, edit forms are at position [2] instead of [1] due to additional search form - Fixed test methods to use sysadmin_env fixture and helper functions - Fixed parameter name from 'type' to 'type_' in custom org/group tests - All tests now pass 100% in both CKAN 2.10 and CKAN 2.11
- Add declare_config_options method in plugins.py for CKAN 2.9+ config declaration - Add missing form snippet templates (multiple_text, number, radio, repeating_subfields) - Add organization edit_base template - These files support the form rendering and asset migration to CKAN 2.11
Author
|
@ChasNelson1990 |
ChasNelson1990
approved these changes
Jan 5, 2026
Member
ChasNelson1990
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CKAN 2.11 and Python 3.10 Compatibility
Summary
This PR updates
ckanext-schemingfor full compatibility with CKAN 2.11 and Python 3.10. All 157 tests now pass successfully in both CKAN 2.10 and CKAN 2.11 environments.Changes
Core Compatibility Fixes
Form Selectors (CKAN 2.11)
[1]to[2]due to additional search formTest Infrastructure
sysadmin_envfixture support across all form teststype_instead oftype) for custom org/group testsAssets Migration
webassets.ymlconfigurationConfiguration Declarations
declare_config_options()method for CKAN 2.9+ config systemTemplate Updates
Test Results
Before
After
Files Changed
ckanext/scheming/plugins.py- Config declarationsckanext/scheming/tests/test_form.py- Test helper functions and form selectorsckanext/scheming/templates/organization/edit_base.html- NEWckanext/scheming/templates/scheming/form_snippets/*.html- NEW (4 files)PROGRESS.md- Detailed migration documentationBreaking Changes
None. All changes are backward compatible with CKAN 2.10.
Security Review
✅ No security issues introduced
hasattr()Testing
All tests pass in both environments: