Skip to content

Update datapackage version#188

Merged
henhuy merged 10 commits intodevfrom
feature/update_datapackage_version
Nov 3, 2025
Merged

Update datapackage version#188
henhuy merged 10 commits intodevfrom
feature/update_datapackage_version

Conversation

@henhuy
Copy link
Copy Markdown
Collaborator

@henhuy henhuy commented Jun 26, 2025

Description

I could fix error due to "fake" foreign keys by extracting them from schema before reading in the datapackage.
When facades are built, the extracted foreign keys pointing to sequences are re-added to foreign keys, so that sequences (profiles etc.) can be connected correctly.
This is a simple workaround, which leaves most code in place and should work out-of-the-box for older and newer environments.
A more general approach as discussed in #74 is favorable, but would break older datapackage and thus is a breaking change.

Had to fix some LP files where order of lines had changed and fix two datapackages where duplicate columns were present (which is handled differently in newer datapackage version).

Fixes #187

Type of change

Please tick or delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

Please tick or delete options that are not relevant.

  • New and adjusted code is formatted using the pre-commit hooks
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • If new packages are needed, I added them the setup.py
  • I have added new features/fixes to the CHANGELOG
  • I have added my name to AUTHORS

@henhuy henhuy requested review from Bachibouzouk and MaGering June 26, 2025 12:23
@henhuy henhuy self-assigned this Jun 26, 2025
@MaGering
Copy link
Copy Markdown
Contributor

Thank you for you changes! Before going on vacation I'll not be able to review unfortunately. But if still needed I will do after (in KW29).

@henhuy henhuy requested a review from gnn June 26, 2025 14:22
for fk in resource["schema"]["foreignKeys"]
if fk["reference"]["resource"] == "bus"
]
datapackage_folder = path[:-17] # Remove "/datapackage.json" form path
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this magic number always -17 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right - I should probably look for "datapackage.json" and strip it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it

@Bachibouzouk
Copy link
Copy Markdown
Collaborator

@henhuy - do you know how to fix the tests? It seems it just cannot accept 0 = 0.0

@henhuy
Copy link
Copy Markdown
Collaborator Author

henhuy commented Aug 18, 2025

@henhuy - do you know how to fix the tests? It seems it just cannot accept 0 = 0.0

It's really annoying. Locally, tests work. It's frustrating to compare LP files with such little diffs.
Don't know a proper solution.
i think in order to fix this, locally used versions of pyomo, python, whatever must perfectly match with versions used bi GitHub Action CI

@henhuy henhuy merged commit a547ae6 into dev Nov 3, 2025
1 check failed
@henhuy henhuy deleted the feature/update_datapackage_version branch November 3, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python version limited to <3.11 and datapackage and tableschema dependencies are outdated

3 participants