diff --git a/.github/actions/test-package/action.yml b/.github/actions/test-package/action.yml index 340a7cb6..ef0dbc62 100644 --- a/.github/actions/test-package/action.yml +++ b/.github/actions/test-package/action.yml @@ -5,11 +5,6 @@ inputs: description: 'Spack spec syntax' required: true type: string - python-version: - description: 'Python version' - required: false - type: string - default: '3.13' runs: using: "composite" steps: @@ -17,28 +12,17 @@ runs: shell: sh run: | apt-get -y update - apt-get install -y bzip2 curl file git gzip make patch tar unzip xz-utils - - - uses: actions/setup-python@v6 - with: - python-version: ${{ inputs.python-version }} + apt-get install -y file bzip2 ca-certificates g++ gcc gfortran git gzip lsb-release patch python3 tar unzip xz-utils zstd - name: Set up spack - uses: spack/setup-spack@v2 + uses: spack/setup-spack@v3 with: - ref: develop - color: true - path: spack - - - name: Install gcc-13 (default) - shell: sh - if: contains(inputs.spec, 'gcc@13') || (! contains(inputs.spec, 'clang') && ! contains(inputs.spec, 'gcc')) - run: apt-get install -y g++ gcc gfortran build-essential + spack_ref: develop - name: Install clang-18 shell: sh if: contains(inputs.spec, 'clang@18') - run: apt-get install -y clang-18 gfortran + run: apt-get install -y clang-18 - name: Add repos shell: spack-bash {0} @@ -47,12 +31,12 @@ runs: spack config get repos spack repo list - - name: add cache + - name: Add cache shell: spack-bash {0} run: | - spack mirror add e4s-25.11 https://cache.e4s.io/25.11 - spack buildcache keys --install --trust - spack config add "packages:all:target:[x86_64_v3]" + spack mirror add develop https://binaries.spack.io/develop + spack config add "packages:all:require:['os=ubuntu24.04','target=x86_64_v3']" + spack buildcache keys --install --trust - name: Compiler find shell: spack-bash {0} @@ -62,14 +46,16 @@ runs: shell: spack-bash {0} run: spack env create -d ./env - - name: Add spec + - name: Add specs shell: spack-bash {0} run: spack -e ./env add ${{ inputs.spec }} - name: Concretize shell: spack-bash {0} - run: spack -e ./env concretize -j 4 - + run: | + spack -e ./env config add concretizer:unify:true + spack -e ./env concretize -j 4 + - name: Install shell: spack-bash {0} run: > @@ -81,5 +67,5 @@ runs: if: success() || failure() uses: actions/upload-artifact@v4 with: - name: ${{ inputs.spec }}-${{ inputs.python-version }}-log + name: ${{ inputs.spec }}-log path: log.xml diff --git a/.github/workflows/spack-matrix.yml b/.github/workflows/spack-matrix.yml index 0f8c5fc0..1fbbb7b6 100644 --- a/.github/workflows/spack-matrix.yml +++ b/.github/workflows/spack-matrix.yml @@ -7,12 +7,13 @@ on: pull_request: workflow_dispatch: schedule: - - cron: "0 2 * * MON" # weekly, mondays 2am + - cron: "0 2 * * MON" # weekly, Mondays 0200 jobs: style-check: name: ✨ runs-on: ubuntu-latest + steps: - uses: actions/setup-python@v6 with: @@ -20,7 +21,8 @@ jobs: - uses: actions/checkout@v5 with: fetch-depth: 2 - - uses: actions/checkout@v5 + - name: Fetch Spack CI scripts + uses: actions/checkout@v5 with: repository: spack/spack ref: develop @@ -41,15 +43,15 @@ jobs: fail-fast: false matrix: version: ["main", "0.10", "0.9", "0.8"] - variant: ["build_type=Developer"] - compiler: ["gcc@13", "clang@18"] + spec: ["build_type=Developer %gcc@13", "build_type=Developer %clang@18"] + steps: - uses: actions/checkout@v5 with: path: spack-fenics - uses: ./spack-fenics/.github/actions/test-package with: - spec: fenics-basix@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} + spec: fenics-basix@${{ matrix.version }} ${{ matrix.spec }} fenics-dolfinx: needs: style-check @@ -58,20 +60,39 @@ jobs: strategy: fail-fast: false matrix: + # NOTE: clang sometimes likes stub or Intel MPI. Force MPI implementations. version: ["main", "0.10", "0.9", "0.8"] - variant: ["build_type=Developer", "partitioners=kahip,parmetis,scotch", "+petsc +slepc +adios2"] - compiler: ["gcc@13", "clang@18"] - exclude: - # kahip does not support clang - - variant: "partitioners=kahip,parmetis,scotch" - compiler: "clang@18" + main_spec: ["build_type=Developer %%c,cxx=clang@18 ^mpich", "build_type=Developer partitioners=kahip,parmetis,scotch +petsc +slepc +adios2 %%gcc@13 ^openmpi"] + env: + OMPI_ALLOW_RUN_AS_ROOT: 1 + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 + PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe # Newer OpenMPI + OMPI_MCA_rmaps_base_oversubscribe: true # Older OpenMPI + steps: - uses: actions/checkout@v5 with: path: spack-fenics - uses: ./spack-fenics/.github/actions/test-package with: - spec: fenics-dolfinx@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} + spec: fenics-dolfinx@${{ matrix.version }} ${{ matrix.main_spec }} py-fenics-ffcx catch2 cmake + # FFCx compilation of poisson.py fails in ffcx/codegeneration/C/finite_element.py + - name: Run tests (skip 0.8) + shell: spack-bash {0} + if: ${{ matrix.version != '0.8' }} + run: | + spack env activate ./env + spack load --first catch2 cmake fenics-dolfinx py-fenics-ffcx + spack stage fenics-dolfinx@${{ matrix.version }} ${{ matrix.main_spec }} + spack cd fenics-dolfinx@${{ matrix.version }} ${{ matrix.main_spec }} + spack build-env --dump fenics-dolfinx-build-env.sh fenics-dolfinx + source fenics-dolfinx-build-env.sh + cmake -B build/test/ -S cpp/test/ -DCMAKE_BUILD_TYPE=Developer + cmake --build build/test + cd build/test + ctest -V --output-on-failure -R unittests_np_1 + ctest -V --output-on-failure -R unittests_np_3 + fenics-ufcx: needs: style-check @@ -81,14 +102,15 @@ jobs: fail-fast: false matrix: version: ["main", "0.10", "0.9", "0.8"] - compiler: ["gcc@13", "clang@18"] + spec: ["%gcc@13"] + steps: - uses: actions/checkout@v5 with: path: spack-fenics - uses: ./spack-fenics/.github/actions/test-package with: - spec: fenics-ufcx@${{ matrix.version }} %${{ matrix.compiler }} + spec: fenics-ufcx@${{ matrix.version }} ${{ matrix.spec }} py-fenics-basix: needs: style-check @@ -98,35 +120,35 @@ jobs: fail-fast: false matrix: version: ["main", "0.10", "0.9", "0.8"] - variant: ["", "+ufl"] - compiler: ["gcc@13", "clang@18"] + # Make sure fenics-basix and py-fenics-basix build with same compiler/ABI. + spec: ["+ufl %gcc@13 ^fenics-basix%gcc@13", "+ufl %clang@18 ^fenics-basix%clang@18"] + steps: - uses: actions/checkout@v5 with: path: spack-fenics - uses: ./spack-fenics/.github/actions/test-package with: - spec: py-fenics-basix@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - # workaround for https://github.com/spack/spack/issues/29447 - - name: Run tests (> 0.8) - if: ${{ matrix.version != '0.8' && contains(matrix.variant, '+ufl') }} + spec: py-fenics-basix@${{ matrix.version }} ${{ matrix.spec }} + - name: Run tests + if: ${{ matrix.version != '0.8' }} shell: spack-bash {0} run: | spack env activate ./env - spack install --add py-pytest py-sympy - spack stage py-fenics-basix@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - spack cd py-fenics-basix@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - pytest test/ - # 0.8 holds one broken test case - - name: Run tests (0.8) - if: ${{ matrix.version == '0.8' && contains(matrix.variant, '+ufl') }} + spack install --add py-pytest py-sympy py-pytest-xdist + spack stage py-fenics-basix@${{ matrix.version }} ${{ matrix.spec }} + spack cd py-fenics-basix@${{ matrix.version }} ${{ matrix.spec }} + python -m pytest -n auto test/ + # NOTE: 0.8 has test_all_elements_included broken + - name: Run tests + if: ${{ matrix.version == '0.8' }} shell: spack-bash {0} run: | spack env activate ./env - spack install --add py-pytest py-sympy - spack stage py-fenics-basix@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - spack cd py-fenics-basix@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - pytest test/ -k "not test_all_elements_included" + spack install --add py-pytest py-sympy py-pytest-xdist + spack stage py-fenics-basix@${{ matrix.version }} ${{ matrix.spec }} + spack cd py-fenics-basix@${{ matrix.version }} ${{ matrix.spec }} + python -m pytest -n auto -k "not test_all_elements_included" test/ py-fenics-dolfinx: needs: style-check @@ -136,37 +158,51 @@ jobs: fail-fast: false matrix: version: ["main", "0.10", "0.9", "0.8"] - variant: ["build_type=Developer", "+petsc4py +slepc4py"] - compiler: ["gcc@13", "clang@18"] - python-version: ["3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.13"] + # NOTE: Overspecification of %%clang@18 to fix ABI issues (std::string related?). + # NOTE: clang sometimes likes stub or Intel MPI. + spec: ["build_type=Developer +petsc4py +slepc4py %%gcc@13 ^petsc+mumps ^fenics-dolfinx+adios2 ^mpich", + "build_type=Developer %%clang@18 ^openmpi"] + # Test new superlu-dist variant + include: + - version: "main" + spec: "build_type=Developer %%clang@18 ^mpich ^fenics-dolfinx+superlu-dist" + python-version: "3.12" + env: + OMPI_ALLOW_RUN_AS_ROOT: 1 + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 + PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe # Newer OpenMPI + OMPI_MCA_rmaps_base_oversubscribe: true # Older OpenMPI + steps: - uses: actions/checkout@v5 with: path: spack-fenics - uses: ./spack-fenics/.github/actions/test-package with: - spec: py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - python-version: ${{ matrix.python-version }} - # workaround for https://github.com/spack/spack/issues/29447 - # pytest@8.4 required for collision of [tool.pytest] and [tool.pytest.ini_options] since @9.0 (at least for dolfinx @:0.9) - - name: Run tests - if: ${{ matrix.version == '0.8' || matrix.version == '0.9'}} + spec: py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.spec }} ^python@${{ matrix.python-version }} + # pytest@8.4 required for collision of [tool.pytest] and [tool.pytest.ini_options] since @9.0 + - name: Run tests (0.9) + if: ${{ matrix.version == '0.9'}} shell: spack-bash {0} run: | spack env activate ./env - spack install --add py-pytest@8.4 py-scipy - spack stage py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - spack cd py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - pytest python/test/unit -m "not petsc4py and not adios2" -k "not test_cffi_expression and not test_cube_distance" - - name: Run tests + spack install --add py-pytest@8.4 py-scipy py-pytest-xdist ^python@${{ matrix.python-version }} + spack stage py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.spec }} ^python@${{ matrix.python-version }} + spack cd py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.spec }} ^python@${{ matrix.python-version }} + python -m pytest -n auto -m "not petsc4py and not adios2" -k "not test_cffi_expression and not test_cube_distance" python/test/unit + mpiexec -n 3 python -m pytest -m "not petsc4py and not adios2" -k "not test_cffi_expression and not test_cube_distance" python/test/unit + # NOTE: 0.8 tests run very slow - skip? + - name: Run tests (not 0.8 and not 0.9) if: ${{ matrix.version != '0.8' && matrix.version != '0.9'}} shell: spack-bash {0} run: | spack env activate ./env - spack install --add py-pytest@8.4 py-scipy - spack stage py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - spack cd py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.variant }} %${{ matrix.compiler }} - pytest python/test/unit -m "not petsc4py and not adios2" -k "not test_cffi_expression" + spack install --add py-pytest py-scipy py-pytest-xdist ^python@${{ matrix.python-version }} + spack stage py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.spec }} ^python@${{ matrix.python-version }} + spack cd py-fenics-dolfinx@${{ matrix.version }} ${{ matrix.spec }} ^python@${{ matrix.python-version }} + python -m pytest -n auto -m "not petsc4py and not adios2" -k "not test_cffi_expression and not test_symmetry_interior_facet_assembly[mesh1]" python/test/unit + mpiexec -n 3 python -m pytest -m "not petsc4py and not adios2" -k "not test_cffi_expression and not test_symmetry_interior_facet_assembly[mesh1]" python/test/unit py-fenics-ffcx: needs: style-check @@ -176,25 +212,25 @@ jobs: fail-fast: false matrix: version: ["main", "0.10", "0.9", "0.8"] + steps: - uses: actions/checkout@v5 with: path: spack-fenics + # NOTE: Python built with GCC, otherwise cffi can try for an odd compiler. - uses: ./spack-fenics/.github/actions/test-package with: - spec: py-fenics-ffcx@${{ matrix.version }} - # workaround for https://github.com/spack/spack/issues/29447 - # we do not run numba based tests here due to disk-space constraints - # 0.8 broken + spec: py-fenics-ffcx@${{ matrix.version }} ^python %%gcc@13 + # NOTE: ffcx version 0.8 currently broken - name: Run tests if: ${{ matrix.version != '0.8' }} shell: spack-bash {0} run: | spack env activate ./env - spack install --add py-pytest py-sympy + spack install --add py-pytest py-sympy py-pytest-xdist spack stage py-fenics-ffcx@${{ matrix.version }} spack cd py-fenics-ffcx@${{ matrix.version }} - pytest test/ + python -m pytest -n auto test/ py-fenics-ufl: needs: style-check @@ -204,6 +240,7 @@ jobs: fail-fast: false matrix: version: ["main", "2025.2", "2025.1", "2024.2", "2024.1"] + steps: - uses: actions/checkout@v5 with: @@ -211,12 +248,12 @@ jobs: - uses: ./spack-fenics/.github/actions/test-package with: spec: py-fenics-ufl@${{ matrix.version }} - # workaround for https://github.com/spack/spack/issues/29447 + # NOTE: Reference counting changed in Python 3.14, leading to test failure. - name: Run tests shell: spack-bash {0} run: | spack env activate ./env - spack install --add py-pytest + spack install --add py-pytest py-pytest-xdist spack stage py-fenics-ufl@${{ matrix.version }} spack cd py-fenics-ufl@${{ matrix.version }} - pytest test/ + python -m pytest -n auto -k "not test_strip_form_arguments_strips_data_refs" test/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..c081cdb8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,531 @@ +[project] +name = "spack" +description = "The spack package manager" +requires-python = ">=3.6" +dependencies = ["clingo", "setuptools"] +dynamic = ["version"] + +[tool.hatch.version] +path = "repos/spack_repo/builtin/__init__.py" + +[project.optional-dependencies] +dev = [ + "pip>=21.3", + "pytest", + "pytest-xdist", + "setuptools", + "click", + "black", + "mypy", + "isort", + "flake8", + "vermin", +] +ci = ["pytest-cov", "codecov[toml]"] + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +include = [ + "/repos", + "CITATION.cff", + "COPYRIGHT", + "LICENSE-APACHE", + "LICENSE-MIT", + "NOTICE", + "README.md", + "SECURITY.md", +] + +[tool.hatch.envs.default] +features = ["dev"] + +[tool.hatch.envs.ci] +features = ["dev", "ci"] + +[tool.ruff] +line-length = 99 +extend-include = ["bin/spack"] +extend-exclude = ["lib/spack/external", "*.pyi"] + +# This is the Spack package API. We allow these functions to be imported with +# from spack.package import *, and we should update this when the package API +# changes. This also serves to catch the usage of things that are NOT in the +# package API, so that we can avoid having them in builtin. +builtins = [ + # core spack build environment + "configure", + "cscript", + "dso_suffix", + "make_jobs", + "msbuild", + "nmake", + "prefix", + "python", + "python_include", + "python_platlib", + "python_purelib", + "spack_cc", + "spack_cxx", + "spack_f77", + "spack_fc", + "static_to_shared_library", + # defined in packages or build systems, e.g. -- these can be removed over time + "aclocal", + "autoconf", + "autoheader", + "autom4te", + "automake", + "autoreconf", + "autoscan", + "autoupdate", + "bazel", + "cargo", + "cmake", + "ctest", + "gem", + "glibtool", + "glibtoolize", + "gmake", + "go", + "ifnames", + "kentutils_htslib_include_dir", + "kentutils_include_dir", + "kentutils_lib_dir", + "libtool", + "libtoolize", + "lua", + "luarocks", + "make", + "make", + "meson", + "msbuild", + "ninja", + "ninja", + "nmake", + "octave", + "perl", + "perl_lib_dir", + "pip", + "plumed", + "pypy", + "python", + "python_include", + "python_platlib", + "python_purelib", + "qmake", + "R", + "r_lib_dir", + "rake", + "ruby", + "scons", + # v2.0 + "BaseBuilder", + "Builder", + "Dict", + "EnvironmentModifications", + "Executable", + "FileFilter", + "FileList", + "HeaderList", + "InstallError", + "LibraryList", + "List", + "MakeExecutable", + "NoHeadersError", + "NoLibrariesError", + "Optional", + "PackageBase", + "Prefix", + "ProcessError", + "SkipTest", + "Spec", + "Version", + "all_deptypes", + "ancestor", + "any_combination_of", + "auto_or_any_combination_of", + "bash_completion_path", + "build_system_flags", + "build_system", + "cache_extra_test_sources", + "can_access", + "can_splice", + "cd", + "change_sed_delimiter", + "check_outputs", + "conditional", + "conflicts", + "copy_tree", + "copy", + "default_args", + "depends_on", + "determine_number_of_jobs", + "disjoint_sets", + "env_flags", + "env", + "extends", + "filter_compiler_wrappers", + "filter_file", + "find_all_headers", + "find_first", + "find_headers", + "find_libraries", + "find_required_file", + "find_system_libraries", + "find", + "fish_completion_path", + "fix_darwin_install_name", + "force_remove", + "force_symlink", + "get_escaped_text_output", + "inject_flags", + "install_test_root", + "install_tree", + "install", + "is_exe", + "join_path", + "keep_modification_time", + "library_extensions", + "license", + "maintainers", + "makedirs", + "mkdir", + "mkdirp", + "move", + "on_package_attributes", + "patch", + "provides", + "pwd", + "redistribute", + "register_builder", + "remove_directory_contents", + "remove_linked_tree", + "remove", + "removedirs", + "rename", + "requires", + "resource", + "rmtree", + "run_after", + "run_before", + "set_executable", + "set_install_permissions", + "symlink", + "test_part", + "touch", + "tty", + "variant", + "ver", + "version", + "when", + "which_string", + "which", + "working_dir", + "zsh_completion_path", + # v2.1 + "CompilerError", + "SpackError", + # v2.2 + "BuilderWithDefaults", + "ClassProperty", + "CompilerPropertyDetector", + "GenericBuilder", + "HKEY", + "LC_ID_DYLIB", + "LinkTree", + "MachO", + "ModuleChangePropagator", + "Package", + "WindowsRegistryView", + "apply_macos_rpath_fixups", + "classproperty", + "compare_output_file", + "compare_output", + "compile_c_and_execute", + "compiler_spec", + "create_builder", + "dedupe", + "delete_needed_from_elf", + "delete_rpath", + "environment_modifications_for_specs", + "execute_install_time_tests", + "filter_shebang", + "filter_system_paths", + "find_all_libraries", + "find_compilers", + "get_cmake_prefix_path", + "get_effective_jobs", + "get_elf_compat", + "get_path_args_from_module_line", + "get_user", + "has_shebang", + "host_platform", + "is_system_path", + "join_url", + "kernel_version", + "libc_from_dynamic_linker", + "macos_version", + "make_package_test_rpath", + "memoized", + "microarchitecture_flags_from_target", + "microarchitecture_flags", + "module_command", + "parse_dynamic_linker", + "parse_elf", + "path_contains_subdirectory", + "readlink", + "safe_remove", + "sbang_install_path", + "sbang_shebang_line", + "set_env", + "shared_library_suffix", + "spack_script", + "static_library_suffix", + "substitute_version_in_url", + "windows_sfn", +] + + +[tool.ruff.format] +skip-magic-trailing-comma = false + +[tool.ruff.lint] +extend-select = ["I"] +ignore = ["E731", "E203", "F403", "F811"] + +[tool.ruff.lint.isort] +split-on-trailing-comma = false +section-order = [ + "future", + "standard-library", + "third-party", + "llnl", + "spack", + "first-party", + "local-folder", +] + +[tool.ruff.lint.isort.sections] +spack = ["spack"] +llnl = ["llnl"] + +[tool.ruff.lint.per-file-ignores] +"var/spack/*/package.py" = ["F403", "F405", "F811", "F821"] +"*-ci-package.py" = ["F403", "F405", "F821"] + +[tool.black] +line-length = 99 +include = "(repos/spack_repo|tests)/.*\\.pyi?$" +skip_magic_trailing_comma = true + +[tool.isort] +line_length = 99 +profile = "black" +sections = [ + "FUTURE", + "STDLIB", + "THIRDPARTY", + "LLNL", + "FIRSTPARTY", + "LOCALFOLDER", +] +known_first_party = "spack" +known_llnl = "llnl" +known_third_party = ["ruamel", "six"] +src_paths = "lib" +honor_noqa = true + +[tool.mypy] +files = [ + "repos/spack_repo/builtin/packages/*/package.py", + "repos/spack_repo/builtin/build_systems/*.py", +] +mypy_path = ["spack-core/lib/spack", "spack-core/lib/spack/external", "repos/"] +allow_redefinition = true + +# This and a generated import file allows supporting packages +namespace_packages = true + +# To avoid re-factoring all the externals, ignore errors and missing imports +# globally, then turn back on in spack and spack submodules +ignore_errors = true +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "spack.*" +ignore_errors = false +ignore_missing_imports = false + +[[tool.mypy.overrides]] +module = "spack_repo.*" +ignore_errors = false +ignore_missing_imports = false +# we can't do this here, not a module scope option, in spack style instead +# disable_error_code = 'no-redef' + +[[tool.mypy.overrides]] +module = "llnl.*" +ignore_errors = false +ignore_missing_imports = false + +[[tool.mypy.overrides]] +module = "spack.test.packages" +ignore_errors = true + +# ignore errors in fake import path for packages +[[tool.mypy.overrides]] +module = "spack.pkg.*" +ignore_errors = true +ignore_missing_imports = true + +# Spack imports a number of external packages, and they *may* require Python 3.8 or +# higher in recent versions. This can cause mypy to fail because we check for 3.7 +# compatibility. We could restrict mypy to run for the oldest supported version (3.7), +# but that means most developers won't be able to run mypy, which means it'll fail +# more in CI. Instead, we exclude these imported packages from mypy checking. +[[tool.mypy.overrides]] +module = [ + "IPython", + "altgraph", + "attr", + "boto3", + "botocore", + "distro", + "importlib.metadata", + "jinja2", + "jsonschema", + "macholib", + "markupsafe", + "numpy", + "pkg_resources", + "pyristent", + "pytest", + "ruamel.yaml", + "six", +] +follow_imports = "skip" +follow_imports_for_stubs = true + +[tool.pyright] +useLibraryCodeForTypes = true +reportMissingImports = true +reportWildcardImportFromLibrary = false +include = ["lib/spack", "var/spack/repos", "var/spack/test_repos"] +ignore = ["lib/spack/external"] +extraPaths = ["lib/spack", "lib/spack/external"] + + +[tool.coverage.run] +parallel = true +concurrency = ["multiprocessing"] +branch = true +source = ["bin", "lib"] +data_file = "./tests-coverage/.coverage" +omit = [ + "lib/spack/spack/test/*", + "lib/spack/docs/*", + "lib/spack/external/*", + "share/spack/qa/*", +] + +[tool.coverage.report] +# Regexes for lines to exclude from consideration +exclude_lines = [ + # Have to re-enable the standard pragma + "pragma: no cover", + + # Don't complain about missing debug-only code: + "def __repr__", + "if self\\.debug", + + # Don't complain if tests don't hit defensive assertion code: + "raise AssertionError", + "raise NotImplementedError", + + # Don't complain if non-runnable code isn't run: + "if 0:", + "if False:", + "if __name__ == .__main__.:", +] +ignore_errors = true + +[tool.coverage.paths] +source = [ + ".", + "/Users/runner/work/spack/spack", + "/System/Volumes/Data/home/runner/work/spack/spack", + "D:\\a\\spack\\spack", +] + +[tool.coverage.html] +directory = "htmlcov" + +[tool.vendoring] +destination = "lib/spack/external/_vendoring" +requirements = "lib/spack/external/vendor.txt" +namespace = "" + +protected-files = ["__init__.py", "README.rst", "vendor.txt"] +patches-dir = "lib/spack/external/patches" + +[tool.vendoring.transformations] +substitute = [ + { match = "typing_extensions", replace = "_vendoring.typing_extensions" }, + { match = "ruamel.yaml", replace = "_vendoring.ruamel.yaml" }, + { match = "altgraph", replace = "_vendoring.altgraph" }, + { match = "macholib", replace = "_vendoring.macholib" }, + { match = "from six", replace = "from _vendoring.six" }, + { match = "markupsafe", replace = "_vendoring.markupsafe" }, + { match = "jinja2", replace = "_vendoring.jinja2" }, + { match = "pyrsistent", replace = "_vendoring.pyrsistent" }, + { match = "import attr\n", replace = "import _vendoring.attr\n" }, + { match = "from attr", replace = "from _vendoring.attr" }, + { match = "import jsonschema", replace = "import _vendoring.jsonschema" }, + { match = "from jsonschema", replace = "from _vendoring.jsonschema" }, +] +drop = [ + # contains unnecessary scripts + "bin/", + # interpreter and OS specific msgpack libs + "msgpack/*.so", + # unneeded parts of setuptools + "easy_install.py", + "setuptools", + "pkg_resources/_vendor/", + "pkg_resources/extern/", + # trim vendored pygments styles and lexers + "pygments/styles/[!_]*.py", + "^pygments/lexers/(?!python|__init__|_mapping).*\\.py$", + # trim rich's markdown support + "rich/markdown.py", + # ruamel.yaml installs unneded files + "ruamel.*.pth", + "pvectorc.*.so", + # Trim jsonschema tests + "jsonschema/tests", + "archspec/json/tests", + "archspec/vendor/cpuid/.gitignore", + "pyrsistent/__init__.pyi", +] + +[tool.vendoring.typing-stubs] +_pyrsistent_version = [] +altgraph = [] +archspec = [] +distro = [] +jsonschema = [] +macholib = [] +pyrsistent = [] +ruamel = [] +six = [] + +[tool.vendoring.license.directories] +setuptools = "pkg_resources" + +[tool.vendoring.license.fallback-urls] +CacheControl = "https://raw.githubusercontent.com/ionrock/cachecontrol/v0.12.6/LICENSE.txt" +distlib = "https://bitbucket.org/pypa/distlib/raw/master/LICENSE.txt" +webencodings = "https://github.com/SimonSapin/python-webencodings/raw/master/LICENSE" diff --git a/spack_repo/fenics/packages/fenics_basix/package.py b/spack_repo/fenics/packages/fenics_basix/package.py index 8581f6e1..a85afc31 100644 --- a/spack_repo/fenics/packages/fenics_basix/package.py +++ b/spack_repo/fenics/packages/fenics_basix/package.py @@ -18,7 +18,9 @@ class FenicsBasix(CMakePackage): license("MIT") version("main", branch="main", no_cache=True) - version("0.10.0.post0", sha256="11a6482fb8d7204fbd77aaf457a9ae3e75db1707b3e30ea2c938eccfee925ea4") + version( + "0.10.0.post0", sha256="11a6482fb8d7204fbd77aaf457a9ae3e75db1707b3e30ea2c938eccfee925ea4" + ) version("0.10.0", sha256="b93221dac7d3fea8c10e77617f6201036de35d0c5437440b718de69a28c3773f") version("0.9.0", sha256="60e96b2393084729b261cb10370f0e44d12735ab3dbd1f15890dec23b9e85329") version("0.8.0", sha256="b299af82daf8fa3e4845e17f202491fe71b313bf6ab64c767a5287190b3dd7fe") diff --git a/spack_repo/fenics/packages/fenics_dolfinx/package.py b/spack_repo/fenics/packages/fenics_dolfinx/package.py index f63cec81..ee7d4661 100644 --- a/spack_repo/fenics/packages/fenics_dolfinx/package.py +++ b/spack_repo/fenics/packages/fenics_dolfinx/package.py @@ -17,7 +17,9 @@ class FenicsDolfinx(CMakePackage): license("LGPL-3.0-or-later") version("main", branch="main", no_cache=True) - version("0.10.0.post4", sha256="3f827a88ab52843fbd7a5cc7814ecba165bdec65fd10df05eb031c286e8cd605") + version( + "0.10.0.post4", sha256="3f827a88ab52843fbd7a5cc7814ecba165bdec65fd10df05eb031c286e8cd605" + ) version( "0.10.0.post2", sha256="eae83794fee8141c80c59c03a2f4ac208af2b62c8f36e5d19c93e0d279029f52" ) @@ -59,6 +61,7 @@ class FenicsDolfinx(CMakePackage): variant("slepc", default=False, description="SLEPc support") variant("adios2", default=False, description="ADIOS2 support") variant("petsc", default=False, description="PETSc support") + variant("superlu-dist", default=False, description="SuperLU_DIST support", when="@main") conflicts("~petsc", when="+slepc", msg="+slepc requires +petsc") @@ -66,7 +69,8 @@ class FenicsDolfinx(CMakePackage): depends_on("cmake@3.19:", when="@:0.8", type="build") depends_on("pkgconfig", type="build") depends_on("mpi") - depends_on("hdf5+mpi") + # HDF5Interface.cpp #if H5_VERSION_GE are not precise enough. + depends_on("hdf5+mpi@1.12:") depends_on("boost@1.70:") depends_on("boost@1.70:+timer", when="@:0.9") depends_on("pugixml") @@ -81,6 +85,8 @@ class FenicsDolfinx(CMakePackage): depends_on("adios2@2.8.1:", when="@0.9: +adios2") depends_on("adios2+mpi", when="+adios2") + depends_on("superlu-dist", when="+superlu-dist") + for ver in ("main", "0.10", "0.9", "0.8", "0.7", "0.6"): depends_on(f"fenics-ufcx@{ver}", when=f"@{ver}") depends_on(f"fenics-basix@{ver}", when=f"@{ver}") @@ -100,4 +106,5 @@ def cmake_args(self): self.define("DOLFINX_ENABLE_KAHIP", "partitioners=kahip" in self.spec), self.define("DOLFINX_ENABLE_PARMETIS", "partitioners=parmetis" in self.spec), self.define("DOLFINX_ENABLE_SCOTCH", "partitioners=scotch" in self.spec), + self.define("DOLFINX_ENABLE_SUPERLU_DIST", "superlu-dist" in self.spec), ] diff --git a/spack_repo/fenics/packages/fenics_ufcx/package.py b/spack_repo/fenics/packages/fenics_ufcx/package.py index c60b26e9..433bc49b 100644 --- a/spack_repo/fenics/packages/fenics_ufcx/package.py +++ b/spack_repo/fenics/packages/fenics_ufcx/package.py @@ -17,7 +17,7 @@ class FenicsUfcx(CMakePackage): url = "https://github.com/FEniCS/ffcx/archive/v0.4.2.tar.gz" maintainers("ma595", "jhale", "garth-wells", "chrisrichardson") - license("LGPL-3.0-or-later") + license("Unlicense") version("main", branch="main", no_cache=True) version("0.10.0", sha256="fa27e2dc68988cbf9aca537eb5a58483f75cc719c1a383713b7f8cca49844ff9") diff --git a/spack_repo/fenics/packages/py_fenics_basix/package.py b/spack_repo/fenics/packages/py_fenics_basix/package.py index cafd5b26..df384eb5 100644 --- a/spack_repo/fenics/packages/py_fenics_basix/package.py +++ b/spack_repo/fenics/packages/py_fenics_basix/package.py @@ -2,9 +2,10 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack.package import * from spack_repo.builtin.build_systems.python import PythonPackage +from spack.package import * + class PyFenicsBasix(PythonPackage): """Python interface to Basix, a finite element definition and tabulation runtime library""" @@ -18,30 +19,14 @@ class PyFenicsBasix(PythonPackage): version("main", branch="main", no_cache=True) version( - "0.10.0.post0", - sha256="11a6482fb8d7204fbd77aaf457a9ae3e75db1707b3e30ea2c938eccfee925ea4", - ) - version( - "0.10.0", - sha256="b93221dac7d3fea8c10e77617f6201036de35d0c5437440b718de69a28c3773f", - ) - version( - "0.9.0", - sha256="60e96b2393084729b261cb10370f0e44d12735ab3dbd1f15890dec23b9e85329", - ) - version( - "0.8.0", - sha256="b299af82daf8fa3e4845e17f202491fe71b313bf6ab64c767a5287190b3dd7fe", + "0.10.0.post0", sha256="11a6482fb8d7204fbd77aaf457a9ae3e75db1707b3e30ea2c938eccfee925ea4" ) + version("0.10.0", sha256="b93221dac7d3fea8c10e77617f6201036de35d0c5437440b718de69a28c3773f") + version("0.9.0", sha256="60e96b2393084729b261cb10370f0e44d12735ab3dbd1f15890dec23b9e85329") + version("0.8.0", sha256="b299af82daf8fa3e4845e17f202491fe71b313bf6ab64c767a5287190b3dd7fe") with default_args(deprecated=True): - version( - "0.7.0", - sha256="9bee81b396ee452eec8d9735f278cb44cb6994c6bc30aec8ed9bb4b12d83fa7f", - ) - version( - "0.6.0", - sha256="687ae53153c98facac4080dcdc7081701db1dcea8c5e7ae3feb72aec17f83304", - ) + version("0.7.0", sha256="9bee81b396ee452eec8d9735f278cb44cb6994c6bc30aec8ed9bb4b12d83fa7f") + version("0.6.0", sha256="687ae53153c98facac4080dcdc7081701db1dcea8c5e7ae3feb72aec17f83304") # CMake build type variant( diff --git a/spack_repo/fenics/packages/py_fenics_dolfinx/package.py b/spack_repo/fenics/packages/py_fenics_dolfinx/package.py index 53c2eb83..50a11956 100644 --- a/spack_repo/fenics/packages/py_fenics_dolfinx/package.py +++ b/spack_repo/fenics/packages/py_fenics_dolfinx/package.py @@ -2,9 +2,10 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack.package import * from spack_repo.builtin.build_systems.python import PythonPackage +from spack.package import * + class PyFenicsDolfinx(PythonPackage): """Python interface to the next generation FEniCS problem solving @@ -19,26 +20,13 @@ class PyFenicsDolfinx(PythonPackage): version("main", branch="main", no_cache=True) version( - "0.10.0.post4", - sha256="3f827a88ab52843fbd7a5cc7814ecba165bdec65fd10df05eb031c286e8cd605", - ) - version( - "0.9.0", - sha256="b266c74360c2590c5745d74768c04568c965b44739becca4cd6b5aa58cdbbbd1", - ) - version( - "0.8.0", - sha256="acf3104d9ecc0380677a6faf69eabfafc58d0cce43f7777e1307b95701c7cad9", + "0.10.0.post4", sha256="3f827a88ab52843fbd7a5cc7814ecba165bdec65fd10df05eb031c286e8cd605" ) + version("0.9.0", sha256="b266c74360c2590c5745d74768c04568c965b44739becca4cd6b5aa58cdbbbd1") + version("0.8.0", sha256="acf3104d9ecc0380677a6faf69eabfafc58d0cce43f7777e1307b95701c7cad9") with default_args(deprecated=True): - version( - "0.7.2", - sha256="7d9ce1338ce66580593b376327f23ac464a4ce89ef63c105efc1a38e5eae5c0b", - ) - version( - "0.6.0", - sha256="eb8ac2bb2f032b0d393977993e1ab6b4101a84d54023a67206e3eac1a8d79b80", - ) + version("0.7.2", sha256="7d9ce1338ce66580593b376327f23ac464a4ce89ef63c105efc1a38e5eae5c0b") + version("0.6.0", sha256="eb8ac2bb2f032b0d393977993e1ab6b4101a84d54023a67206e3eac1a8d79b80") # CMake build type variant( @@ -89,11 +77,7 @@ class PyFenicsDolfinx(PythonPackage): depends_on("py-numpy@1.21:", type=("build", "run")) depends_on("py-mpi4py", type=("build", "run")) - conflicts( - "~petsc4py", - when="@:0.8", - msg="+petsc4py is required for versions 0.8 and lower", - ) + conflicts("~petsc4py", when="@:0.8", msg="+petsc4py is required for versions 0.8 and lower") conflicts("~petsc4py", when="+slepc4py", msg="+slepc4py requires +petsc4py") with when("+petsc4py"): depends_on("fenics-dolfinx +petsc") diff --git a/spack_repo/fenics/packages/py_fenics_ffcx/package.py b/spack_repo/fenics/packages/py_fenics_ffcx/package.py index 4d49f5b0..de101992 100644 --- a/spack_repo/fenics/packages/py_fenics_ffcx/package.py +++ b/spack_repo/fenics/packages/py_fenics_ffcx/package.py @@ -18,7 +18,9 @@ class PyFenicsFfcx(PythonPackage): license("LGPL-3.0-or-later") version("main", branch="main", no_cache=True) - version("0.10.1.post0", sha256="91e15e2586390d0a0b0e9993d63b47b7ae9657e5141fc30271291ea1a2d55d5e") + version( + "0.10.1.post0", sha256="91e15e2586390d0a0b0e9993d63b47b7ae9657e5141fc30271291ea1a2d55d5e" + ) version("0.9.0", sha256="afa517272a3d2249f513cb711c50b77cf8368dd0b8f5ea4b759142229204a448") version("0.8.0", sha256="8a854782dbd119ec1c23c4522a2134d5281e7f1bd2f37d64489f75da055282e3") with default_args(deprecated=True):