Skip to content

Refactoring after PR#53 code review#59

Open
mdmitry1 wants to merge 62 commits intomasterfrom
python311_refactoring
Open

Refactoring after PR#53 code review#59
mdmitry1 wants to merge 62 commits intomasterfrom
python311_refactoring

Conversation

@mdmitry1
Copy link
Collaborator

@mdmitry1 mdmitry1 commented Mar 17, 2026

Regression passed in all five configurations, all Docker images are uploaded

@mdmitry1 mdmitry1 marked this pull request as draft March 17, 2026 16:34
Copy link
Collaborator Author

@mdmitry1 mdmitry1 left a comment

Choose a reason for hiding this comment

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

Regression passed after the first refactoring round.

Main fixes:

  1. Write access to system directory is removed
  2. <repo>/dist directory is removed
  3. <repo>/manylinux_2_28 directory is removed
  4. Optional git switch is removed
  5. Z3_PREFIX is set automatically - tested on Ubuntu 24.04

Validation:

  1. pip install <repo> use case - validated on Ubuntu 24.04
  2. Manylinux wheel build use case - validated on Ubuntu 22.04

Copy link
Collaborator Author

@mdmitry1 mdmitry1 left a comment

Choose a reason for hiding this comment

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

Finished second round of refactoring

  1. Fixed build issue in the case of user_config.jam file present in home directory
  2. Added meson and ninja to build-system.requires
  3. Removed redundant meson and ninja search code
  4. For Debian only: started using precompiled gmp libraries
    For manylinux build got compilation error in SMLP C++ code

Validation

DORA test passed in Ubuntu 24.04 python virtual environment with manylinux wheel.

@fbrausse
Copy link
Collaborator

4. For manylinux build got compilation error in SMLP C++ code

Could you post the log containing the error? I'll take a look what might have gone wrong. Also the version number of GMP they install might be helpful, if you know it.

@mdmitry1
Copy link
Collaborator Author

1) ../src/reals.hh: In function ‘kay::Z smlp::reals::eager::ubound_log2(const R&)’:
../src/reals.hh:62:39: error: invalid initialization of reference of type ‘const kay::Z&’ {aka ‘const mpz_class&’} from expression of type ‘__gmp_expr<__mpq_struct [1], __gmp_unary_expr<__gmp_expr<__mpq_struct [1], __gmp_unary_expr<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, __gmp_abs_function> >, __gmp_ceil_function> >’

  1. gmp version is 6.3.0

@fbrausse
Copy link
Collaborator

  1. ../src/reals.hh: In function ‘kay::Z smlp::reals::eager::ubound_log2(const R&)’: ../src/reals.hh:62:39: error: invalid initialization of reference of type ‘const kay::Z&’ {aka ‘const mpz_class&’} from expression of type ‘__gmp_expr<__mpq_struct [1], __gmp_unary_expr<__gmp_expr<__mpq_struct [1], __gmp_unary_expr<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, __gmp_abs_function> >, __gmp_ceil_function> >’
  1. gmp version is 6.3.0

I can't reproduce this locally, neither with gcc-{13,14,15} nor with clang++-{20,21}. I also don't understand why the ceil function would return an mpq_class, it (kay's, that is) should return an mpz_class object. It could be an include path issue (since kay's ceil doesn't seem to be used) or sth. else. While I can't run manylinux here, yet, the full compile log (including the compiler commands run) might help.

Copy link
Collaborator Author

@mdmitry1 mdmitry1 left a comment

Choose a reason for hiding this comment

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

Refactoring is done.
The only remaining step: merge with
commit a44b1d2
Author: Konstantin Korovin kostyakor@gmail.com
Date: Wed Mar 11 14:23:24 2026 +0000

pyproject.toml: patch for standalone smlp

@fbrausse
Copy link
Collaborator

merge with commit a44b1d2

No need to merge branches. Cherry-pick should be fine.

@mdmitry1 mdmitry1 marked this pull request as ready for review March 22, 2026 20:00
@mdmitry1 mdmitry1 requested review from fbrausse and zurabksmlp March 22, 2026 20:01
Copy link
Collaborator

@fbrausse fbrausse left a comment

Choose a reason for hiding this comment

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

Thanks, Dmitry. For now I have a few comments, will test it tomorrow.

pyproject.toml Outdated
[tool.setuptools.packages.find]
where = ["."]
exclude = ["src*", "smlp_py*", "regr_smlp*", "utils*"]
exclude = ["scripts*","src*", "smlp_py*", "regr_smlp*", "utils*"]
Copy link
Collaborator

@fbrausse fbrausse Mar 23, 2026

Choose a reason for hiding this comment

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

While on a clean source tree this (mostly, sometimes a __pycache__ directory is included as well)
works, might I suggest to explicitly include the files instead of excluding only some? For instance, it is quite common, to put temporary directories and other files while testing / developing. Being explicit about the files part of the wheel is also more future-proof.

This is just to exclude looking for *whl files. If we decided not to have *whl files in our distribution, probably the safest thing to do is remove these lines.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just to exclude looking for *whl files. If we decided not to have *whl files in our distribution, probably the safest thing to do is remove these lines.

Copy link
Collaborator

@fbrausse fbrausse Mar 23, 2026

Choose a reason for hiding this comment

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

This is just to exclude looking for *whl files. If we decided not to have *whl files in our distribution, probably the safest thing to do is remove these lines.

What this does, is include everything and then selectively exempt some files/dirs from everything. There is a separate include option for tool.setuptools.packages.find, which instead includes only the given things and excludes everything else. That is what I'm suggesting. See https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

Copy link
Collaborator Author

@mdmitry1 mdmitry1 Mar 23, 2026

Choose a reason for hiding this comment

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

  1. We need to exclude everything.
  2. We don't need to include and/or discover anything.

Therefore, correct lines are:

[tool.setuptools.packages.find]
where = ["."]
exclude = ["*"]

Without exclude statement, some extra files are written in the distribution area.
Please, run installation and if something is incorrect, let me know.
For me everything works fine:

find /usr/local/lib/python3.11/dist-packages -name smlp'*'
/usr/local/lib/python3.11/dist-packages/smlp-1.0.1.dist-info
/usr/local/lib/python3.11/dist-packages/smlp
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_verify.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_terms.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_solver.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_plots.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_correlations.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_config.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_verify.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_refine.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_doe.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_mrmr.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_constants.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_flows.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_optimize.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_terms.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_precisions.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_frontier.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_data.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_models.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_discretize.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_utils.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_spec.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_logs.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_query.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/__pycache__/smlp_subgroups.cpython-311.pyc
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_optimize.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_plots.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_models.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_flows.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_solver.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_precisions.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_query.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_correlations.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_doe.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_refine.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_frontier.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_spec.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_logs.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_discretize.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_subgroups.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_constants.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_config.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_data.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_utils.py
/usr/local/lib/python3.11/dist-packages/smlp/smlp_py/smlp_mrmr.py
/usr/local/lib/python3.11/dist-packages/bin/smlp

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, I'll try it. Looks weird, though.

Copy link
Collaborator Author

@mdmitry1 mdmitry1 left a comment

Choose a reason for hiding this comment

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

Updates according to release plan

@mdmitry1 mdmitry1 requested a review from fbrausse March 23, 2026 15:53
Copy link
Collaborator Author

@mdmitry1 mdmitry1 left a comment

Choose a reason for hiding this comment

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

Implemented requested changes after review

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.

2 participants