Skip to content

Simultaneous support for Python 2 and Python 3#46

Open
teeks99 wants to merge 21 commits intoboostorg:developfrom
teeks99:py2-3
Open

Simultaneous support for Python 2 and Python 3#46
teeks99 wants to merge 21 commits intoboostorg:developfrom
teeks99:py2-3

Conversation

@teeks99
Copy link
Copy Markdown
Contributor

@teeks99 teeks99 commented Oct 27, 2018

I've made the changes to follow the program through in both version of python. This Fixes #43.

Please don't merge yet, there are two known defects.

Different results

The windows version shows slightly different results on windows. Looking at the develop results the teeks99-test-py23-p2-w and teeks99-test-py23-p3-w they are the same except for the buildresults which are missing for the python 3 version.

Different output

On linux (running python 3.5), I get an exception running through the log for regex. Running with Python 3 the file results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/test_log.xml contains:

<test-log library="regex" revision="38afec" test-name="icu_example" test-type="run" test-program="libs/regex/example/snippets/icu_example.cpp" target-directory="boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden" toolset="gcc-8~c++2a" show-run-output="false">
<compile result="succeed" timestamp="2018-10-27 08:59:04 UTC">
"g++-8"   -fvisibility-inlines-hidden -std=c++2a -fPIC -m64 -pthread -O0 -fno-inline -Wall -pedantic -g -fvisibility=hidden -Wextra -DBOOST_ALL_NO_LIB=1 -DBOOST_HAS_ICU=1 -DBOOST_REGEX_DYN_LINK=1 -DU_USING_ICU_NAMESPACE=0  -I".." -c -o "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/snippets/icu_example.o" "../libs/regex/example/snippets/icu_example.cpp"

</compile>
<link result="succeed" timestamp="2018-10-27 08:59:04 UTC">
"g++-8"  -Wl,-rpath -Wl,"/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden" -Wl,-rpath-link -Wl,"/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden" -o "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/icu_example" -Wl,--start-group "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/snippets/icu_example.o" "/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden/libboost_regex.so.1.69.0"  -Wl,-Bstatic  -Wl,-Bdynamic -lrt -licudata -licui18n -licuuc -Wl,--end-group -fPIC -m64 -pthread -g -fvisibility=hidden -fvisibility-inlines-hidden 

</link>
<run result="succeed" timestamp="2018-10-27 08:59:04 UTC">
$100.23
£198.12
$
£

EXIT STATUS: 0
</run>
</test-log>

whereas the python 2 version contains:

<test-log library="regex" revision="38afec" test-name="icu_example" test-type="run" test-program="libs/regex/example/snippets/icu_example.cpp" target-directory="boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden" toolset="gcc-8~c++2a" show-run-output="false">
<compile result="succeed" timestamp="2018-10-27 09:03:39 UTC">
"g++-8"   -fvisibility-inlines-hidden -std=c++2a -fPIC -m64 -pthread -O0 -fno-inline -Wall -pedantic -g -fvisibility=hidden -Wextra -DBOOST_ALL_NO_LIB=1 -DBOOST_HAS_ICU=1 -DBOOST_REGEX_DYN_LINK=1 -DU_USING_ICU_NAMESPACE=0  -I".." -c -o "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/snippets/icu_example.o" "../libs/regex/example/snippets/icu_example.cpp"

</compile>
<link result="succeed" timestamp="2018-10-27 09:03:39 UTC">
"g++-8"  -Wl,-rpath -Wl,"/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden" -Wl,-rpath-link -Wl,"/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden" -o "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/icu_example" -Wl,--start-group "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/snippets/icu_example.o" "/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden/libboost_regex.so.1.69.0"  -Wl,-Bstatic  -Wl,-Bdynamic -lrt -licudata -licui18n -licuuc -Wl,--end-group -fPIC -m64 -pthread -g -fvisibility=hidden -fvisibility-inlines-hidden 

</link>
<run result="succeed" timestamp="2018-10-27 09:03:39 UTC">
$100.23
<C2><A3>198.12
$
<C2><A3>

EXIT STATUS: 0
</run>
</test-log>

The difference on the £198.12 vs. <C2><A3>198.12 causes a UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1803: ordinal not in range(128). Any ideas what could be causing the differences in the xml files? Something about the environment that runs the tests?

@jimmbelll
Copy link
Copy Markdown

Please don't merge yet, there are two known defects.

The difference on the £198.12 vs. <C2><A3>198.12 causes a UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1803: ordinal not in range(128). Any ideas what could be causing the differences in the xml files? Something about the environment that runs the tests?

Were you able to make any more progress with this? Are you running your regressions under python 3?

I see in collect_and_upload_logs.py row 182 they're dealing with it as a text file. Opening that file as binary, then read().decode('utf8') (and it should really be in a with statement to close the file) may do it.

Similarly in process_xml_file() row 103.

Neither will get as far as the .translate(...), since it will hit the UnicodeDecodeError first in the read().

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Jul 27, 2023

I haven't looked at this in a very long time, but I believe that issue is still there. I'm still using python 2 for the regression runs.

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 17, 2026

Asking AI about this, and so far here are issues it noticed:

  1. collect_and_upload_logs.py:
- os.path.walk( input_dir, _publish_test_log_files_, None )
+ for name, dirs, files in os.path.walk( input_dir ):
+     _publish_test_log_files_( None, name, files)

should be:

for name, dirs, files in os.walk(input_dir):
    _publish_test_log_files_(None, name, files)

This was changed in one location already correctly, but in another place it should still be fixed.

  1. collect_and_upload_logs.py

There is an instance of this code:

map( lambda x: options.__setitem__( x[0], x[1] ), option_pairs )

It recommends:

list(map(lambda x: options.__setitem__(x[0], x[1]), option_pairs))

Again the same footnote applies: this was fixed in one place correctly, it should be added in another location.

It would be great to complete this pull request. There are multiple options.

  1. if you'd like, I could add the above changes directly into this same PR. And then ask AI to more thoroughly analyze everything.

  2. or via a separate different PR, leaving this one as-is.

  3. or you might have a series of conversations with claude.ai yourself, and continue working on this. Debugging can go much faster in 2026.

Let me know what you think. If I should work on it, then it would be helpful to know the steps to replicate the bugs you saw before. A step by step explanation so I could reproduce the errors locally.

@jimmbelll
Copy link
Copy Markdown

@sdarwin Thanks for looking into this. Both your changes seem legit, but as you see from my comment above, there are also unicode/byte issues I've encountered when trying to actually run the regression tests myself, that static code analyses (like yours) won't catch.

Take a look at the boost regression matrices. You'll see that @teeks99 is still faithfully running them (thank you!), but that he's the only one.

There's a problem on the server side: when I ran the regressions (under Python 3), I got as far as the results uploading, which should put them on that matrix, but the matrix never updated. So whichever script that resides in that server, that transforms uploaded regression results to the matrix, fails for my uploads (and anyone else who's tried it, though maybe it's only me), but clearly continues to works for his. We need to troubleshoot that, and only an admin like yourself has permission to watch it (or see its logs).

Once we're seeing results reliably, then I can fork from this pull request, work through remaining runtime issues, and ultimately do a pull request with higher confidence that it will work end to end.

You'll notice too that the master branch matrix is completely neglected. So running master tests to both verify its operation and put something there would also be good.

See also: Test Matrix Docs.
(With python 2.x being EOL for some time now, this is really support for Python 3 from here on.)

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 17, 2026

Hi Jim,

I got as far as the results uploading, which should put them on that matrix, but the matrix never updated.

In terms of uploads, the previous configuration was that uploads go to "results.boost.org" and then were displayed on the earlier "www.boost.org".

Now... I have rebuilt the ftp server, and using the same URL "results.boost.org" and the same method, results actually go to a directory on "regression.boost.org", which hosts the matrix.

We can attempt to debug this. If you are able to upload results, tell me the filenames (and dates and sizes, although not really required) and I will run locate on the server to see if they are present.

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Apr 18, 2026

You'll notice too that the master branch matrix is completely neglected. So running master tests to both verify its operation and put something there would also be good.

This is a bit of a tangent for this thread, but the master tests are running, they are all just failing due to an issue in the codebase. This has been ongoing for many months.

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 18, 2026

This thread claims that the issue would be resolved if graph_parallel develop is merged to master. But it has been merged.

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 18, 2026

I just tried the graph_parallel tests on the current master, and they (mostly) work for me. (I get two compile errors caused by missing /bigobj and two link errors caused by who knows what.)

@jimmbelll
Copy link
Copy Markdown

jimmbelll commented Apr 19, 2026

We can attempt to debug this. If you are able to upload results, tell me the filenames (and dates and sizes, although not really required) and I will run locate on the server to see if they are present.

Great to hear. I have a regression result that uploaded early afternoon, file name jcbell-msys2-mingw-w64.zip ; I see that the master matrix has updated since but has not picked up my result. Hopefully that gives you enough to go on. (Update: it's just testing two libraries for a faster run: asio & accumulators.)

I did have to work through the master branch jamfile failure that @teeks99 mentions above. I'll do pull req on that after this is resolved. Very small change.

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 19, 2026 via email

@jimmbelll
Copy link
Copy Markdown

@teeks99 How difficult is it for you to switch all your regressions to python 3? Which 3.x version would you run?

As you may know, python has lots of evolution (and deprecation) throughout 3.x. Not sure how much it affects this code, but also not sure how much effort should go into staying compatible with 2.x, especially pre-2.7, and even pre 3.9. (Does boost have a policy here?)

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Apr 19, 2026

I'd love to switch to python 3, hence why I started this incomplete MR. It would take a small amount of time to switch over and would save me a ton of time not having to build python2 from source for inclusion in my runner images.

I would like support for a fairly old version of python 3. I have ubuntu trusty images that still run tests on gcc-6, and that comes with python 3.4 has support for python 3.5, so no f-strings :-(

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 19, 2026

There's no need to use Trusty for anything anymore, much less GCC 6.

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Apr 20, 2026

I'm sure I could find a different way such as building gcc6 from scratch, but I have it working with trusty now, and would kind of like to leave it alone.

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 20, 2026

GCC 6 is available on Ubuntu 18.04 via apt-get from the built-in repos.

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Apr 20, 2026

I've confirmed that I can update my images to 18.04 and keep the existing gcc runs. That gives us python 3.8.

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 20, 2026

Before, boost_wide_report.py matched:

    '.*jc-bell',

now adding this:

    'jcbell-.*',

The effect is that the jcbell zip file is uploaded, ingested, unzipped, and available on the website. Many files such as:

https://regression.boost.org/master/jcbell-msys2-mingw-w64.html
https://regression.boost.org/master/developer/output/jcbell-msys2-mingw-w64-boost-bin-v2-libs-date_time-build-gcc-13-dbg-x86_6-dbg-symbl-off-thrdp-wn32-thrd-mlt-vsblt-hdn-gregorian.html

That is progress, step by step.

The summary page still doesn't update. However the page is generated during CI and the contents are the same as what's shown: https://regression.boost.org/master/developer/summary.html

CI: https://app.circleci.com/pipelines/github/boostorg/regression

It would be helpful to upload all the master branch files, and debug the master branch, why have those stopped?

In terms of upgrading python, most of the progress so far has been to "Simultaneous support for Python 2 and Python 3", and that seems like a natural strategy, because then you don't have to be overly concerned about scheduling or cut-over methods or migrating containers. The PR can be merged whenever it's working. Convenient. Just complete the steps of "Simultaneous support for Python 2 and Python 3". It's almost done. After a transition there could be further work to improve and optimize scripts. At that point abandon Python 2 or break compatibility with Python2, but that happens later.

@jimmbelll
Copy link
Copy Markdown

Before, boost_wide_report.py matched:

    '.*jc-bell',

n

Ok, wow, I had no idea there was such a specific/narrow list of matches. Seems fragile (my case), and like it discourages new testers pretty much by design. I can imagine malicious uploads (and you may want to scrub the URL from your comment above mentioning it). Is that the rationale? Is there a history of such? If so, can we filter by content (markers in the file) vs. a name match like this?

Also, a technique to obscure the upload URL in the source code might be helpful, since github makes the source more available than in the olden days. With python you can do it on import with a technique limited only by your imagination. A fun puzzle.

@jimmbelll
Copy link
Copy Markdown

jimmbelll commented Apr 20, 2026

It would be helpful to upload all the master branch files, and debug the master branch, why have those stopped?

Seems like you alone have the permission to do this. I'm glad to look at a log if that helps.

migrating containers. The PR can be merged whenever it's working. Convenient. Just complete the steps of "Simultaneous support for Python 2 and Python 3". It's almost done.

My PR forked from this will have all fixes in it, and I'll submit it after the master branch debug. I'm a git novice: I'd love to somehow merge mine with this PR to link it with this discussion. What's the git magic to achieve that?

Also, @teeks99 I'd love for you to drop my set of changes into your environment(s) for your runs before the merge. As you know with python, there's no substitute for running it. And maybe then you update your fork and this is the PR after all.

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 20, 2026

Seems like you alone have the permission to do this. I'm glad to look at a log if that helps.

The builds depend on test results being uploaded to results.boost.org. Here is how the upload directory looks for the 'develop' branch:

...
-rw-r--r-- 1 ftp nogroup 5878091 Apr 20 09:59 teeks99-dkr-dg15-23.zip
-rw-r--r-- 1 ftp nogroup 2854510 Apr 20 11:28 teeks99-dkr-dc6-17.zip
-rw-r--r-- 1 ftp nogroup 9344239 Apr 20 14:11 teeks99-05-dg8-2a-32onarmv7l.zip
-rw-r--r-- 1 ftp nogroup 4822821 Apr 20 15:23 teeks99-dkr-dc7-17.zip
-rw-r--r-- 1 ftp nogroup 6710547 Apr 20 16:07 teeks99-dkr-arm64-dg14-20.zip
-rw-r--r-- 1 ftp nogroup 5255575 Apr 20 16:46 teeks99-09-v17d-64onAMD64.zip

It's full of recent uploads.

And then on master:

...
-rw-r--r-- 1 ftp nogroup 4622875 Dec 11 03:25 teeks99-06-mc15-2b-64onaarch64.zip
-rw-r--r-- 1 ftp nogroup 8092735 Dec 11 03:25 teeks99-05-mg8-2a-32onarmv7l.zip
-rw-r--r-- 1 ftp nogroup 4928021 Dec 11 03:25 teeks99-05-mg13-20-64onriscv64.zip
-rw-r--r-- 1 ftp nogroup  442588 Dec 11 03:25 teeks99-05-mc9-2a-32onarmv7l.zip
-rw-r--r-- 1 ftp nogroup 4551887 Dec 11 03:25 teeks99-01-mg13-20-64onriscv64.zip
-rw-r--r-- 1 ftp nogroup 4539172 Dec 11 03:25 teeks99-01-mc17-20-64onriscv64.zip
drwxr-xr-x 2 ftp nogroup   12288 Feb 10 14:31 .
drwxr-xr-x 6 ftp nogroup    4096 Feb 10 15:01 ..
-rw-r--r-- 1 ftp nogroup   57309 Apr 18 19:29 jcbell-msys2-mingw-w64.zip

Nothing since Dec, and those might be from the server migration, and actually be even older.

The existing python scripts filter and only use the last 1 month worth of data, so the information from December would be excluded and not shown.

This explains the current situation, right? teeks99 is not uploading any data. That is presumably due to a build error. It should be reported and analyzed and tested, maybe here, or in the boostorg/boost github repository.

Then, log files are visible at https://app.circleci.com/pipelines/github/boostorg/regression . It's another important component to analyze. But for now, secondary to the known issue above.

merge mine

"Maintainers are allowed to edit this pull request." If you are a maintainer of a repo, you can directly modify a PR, and add more commits directly. However, it's probably safer to open a separate parallel PR, if you are an admitted "git novice". :-) No problem. And it's not particularly worse. We can just merge the newer pull request.

@jimmbelll
Copy link
Copy Markdown

This explains the current situation, right? teeks99 is not uploading any data. That is presumably due to a build error. It should be reported and analyzed and tested, maybe here, or in the boostorg/boost github repository.

Yes. The master branch jamfile issue is a show-stopper, halting the regression, and I have a fix.

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 20, 2026

I don't understand why you're encountering this issue and I am not. What is your fix?

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 20, 2026

Ah, I see it. It's not the same issue.

error: Unable to find file or target named
error:     '../../system/build'
error: referred to from project at
error:     '../libs/graph/test'

This is graph, not graph_parallel.

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 20, 2026

boostorg/graph#477

@jimmbelll
Copy link
Copy Markdown

jimmbelll commented Apr 20, 2026

Ah, I see it. It's not the same issue.

error: Unable to find file or target named
error:     '../../system/build'
error: referred to from project at
error:     '../libs/graph/test'

This is graph, not graph_parallel.

Yes: two instances of '../../system/build' near each other, only references in the file. That directory doesn't exist, but '../../filesystem/build' right next to it does, and doesn't error.

This halts b2 (bjam) immediately. With this change all libraries seem to process.

@jimmbelll
Copy link
Copy Markdown

Good news! The master matrix updated with my two tests successfully! And results look sane. (Note that the Release View and User View links at the very top give 404 errors.)

Then, log files are visible at https://app.circleci.com/pipelines/github/boostorg/regression . It's another important component to analyze.

I'm not sure what I'm looking at here, but some observations:

  • The branches filter (3rd of the four filter buttons just above the results list) has a develop branch but no master branch. Others are ci/test-reports, ci/test-reports-circle2, danieljames-patch-1. Is this where master should be?
  • The develop branch has four results which all say ERROR IN CONFIG FILE: [#] required key [jobs] not found.
  • I don't see anything in any log that looks like python code tried walking a directory and unzipping a file, which is what I'd expect. Neither my file nor any of @teeks99 develop files which are clearly still working.

What's the relationship between this circleci "pipeline" and the matrix-building code running on the server?

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 21, 2026

The design of boostorg/regression is extremely unusual. The relevant scripts are strewn across all those branches: develop, ci/test-reports, ci/test-reports-circle2, . No master branch exists. Nor should it, necessarily, based on the current configuration. There is no correlation between processing boostorg libraries and the master branch of boostorg/regression.

If you examine files in develop and ci/test-reports, I believe most of the logic can be found in the python scripts.

The actions which occur are distributed between the CircleCI jobs, and the server itself. Most processing happens in CircleCI. But not everything. The server will extract zip files, and copy them to an html directory for web hosting. Actually... even that step is done through CircleCI.

@jimmbelll
Copy link
Copy Markdown

Actually... even that step is done through CircleCI.

So, specifically, when regression/reports/src/boost_wide_report.py line 115 executes

    utils.log( "listing source content" )

Where exactly does that message wind up? A bit off topic but very useful information.

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 21, 2026

Where exactly does that message wind up?

It's in the CircleCI output.
The log file. See screenshot.
On the 26 minute job click the far right button to 'download' the file locally.

Screenshot from 2026-04-21 20-04-27

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.

Support python 3

4 participants