-
Notifications
You must be signed in to change notification settings - Fork 0
1 package khisto python #5
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
323a6b9
chore: remove pyrefly from pre-commit
bruno-at-orange 60e29ce
chore: remove git submodule for khiops sources
bruno-at-orange bb9d392
chore: add license file
bruno-at-orange 57014df
chore: add pip packaging with cmake
bruno-at-orange c05c446
chore: add packaging workflow
bruno-at-orange 0e706e7
chore: add pre-commit hooks about copyright
bruno-at-orange e5338b4
chore: add copyright to sources file
bruno-at-orange ca63cbe
chore: publish packages on test.pypi
bruno-at-orange 706ed80
chore: add macos files to .gitignore
bruno-at-orange 5421fca
fix: Add ninja containers created by cibuildwheel
bruno-at-orange 9075622
chore: add tests with pytest
bruno-at-orange 099b06f
chore: publish on test.pyp or pypi
bruno-at-orange b456636
chore: remove sdist generation
bruno-at-orange 9c11afa
chore: update copyright date
bruno-at-orange 7876a02
chore: exclude irrelevant directories from package
bruno-at-orange 503595a
chore: build for python 3.10 with ABI 3
bruno-at-orange 1aa03f5
chore: split release on test.pypi/pypi
bruno-at-orange ddf8fc6
chore: set 2025-2026 for copyrights
bruno-at-orange File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: pip packaging | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| python_repository: | ||
| description: python repository | ||
| type: choice | ||
| default: None # no publishing to any Package Index by default | ||
| options: [None, testpypi, pypi] | ||
| push: | ||
| tags: ['*'] | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/pack-pip.yml | ||
| - pyproject.toml | ||
popescu-v marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - CMakeLists.txt | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| build-wheel: | ||
| name: Build wheel | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025, windows-11-arm, macos-15-intel, macos-15] | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Load Visual C++ Environment Variables (Windows) | ||
| if: runner.os == 'Windows' | ||
| shell: cmd | ||
| run: | | ||
| call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat" | ||
| set >> %GITHUB_ENV% | ||
|
|
||
| - name: Build wheels | ||
| uses: pypa/cibuildwheel@v3.3.1 | ||
|
|
||
| - name: install Python | ||
| uses: actions/setup-python@v5 | ||
|
|
||
| - name: Test built wheel | ||
| run: | | ||
| pip install --find-links=wheelhouse khisto | ||
| pip install pytest>=8.3 pytest-cov>=6 pytest-xdist>=3.6 pytest-sugar>=1.0 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd put these test dependencies into a |
||
| pytest tests/ | ||
|
|
||
| - uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: pkg-wheel-${{ matrix.os }} | ||
| path: wheelhouse/*.whl | ||
| if-no-files-found: error | ||
|
|
||
| release-testpypi: | ||
| # Publish only on tag pushes in the KhiopsML repository | ||
| if: github.ref_type == 'tag' && github.repository_owner == 'KhiopsML' && inputs.python_repository == 'testpypi' | ||
| name: Publish to Test.PyPI.org | ||
| needs: [build-wheel] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| environment: | ||
| name: testpypi | ||
| steps: | ||
| - uses: actions/download-artifact@v5 | ||
| with: | ||
| pattern: pkg-* | ||
| path: dist | ||
| merge-multiple: true | ||
| - uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| verbose: true | ||
| repository-url: https://test.pypi.org/legacy/ | ||
|
|
||
| release-pypi: | ||
| # Publish only on tag pushes in the KhiopsML repository | ||
| name: Publish to PyPI.org | ||
| if: github.ref_type == 'tag' && github.repository_owner == 'KhiopsML' && inputs.python_repository == 'pypi' | ||
| needs: [build-wheel] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| environment: | ||
| name: pypi | ||
| steps: | ||
| - uses: actions/download-artifact@v5 | ||
| with: | ||
| pattern: pkg-* | ||
| path: dist | ||
| merge-multiple: true | ||
| - uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| verbose: true | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -177,3 +177,6 @@ uv.lock | |
|
|
||
| # Excel | ||
| **/*.xlsx | ||
|
|
||
| # macOS | ||
| .DS_Store | ||
This file was deleted.
Oops, something went wrong.
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| cmake_minimum_required(VERSION 3.16.3) | ||
popescu-v marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| project(khisto) | ||
| include(FetchContent) | ||
|
|
||
| # Extract the khiops version from pyproject.toml | ||
| # The version is specified in the "tool.khiops" section as "khiops-version = "x.y.z"" | ||
| # It must correspond to a tag in the khiops repository | ||
| file(READ pyproject.toml PYPROJECT_FILE) | ||
| string(REGEX MATCH "khiops-version = \"([^\"]*)\"" _ ${PYPROJECT_FILE}) | ||
popescu-v marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| set(KHIOPS_VERSION ${CMAKE_MATCH_1}) | ||
| if(NOT KHIOPS_VERSION) | ||
| message(FATAL_ERROR "Could not extract khiops version from pyproject.toml") | ||
| endif() | ||
| message(STATUS "Khiops version: ${KHIOPS_VERSION}") | ||
|
|
||
| # Download and build khiops from the specified tag | ||
| fetchcontent_Declare( | ||
popescu-v marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| khiops | ||
| GIT_REPOSITORY https://github.com/KhiopsML/khiops.git | ||
| GIT_TAG ${KHIOPS_VERSION}) | ||
| FetchContent_MakeAvailable(khiops) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| The Clear BSD License | ||
|
|
||
| Copyright (c) 2023-2026 Orange S.A. | ||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted (subject to the limitations in the disclaimer | ||
| below) provided that the following conditions are met: | ||
|
|
||
| * Redistributions of source code must retain the above copyright notice, | ||
| this list of conditions and the following disclaimer. | ||
|
|
||
| * Redistributions in binary form must reproduce the above copyright | ||
| notice, this list of conditions and the following disclaimer in the | ||
| documentation and/or other materials provided with the distribution. | ||
|
|
||
| * Neither the name of the copyright holder nor the names of its | ||
| contributors may be used to endorse or promote products derived from this | ||
| software without specific prior written permission. | ||
|
|
||
| NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY | ||
| THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
| CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
| PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
| BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
| IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| POSSIBILITY OF SUCH DAMAGE. |
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Copyright (c) 2025-2026 Orange. All rights reserved. | ||
| # This software is distributed under the BSD 3-Clause-clear License, the text of which is available | ||
| # at https://spdx.org/licenses/BSD-3-Clause-Clear.html or see the "LICENSE" file for more details. | ||
|
|
||
| """Updates the copyright notice of the input files""" | ||
|
|
||
| import argparse | ||
| import os | ||
| import sys | ||
| from datetime import datetime | ||
|
|
||
| # Constants to check the presence of obsolete copyright | ||
| copyright_prefix = bytes("(c) 2025-", encoding="ascii") | ||
| valid_copyright = bytes(f"(c) 2025-{datetime.today().year} Orange", encoding="ascii") | ||
|
|
||
| # List of special files | ||
| special_files = ["LICENSE"] | ||
|
|
||
|
|
||
| def main(args): | ||
| """Main method""" | ||
| # Check obsolete copyright | ||
| valid_copyright = True | ||
| for file_path in args.file_paths: | ||
| if test_obsolete_copyright(file_path): | ||
| print(f"Copyright notice must be updated in {file_path}") | ||
| valid_copyright = False | ||
|
|
||
| # Set the return code | ||
| return_code = 0 | ||
| if not valid_copyright: | ||
| return_code = 1 | ||
|
|
||
| return return_code | ||
|
|
||
|
|
||
| def test_obsolete_copyright(file_path): | ||
| """Check if a special file contains an obsolete copyright notice""" | ||
|
|
||
| basename = os.path.basename(file_path) | ||
| if basename in special_files: | ||
| # Read the lines from the source file | ||
| with open(file_path, "rb") as file: | ||
| lines = file.readlines() | ||
|
|
||
| # Check copyright | ||
| for n, line in enumerate(lines): | ||
| line = line.rstrip() | ||
| if copyright_prefix in line and valid_copyright not in line: | ||
| return True | ||
| # Obsolete copyright not found | ||
| return False | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| parser = argparse.ArgumentParser( | ||
| prog="python check-obsolete-copyright.py", | ||
| formatter_class=argparse.RawTextHelpFormatter, | ||
| description="Checks the presence of an obsolete copyright notice of the input files", | ||
| ) | ||
| parser.add_argument( | ||
| "file_paths", | ||
| metavar="FILE", | ||
| nargs="+", | ||
| help="One or more source files", | ||
| ) | ||
| sys.exit(main(parser.parse_args())) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.