diff --git a/.github/workflows/release-validation.yml b/.github/workflows/release-validation.yml index 0e0a64343..1455fbce9 100644 --- a/.github/workflows/release-validation.yml +++ b/.github/workflows/release-validation.yml @@ -18,11 +18,14 @@ #--> # Validates the Apache release pipeline on every PR: builds the real release # artifacts (git archive, sdist, wheel) using the release script with -# --skip-signing, runs Apache RAT on the source tarball, then installs the -# wheel into a fresh venv outside the source tree and smoke-tests the server. +# --skip-signing, runs Apache RAT on the source tarball, checks that +# LICENSE-wheel still covers the npm packages bundled into the compiled UI, +# then installs the wheel into a fresh venv outside the source tree and +# smoke-tests the server. # # This is designed to catch the class of bugs that have broken recent RCs: -# license/header issues (RAT), examples missing from the wheel (smoke test), +# license/header issues (RAT), a LICENSE-wheel that no longer matches the +# bundled UI dependencies, examples missing from the wheel (smoke test), # and general "voter tries to install this and it breaks" failures. name: Release Validation @@ -142,6 +145,14 @@ jobs: test -f "dist/apache-burr-${BURR_VERSION}-incubating-sdist.tar.gz" test -f "dist/apache_burr-${BURR_VERSION}-py3-none-any.whl" + # RAT excludes burr/tracking/server/build/**, so it never inspects the + # compiled UI -- the only content the wheel adds over the sdist. This + # step covers that gap: it re-derives the bundled npm packages from a + # sourcemap build and fails if LICENSE-wheel no longer matches, which + # is what silently drifts on a dependency bump. + - name: Check LICENSE-wheel covers the bundled UI dependencies + run: python scripts/generate_wheel_license.py --check + - name: Run Apache RAT on source and sdist tarballs run: | python scripts/verify_apache_artifacts.py licenses \ diff --git a/LICENSE-wheel b/LICENSE-wheel index 476a56a5b..4f9c59522 100644 --- a/LICENSE-wheel +++ b/LICENSE-wheel @@ -226,3 +226,794 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +====================================================================== +THIRD-PARTY COMPONENTS BUNDLED IN THIS BINARY DISTRIBUTION +(generated by scripts/generate_wheel_license.py -- do not edit by hand) +====================================================================== + +The file burr/tracking/server/build/assets/index-*.js in this wheel is +a compiled bundle produced from telemetry/ui. In addition to Apache +Burr's own source, it contains code from the third-party packages +listed below, under the licenses shown. None of these packages ships +a NOTICE file, so no NOTICE content is carried over from them. + +---------------------------------------------------------------------- +The following components are licensed under the Apache-2.0 license: + + @react-aria/focus@3.18.3 + [no license file shipped; declared as Apache-2.0 in package.json] + @react-aria/interactions@3.22.3 + [no license file shipped; declared as Apache-2.0 in package.json] + @react-aria/utils@3.25.3 + [no license file shipped; declared as Apache-2.0 in package.json] + +---------------------------------------------------------------------- +The following components are licensed under the BSD-3-Clause license: + + d3-ease@3.0.1 + Copyright 2010-2021 Mike Bostock + Copyright 2001 Robert Penner + hoist-non-react-statics@3.3.2 + Copyright (c) 2015, Yahoo! Inc. All rights reserved. + + --- BSD-3-Clause license text (variant 1) --- + + Copyright 2010-2021 Mike Bostock + Copyright 2001 Robert Penner + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted 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 author nor the names of contributors may be used to + endorse or promote products derived from this software without specific prior + written permission. + + 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 OWNER 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. + + --- BSD-3-Clause license text (variant 2) --- + + Software License Agreement (BSD License) + ======================================== + + Copyright (c) 2015, Yahoo! Inc. All rights reserved. + ---------------------------------------------------- + + Redistribution and use of this software in source and binary forms, with or + without modification, are permitted 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 Yahoo! Inc. nor the names of YUI's contributors may be + used to endorse or promote products derived from this software without + specific prior written permission of Yahoo! Inc. + + 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 OWNER 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. + +---------------------------------------------------------------------- +The following components are licensed under the ISC license: + + @ungap/structured-clone@1.2.0 + Copyright (c) 2021, Andrea Giammarchi, @WebReflection + copyright notice and this permission notice appear in all copies. + d3-color@3.1.0 + Copyright 2010-2022 Mike Bostock + d3-dispatch@3.0.1 + Copyright 2010-2021 Mike Bostock + d3-drag@3.0.0 + Copyright 2010-2021 Mike Bostock + d3-interpolate@3.0.1 + Copyright 2010-2021 Mike Bostock + d3-selection@3.0.0 + Copyright 2010-2021 Mike Bostock + d3-timer@3.0.1 + Copyright 2010-2021 Mike Bostock + d3-transition@3.0.1 + Copyright 2010-2021 Mike Bostock + d3-zoom@3.0.0 + Copyright 2010-2021 Mike Bostock + + --- ISC license text (variant 1) --- + + ISC License + + Copyright (c) 2021, Andrea Giammarchi, @WebReflection + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + + --- ISC license text (variant 2) --- + + Copyright 2010-2022 Mike Bostock + + Permission to use, copy, modify, and/or distribute this software for any purpose + with or without fee is hereby granted, provided that the above copyright notice + and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + +---------------------------------------------------------------------- +The following components are licensed under the MIT license: + + @babel/runtime@7.29.7 + Copyright (c) 2014-present Sebastian McKenzie and other contributors + @emotion/cache@11.11.0 + Copyright (c) Emotion team and other contributors + @emotion/hash@0.9.1 + Copyright (c) Emotion team and other contributors + @emotion/memoize@0.8.1 + Copyright (c) Emotion team and other contributors + @emotion/react@11.11.4 + Copyright (c) Emotion team and other contributors + @emotion/serialize@1.1.3 + Copyright (c) Emotion team and other contributors + @emotion/sheet@1.2.2 + Copyright (c) Emotion team and other contributors + @emotion/unitless@0.8.1 + Copyright (c) Emotion team and other contributors + @emotion/use-insertion-effect-with-fallbacks@1.0.1 + Copyright (c) Emotion team and other contributors + @emotion/utils@1.2.1 + Copyright (c) Emotion team and other contributors + @floating-ui/dom@1.6.3 + Copyright (c) 2021-present Floating UI contributors + @floating-ui/utils@0.2.8 + Copyright (c) 2021-present Floating UI contributors + @headlessui/react@2.1.9 + Copyright (c) 2020 Tailwind Labs + @heroicons/react@2.1.1 + [no license file shipped; declared as MIT in package.json] + @reactflow/controls@11.2.9 + Copyright (c) 2019-2023 webkid GmbH + @reactflow/core@11.10.4 + Copyright (c) 2019-2023 webkid GmbH + @tisoap/react-flow-smart-edge@3.0.0 + Copyright (c) 2021 Tiso Alvarez Puccinelli + @uiw/react-json-view@2.0.0-alpha.12 + [no license file shipped; declared as MIT in package.json] + bail@2.0.2 + Copyright (c) 2015 Titus Wormer + ccount@2.0.1 + Copyright (c) 2015 Titus Wormer + character-entities-legacy@3.0.0 + Copyright (c) 2015 Titus Wormer + character-reference-invalid@2.0.1 + Copyright (c) 2015 Titus Wormer + classcat@5.0.4 + Copyright © Jorge Bucaran <> + clsx@2.1.0 + Copyright (c) Luke Edwards (lukeed.com) + comma-separated-tokens@2.0.3 + Copyright (c) 2016 Titus Wormer + dagre@0.8.5 + Copyright (c) 2012-2014 Chris Pettitt + decode-named-character-reference@1.0.2 + Copyright (c) 2021 Titus Wormer + escape-string-regexp@5.0.0 + Copyright (c) Sindre Sorhus (https://sindresorhus.com) + estree-util-is-identifier-name@3.0.0 + Copyright (c) 2020 Titus Wormer + extend@3.0.2 + Copyright (c) 2014 Stefan Thomas + graphlib@2.1.8 + Copyright (c) 2012-2014 Chris Pettitt + hast-util-parse-selector@4.0.0 + Copyright (c) 2016 Titus Wormer + hast-util-to-jsx-runtime@2.3.0 + Copyright (c) 2023 Titus Wormer + hast-util-whitespace@3.0.0 + Copyright (c) 2016 Titus Wormer + hastscript@9.0.1 + Copyright (c) Titus Wormer + html-url-attributes@3.0.0 + [no license file shipped; declared as MIT in package.json] + inline-style-parser@0.2.2 + [no license file shipped; declared as MIT in package.json] + is-alphabetical@2.0.1 + Copyright (c) 2016 Titus Wormer + is-alphanumerical@2.0.1 + Copyright (c) 2016 Titus Wormer + is-decimal@2.0.1 + Copyright (c) 2016 Titus Wormer + is-hexadecimal@2.0.1 + Copyright (c) 2016 Titus Wormer + is-plain-obj@4.1.0 + Copyright (c) Sindre Sorhus (https://sindresorhus.com) + lodash@4.18.1 + Copyright OpenJS Foundation and other contributors + Copyright and related rights for sample code are waived via CC0. Sample + longest-streak@3.1.0 + Copyright (c) 2015 Titus Wormer + markdown-table@3.0.3 + Copyright (c) 2014 Titus Wormer + mdast-util-find-and-replace@3.0.1 + Copyright (c) 2020 Titus Wormer + mdast-util-from-markdown@2.0.0 + Copyright (c) 2020 Titus Wormer + mdast-util-gfm@3.0.0 + Copyright (c) 2020 Titus Wormer + mdast-util-gfm-autolink-literal@2.0.0 + Copyright (c) 2020 Titus Wormer + mdast-util-gfm-footnote@2.0.0 + Copyright (c) 2021 Titus Wormer + mdast-util-gfm-strikethrough@2.0.0 + Copyright (c) 2020 Titus Wormer + mdast-util-gfm-table@2.0.0 + Copyright (c) 2020 Titus Wormer + mdast-util-gfm-task-list-item@2.0.0 + Copyright (c) 2020 Titus Wormer + mdast-util-phrasing@4.1.0 + Copyright (c) 2017 Titus Wormer + Copyright (c) 2017 Victor Felder + mdast-util-to-hast@13.1.0 + Copyright (c) 2016 Titus Wormer + mdast-util-to-markdown@2.1.0 + Copyright (c) 2020 Titus Wormer + mdast-util-to-string@4.0.0 + Copyright (c) 2015 Titus Wormer + memoize-one@6.0.0 + Copyright (c) 2019 Alexander Reardon + micromark@4.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-core-commonmark@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-extension-gfm@3.0.0 + Copyright (c) 2020 Titus Wormer + micromark-extension-gfm-autolink-literal@2.0.0 + Copyright (c) 2020 Titus Wormer + micromark-extension-gfm-footnote@2.0.0 + Copyright (c) 2021 Titus Wormer + micromark-extension-gfm-strikethrough@2.0.0 + Copyright (c) 2020 Titus Wormer + micromark-extension-gfm-table@2.0.0 + Copyright (c) 2020 Titus Wormer + micromark-extension-gfm-task-list-item@2.0.1 + Copyright (c) 2020 Titus Wormer + micromark-factory-destination@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-factory-label@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-factory-space@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-factory-title@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-factory-whitespace@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-character@2.1.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-chunked@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-classify-character@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-combine-extensions@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-decode-numeric-character-reference@2.0.1 + [no license file shipped; declared as MIT in package.json] + micromark-util-decode-string@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-html-tag-name@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-normalize-identifier@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-resolve-all@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-sanitize-uri@2.0.0 + [no license file shipped; declared as MIT in package.json] + micromark-util-subtokenize@2.0.0 + [no license file shipped; declared as MIT in package.json] + parse-entities@4.0.2 + Copyright (c) Titus Wormer + pathfinding@0.4.18 + [no license file shipped; declared as MIT in package.json] + property-information@7.2.0 + Copyright (c) Titus Wormer + react@18.2.0 + Copyright (c) Facebook, Inc. and its affiliates. + react-dom@18.2.0 + Copyright (c) Facebook, Inc. and its affiliates. + react-icons@5.0.1 + Copyright 2018 kamijin_fanta + react-is@16.13.1 + Copyright (c) Facebook, Inc. and its affiliates. + react-markdown@9.0.1 + Copyright (c) 2015 Espen Hovlandsdal + react-query@3.39.3 + Copyright (c) 2019 Tanner Linsley + react-router@7.18.1 + Copyright (c) React Training LLC 2015-2019 + Copyright (c) Remix Software Inc. 2020-2021 + Copyright (c) Shopify Inc. 2022-2023 + react-select@5.8.1 + [no license file shipped; declared as MIT in package.json] + react-syntax-highlighter@16.1.1 + Copyright (c) 2019 Conor Hastings + refractor@5.0.0 + Copyright (c) Titus Wormer + Copyright (c) Lea Verou + remark-gfm@4.0.0 + Copyright (c) 2020 Titus Wormer + remark-parse@11.0.0 + Copyright (c) 2014 Titus Wormer + remark-rehype@11.1.0 + Copyright (c) 2016 Titus Wormer + scheduler@0.23.0 + Copyright (c) Facebook, Inc. and its affiliates. + space-separated-tokens@2.0.2 + Copyright (c) 2016 Titus Wormer + style-to-object@1.0.5 + Copyright (c) 2017 Menglin "Mark" Xu + stylis@4.2.0 + Copyright (c) 2016-present Sultan Tarimo + trim-lines@3.0.1 + Copyright (c) 2015 Titus Wormer + trough@2.2.0 + Copyright (c) 2016 Titus Wormer + unified@11.0.4 + Copyright (c) 2015 Titus Wormer + unist-util-is@6.0.0 + Copyright (c) 2015 Titus Wormer + unist-util-position@5.0.0 + Copyright (c) 2015 Titus Wormer + unist-util-stringify-position@4.0.0 + Copyright (c) 2016 Titus Wormer + unist-util-visit@5.0.0 + Copyright (c) 2015 Titus Wormer + unist-util-visit-parents@6.0.1 + Copyright (c) 2016 Titus Wormer + use-isomorphic-layout-effect@1.1.2 + Copyright (c) Mateusz Burzyński + use-sync-external-store@1.2.0 + Copyright (c) Facebook, Inc. and its affiliates. + vfile@6.0.1 + Copyright (c) 2015 Titus Wormer + vfile-message@4.0.2 + Copyright (c) 2017 Titus Wormer + zustand@4.5.1 + Copyright (c) 2019 Paul Henschel + + --- MIT license text (variant 1) --- + + MIT License + + Copyright (c) 2014-present Sebastian McKenzie and other contributors + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + --- MIT license text (variant 2) --- + + MIT License + + Copyright (c) Emotion team and other contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + --- MIT license text (variant 3) --- + + MIT License + + Copyright (c) 2021-present Floating UI contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + --- MIT license text (variant 4) --- + + (The MIT License) + + Copyright (c) 2015 Titus Wormer + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + 'Software'), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + --- MIT license text (variant 5) --- + + Copyright © Jorge Bucaran <> + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + --- MIT license text (variant 6) --- + + MIT License + + Copyright (c) Luke Edwards (lukeed.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + --- MIT license text (variant 7) --- + + Copyright (c) 2012-2014 Chris Pettitt + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + --- MIT license text (variant 8) --- + + The MIT License (MIT) + + Copyright (c) 2014 Stefan Thomas + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + --- MIT license text (variant 9) --- + + Copyright OpenJS Foundation and other contributors + + Based on Underscore.js, copyright Jeremy Ashkenas, + DocumentCloud and Investigative Reporters & Editors + + This software consists of voluntary contributions made by many + individuals. For exact contribution history, see the revision history + available at https://github.com/lodash/lodash + + The following license applies to all parts of this software except as + documented below: + + ==== + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + ==== + + Copyright and related rights for sample code are waived via CC0. Sample + code is defined as all source code displayed within the prose of the + documentation. + + CC0: http://creativecommons.org/publicdomain/zero/1.0/ + + ==== + + Files located in the node_modules and vendor directories are externally + maintained libraries used by this software which have their own + licenses; we recommend you read them, as their terms may differ from the + terms above. + + --- MIT license text (variant 10) --- + + Copyright 2018 kamijin_fanta + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + --- + Icons are taken from the other projects + so please check each project licences accordingly. + + Circum Icons - https://circumicons.com/ + License: MPL-2.0 license https://github.com/Klarr-Agency/Circum-Icons/blob/main/LICENSE + + Font Awesome 5 - https://fontawesome.com/ + License: CC BY 4.0 License https://creativecommons.org/licenses/by/4.0/ + + Font Awesome 6 - https://fontawesome.com/ + License: CC BY 4.0 License https://creativecommons.org/licenses/by/4.0/ + + Ionicons 4 - https://ionicons.com/ + License: MIT https://github.com/ionic-team/ionicons/blob/master/LICENSE + + Ionicons 5 - https://ionicons.com/ + License: MIT https://github.com/ionic-team/ionicons/blob/master/LICENSE + + Material Design icons - http://google.github.io/material-design-icons/ + License: Apache License Version 2.0 https://github.com/google/material-design-icons/blob/master/LICENSE + + Typicons - http://s-ings.com/typicons/ + License: CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0/ + + Github Octicons icons - https://octicons.github.com/ + License: MIT https://github.com/primer/octicons/blob/master/LICENSE + + Feather - https://feathericons.com/ + License: MIT https://github.com/feathericons/feather/blob/master/LICENSE + + Lucide - https://lucide.dev/ + License: ISC https://github.com/lucide-icons/lucide/blob/main/LICENSE + + Game Icons - https://game-icons.net/ + License: CC BY 3.0 https://creativecommons.org/licenses/by/3.0/ + + Weather Icons - https://erikflowers.github.io/weather-icons/ + License: SIL OFL 1.1 http://scripts.sil.org/OFL + + Devicons - https://vorillaz.github.io/devicons/ + License: MIT https://opensource.org/licenses/MIT + + Ant Design Icons - https://github.com/ant-design/ant-design-icons + License: MIT https://opensource.org/licenses/MIT + + Bootstrap Icons - https://github.com/twbs/icons + License: MIT https://opensource.org/licenses/MIT + + Remix Icon - https://github.com/Remix-Design/RemixIcon + License: Apache License Version 2.0 http://www.apache.org/licenses/ + + Flat Color Icons - https://github.com/icons8/flat-color-icons + License: MIT https://opensource.org/licenses/MIT + + Grommet-Icons - https://github.com/grommet/grommet-icons + License: Apache License Version 2.0 http://www.apache.org/licenses/ + + Heroicons - https://github.com/tailwindlabs/heroicons + License: MIT https://opensource.org/licenses/MIT + + Heroicons 2 - https://github.com/tailwindlabs/heroicons + License: MIT https://opensource.org/licenses/MIT + + Simple Icons - https://simpleicons.org/ + License: CC0 1.0 Universal https://creativecommons.org/publicdomain/zero/1.0/ + + Simple Line Icons - https://thesabbir.github.io/simple-line-icons/ + License: MIT https://opensource.org/licenses/MIT + + IcoMoon Free - https://github.com/Keyamoon/IcoMoon-Free + License: CC BY 4.0 License https://github.com/Keyamoon/IcoMoon-Free/blob/master/License.txt + + BoxIcons - https://github.com/atisawd/boxicons + License: MIT https://github.com/atisawd/boxicons/blob/master/LICENSE + + css.gg - https://github.com/astrit/css.gg + License: MIT https://opensource.org/licenses/MIT + + VS Code Icons - https://github.com/microsoft/vscode-codicons + License: CC BY 4.0 https://creativecommons.org/licenses/by/4.0/ + + Tabler Icons - https://github.com/tabler/tabler-icons + License: MIT https://opensource.org/licenses/MIT + + Themify Icons - https://github.com/lykmapipo/themify-icons + License: MIT https://github.com/thecreation/standard-icons/blob/master/modules/themify-icons/LICENSE + + Radix Icons - https://icons.radix-ui.com + License: MIT https://github.com/radix-ui/icons/blob/master/LICENSE + + Phosphor Icons - https://github.com/phosphor-icons/core + License: MIT https://github.com/phosphor-icons/core/blob/main/LICENSE + + Icons8 Line Awesome - https://icons8.com/line-awesome + License: MIT https://github.com/icons8/line-awesome/blob/master/LICENSE.md + + --- MIT license text (variant 11) --- + + The MIT License (MIT) + + Copyright (c) 2015 Espen Hovlandsdal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + --- MIT license text (variant 12) --- + + (The MIT License) + + Copyright (c) 2014 Titus Wormer + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + --- MIT license text (variant 13) --- + + (The MIT license) + + Copyright (c) 2015 Titus Wormer + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + 'Software'), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +---------------------------------------------------------------------- +The following components are licensed under the PSF license: + + heap@0.2.5 + [no license file shipped; declared as PSF in package.json] diff --git a/burr/tracking/server/run.py b/burr/tracking/server/run.py index 9bd6cba93..da5b8b965 100644 --- a/burr/tracking/server/run.py +++ b/burr/tracking/server/run.py @@ -342,15 +342,20 @@ async def get_indexing_jobs( @ui_app.get("/api/v0/version") async def version() -> dict: """Returns the burr version""" - import pkg_resources + # importlib.metadata rather than pkg_resources: setuptools is not a + # declared dependency, is absent from a modern venv, and dropped + # pkg_resources in 81.0. Using it here made this endpoint raise + # ModuleNotFoundError on a clean install. + from importlib.metadata import PackageNotFoundError + from importlib.metadata import version as _version try: - burr_version = pkg_resources.get_distribution("apache-burr").version - except pkg_resources.DistributionNotFound: + burr_version = _version("apache-burr") + except PackageNotFoundError: try: # Fallback for older installations or development - burr_version = pkg_resources.get_distribution("burr").version - except pkg_resources.DistributionNotFound: + burr_version = _version("burr") + except PackageNotFoundError: burr_version = "unknown" return {"version": burr_version} diff --git a/scripts/generate_wheel_license.py b/scripts/generate_wheel_license.py new file mode 100644 index 000000000..1ab3ccc05 --- /dev/null +++ b/scripts/generate_wheel_license.py @@ -0,0 +1,290 @@ +#!/usr/bin/env python3 +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""Generate the third-party section of LICENSE-wheel. + +The wheel ships one piece of content that is not Burr source: the compiled +tracking UI at ``burr/tracking/server/build/assets/index-*.js``. That bundle +contains code from a large number of npm packages, and ASF policy requires +the binary distribution's LICENSE to reflect what the binary actually +contains. + +Rather than maintain that list by hand (it drifts silently on every +dependency bump), this script derives it from the build itself: it asks vite +for a sourcemap, reads the ``sources`` array to find every ``node_modules`` +file that was compiled into the bundle, resolves each one to its owning +package, and emits a license section listing each package with its license +and copyright. + +Everything in LICENSE-wheel above the generated marker is hand-maintained and +left untouched; everything from the marker to end-of-file is regenerated. + +Usage:: + + # regenerate LICENSE-wheel in place (requires telemetry/ui/node_modules) + python scripts/generate_wheel_license.py + + # fail if LICENSE-wheel is out of date -- for CI + python scripts/generate_wheel_license.py --check + + # reuse a sourcemap from an earlier build instead of rebuilding + python scripts/generate_wheel_license.py --sourcemap path/to/index-XXXX.js.map +""" + +from __future__ import annotations + +import argparse +import collections +import glob +import json +import os +import re +import shutil +import subprocess +import sys +import tempfile + +REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +UI_DIR = os.path.join(REPO_ROOT, "telemetry", "ui") +LICENSE_WHEEL = os.path.join(REPO_ROOT, "LICENSE-wheel") + +MARKER = "THIRD-PARTY COMPONENTS BUNDLED IN THIS BINARY DISTRIBUTION" +RULE = "=" * 70 +SEPARATOR = "-" * 70 + +COPYRIGHT_RE = re.compile(r"^.*copyright.*$", re.IGNORECASE | re.MULTILINE) + + +def build_sourcemap(out_dir: str) -> str: + """Run a sourcemap build of the UI and return the path to the JS map.""" + if not os.path.isdir(os.path.join(UI_DIR, "node_modules")): + sys.exit( + f"error: {UI_DIR}/node_modules is missing.\n" + "Run `npm ci` in telemetry/ui first, or pass --sourcemap." + ) + subprocess.run( + ["npx", "vite", "build", "--sourcemap", "--outDir", out_dir], + cwd=UI_DIR, + check=True, + stdout=subprocess.DEVNULL, + ) + maps = glob.glob(os.path.join(out_dir, "assets", "*.js.map")) + if not maps: + sys.exit(f"error: no .js.map produced under {out_dir}/assets") + return max(maps, key=os.path.getsize) + + +def bundled_packages(sourcemap_path: str) -> dict[str, str]: + """Map package name -> package root for everything compiled into the bundle.""" + sourcemap = json.load(open(sourcemap_path, encoding="utf-8")) + base = os.path.dirname(os.path.abspath(sourcemap_path)) + found: dict[str, str] = {} + for source in sourcemap.get("sources", []): + if "node_modules/" not in source: + continue + directory = os.path.dirname(os.path.normpath(os.path.join(base, source))) + # Climb to the package root. Some packages ship stub package.json files + # in subdirectories (@babel/runtime/helpers/esm, react-icons/fa) that + # carry no "name" -- keep climbing until a named one turns up. + while "node_modules" in directory: + manifest = os.path.join(directory, "package.json") + if os.path.exists(manifest): + try: + name = json.load(open(manifest, encoding="utf-8")).get("name") + except (OSError, ValueError): + name = None + if name: + found.setdefault(name, directory) + break + directory = os.path.dirname(directory) + return found + + +def read_package(name: str, directory: str) -> dict: + manifest = json.load(open(os.path.join(directory, "package.json"), encoding="utf-8")) + license_id = manifest.get("license") or manifest.get("licenses") or "UNKNOWN" + if isinstance(license_id, list): + license_id = ",".join( + entry.get("type", str(entry)) if isinstance(entry, dict) else str(entry) + for entry in license_id + ) + if isinstance(license_id, dict): + license_id = license_id.get("type", "UNKNOWN") + + text = None + for filename in sorted(os.listdir(directory)): + if filename.upper().split(".")[0] in ("LICENSE", "LICENCE", "COPYING"): + try: + text = open( + os.path.join(directory, filename), encoding="utf-8", errors="replace" + ).read() + except OSError: + text = None + break + + return { + "name": name, + "version": manifest.get("version", ""), + "license": str(license_id), + "text": text, + } + + +def copyright_lines(text: str | None) -> list[str]: + if not text: + return [] + out = [] + for line in COPYRIGHT_RE.findall(text): + line = line.strip().strip("*").strip() + # Skip all-caps fragments of the warranty disclaimer, which also + # contain the word COPYRIGHT ("...COPYRIGHT HOLDERS BE LIABLE..."). + if not line or line.isupper() or "copyright ownership" in line.lower(): + continue + if line.lower().startswith(("copyright", "(c)", "©")): + out.append(line) + seen: set[str] = set() + return [line for line in out if not (line in seen or seen.add(line))] + + +def canonical_text(text: str | None) -> str: + """License body with copyright lines stripped, so identical bodies collapse.""" + if not text: + return "" + body = " ".join(line for line in text.splitlines() if not COPYRIGHT_RE.match(line)) + return re.sub(r"\s+", " ", body).strip() + + +def render(packages: list[dict]) -> str: + by_license: dict[str, list[dict]] = collections.defaultdict(list) + for package in packages: + by_license[package["license"]].append(package) + + lines: list[str] = [] + emit = lines.append + emit(RULE) + emit(MARKER) + emit("(generated by scripts/generate_wheel_license.py -- do not edit by hand)") + emit(RULE) + emit("") + emit("The file burr/tracking/server/build/assets/index-*.js in this wheel is") + emit("a compiled bundle produced from telemetry/ui. In addition to Apache") + emit("Burr's own source, it contains code from the third-party packages") + emit("listed below, under the licenses shown. None of these packages ships") + emit("a NOTICE file, so no NOTICE content is carried over from them.") + emit("") + + for license_id in sorted(by_license): + group = sorted(by_license[license_id], key=lambda p: p["name"]) + emit(SEPARATOR) + emit(f"The following components are licensed under the {license_id} license:") + emit("") + for package in group: + if package["text"]: + emit(f" {package['name']}@{package['version']}") + else: + emit(f" {package['name']}@{package['version']}") + emit(f" [no license file shipped; declared as {license_id} in package.json]") + for line in copyright_lines(package["text"])[:3]: + emit(f" {line}") + emit("") + + bodies: dict[str, str] = {} + for package in group: + if package["text"]: + bodies.setdefault(canonical_text(package["text"]), package["text"]) + for index, body in enumerate(bodies.values(), 1): + label = f"{license_id} license text" + if len(bodies) > 1: + label += f" (variant {index})" + emit(f" --- {label} ---") + emit("") + for line in body.rstrip().splitlines(): + emit(f" {line}" if line.strip() else "") + emit("") + + return "\n".join(lines).rstrip() + "\n" + + +def splice(existing: str, generated: str) -> str: + """Replace everything from the generated marker onward.""" + index = existing.find(RULE + "\n" + MARKER) + head = existing if index == -1 else existing[:index] + return head.rstrip() + "\n\n" + generated + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--check", + action="store_true", + help="exit non-zero if LICENSE-wheel is out of date instead of rewriting it", + ) + parser.add_argument( + "--sourcemap", + help="use an existing *.js.map instead of running a fresh vite build", + ) + args = parser.parse_args() + + temp_dir = None + try: + if args.sourcemap: + sourcemap_path = args.sourcemap + else: + temp_dir = tempfile.mkdtemp(prefix="burr-license-build-") + sourcemap_path = build_sourcemap(temp_dir) + + found = bundled_packages(sourcemap_path) + if not found: + sys.exit("error: no node_modules sources found in the sourcemap") + packages = [read_package(name, path) for name, path in sorted(found.items())] + finally: + if temp_dir: + shutil.rmtree(temp_dir, ignore_errors=True) + + generated = render(packages) + existing = open(LICENSE_WHEEL, encoding="utf-8").read() + updated = splice(existing, generated) + + unknown = [p["name"] for p in packages if p["license"] in ("UNKNOWN", "")] + print(f"bundled npm packages: {len(packages)}") + counts = collections.Counter(p["license"] for p in packages) + for license_id, count in sorted(counts.items(), key=lambda kv: -kv[1]): + print(f" {count:4d} {license_id}") + if unknown: + print(f"warning: no license declared for: {', '.join(unknown)}", file=sys.stderr) + + if args.check: + if updated != existing: + print( + "\nLICENSE-wheel is out of date. Run:\n" + " python scripts/generate_wheel_license.py", + file=sys.stderr, + ) + return 1 + print("\nLICENSE-wheel is up to date.") + return 0 + + if updated == existing: + print("\nLICENSE-wheel already up to date.") + return 0 + open(LICENSE_WHEEL, "w", encoding="utf-8").write(updated) + print(f"\nwrote {LICENSE_WHEEL}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/integrations/test_bip0042_bedrock.py b/tests/integrations/test_bip0042_bedrock.py index e2509edef..94e176ddb 100644 --- a/tests/integrations/test_bip0042_bedrock.py +++ b/tests/integrations/test_bip0042_bedrock.py @@ -21,12 +21,16 @@ from unittest.mock import MagicMock import pytest -from botocore.exceptions import ClientError from burr.core.action import SingleStepAction, StreamingAction from burr.core.state import State boto3 = pytest.importorskip("boto3", reason="boto3 required for Bedrock tests") +# botocore ships with boto3, so it must be imported *after* the skip guard -- +# otherwise collecting this module raises ImportError instead of skipping when +# the [bedrock] extra is not installed, and `pytest tests/` aborts entirely. +from botocore.exceptions import ClientError + import burr.integrations as integrations from burr.integrations import bedrock from burr.integrations.bedrock import BedrockAction, BedrockStreamingAction, StateToPromptMapper