readcon-chemfiles 0.13.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. readcon_chemfiles-0.13.0/.cargo/config.toml +6 -0
  2. readcon_chemfiles-0.13.0/.github/workflows/build_test.yml +55 -0
  3. readcon_chemfiles-0.13.0/.github/workflows/ci_bench_commenter.yml +38 -0
  4. readcon_chemfiles-0.13.0/.github/workflows/ci_benchmark.yml +105 -0
  5. readcon_chemfiles-0.13.0/.github/workflows/ci_doc_commenter.yml +23 -0
  6. readcon_chemfiles-0.13.0/.github/workflows/ci_docs.yml +55 -0
  7. readcon_chemfiles-0.13.0/.github/workflows/coverage.yml +76 -0
  8. readcon_chemfiles-0.13.0/.github/workflows/crates_publish.yml +69 -0
  9. readcon_chemfiles-0.13.0/.github/workflows/lint.yml +21 -0
  10. readcon_chemfiles-0.13.0/.github/workflows/python_wheels.yml +208 -0
  11. readcon_chemfiles-0.13.0/.github/workflows/release.yml +291 -0
  12. readcon_chemfiles-0.13.0/.gitignore +467 -0
  13. readcon_chemfiles-0.13.0/CHANGELOG.md +588 -0
  14. readcon_chemfiles-0.13.0/CITATION.cff +28 -0
  15. readcon_chemfiles-0.13.0/CMakeLists.txt +44 -0
  16. readcon_chemfiles-0.13.0/CODEOWNERS +13 -0
  17. readcon_chemfiles-0.13.0/CODE_OF_CONDUCT.md +132 -0
  18. readcon_chemfiles-0.13.0/Cargo.lock +1554 -0
  19. readcon_chemfiles-0.13.0/Cargo.toml +114 -0
  20. readcon_chemfiles-0.13.0/LICENSE +19 -0
  21. readcon_chemfiles-0.13.0/PKG-INFO +251 -0
  22. readcon_chemfiles-0.13.0/README.md +229 -0
  23. readcon_chemfiles-0.13.0/addl/referenceImpls/eon_cpp/ConFileIO.cpp +592 -0
  24. readcon_chemfiles-0.13.0/addl/referenceImpls/eon_cpp/ConFileIO.h +36 -0
  25. readcon_chemfiles-0.13.0/addl/referenceImpls/eon_cpp/bench_con_reader.c +155 -0
  26. readcon_chemfiles-0.13.0/benches/compare_readers.py +279 -0
  27. readcon_chemfiles-0.13.0/benches/iterator_bench.rs +238 -0
  28. readcon_chemfiles-0.13.0/benches/make_plots.py +272 -0
  29. readcon_chemfiles-0.13.0/build.rs +22 -0
  30. readcon_chemfiles-0.13.0/cbindgen.toml +89 -0
  31. readcon_chemfiles-0.13.0/cog.toml +49 -0
  32. readcon_chemfiles-0.13.0/dist-workspace.toml +27 -0
  33. readcon_chemfiles-0.13.0/docs/export.el +37 -0
  34. readcon_chemfiles-0.13.0/docs/orgmode/architecture.org +181 -0
  35. readcon_chemfiles-0.13.0/docs/orgmode/benchmarks.org +231 -0
  36. readcon_chemfiles-0.13.0/docs/orgmode/bindings.org +475 -0
  37. readcon_chemfiles-0.13.0/docs/orgmode/changelog.org +4 -0
  38. readcon_chemfiles-0.13.0/docs/orgmode/contributing.org +457 -0
  39. readcon_chemfiles-0.13.0/docs/orgmode/evolution.org +188 -0
  40. readcon_chemfiles-0.13.0/docs/orgmode/faq.org +276 -0
  41. readcon_chemfiles-0.13.0/docs/orgmode/img/feature_comparison.svg +2483 -0
  42. readcon_chemfiles-0.13.0/docs/orgmode/img/memory_usage.svg +1744 -0
  43. readcon_chemfiles-0.13.0/docs/orgmode/img/pareto_features_vs_speed.svg +2638 -0
  44. readcon_chemfiles-0.13.0/docs/orgmode/img/parsing_throughput.svg +2179 -0
  45. readcon_chemfiles-0.13.0/docs/orgmode/index.org +32 -0
  46. readcon_chemfiles-0.13.0/docs/orgmode/rpc.org +62 -0
  47. readcon_chemfiles-0.13.0/docs/orgmode/spec.org +852 -0
  48. readcon_chemfiles-0.13.0/docs/orgmode/tutorials.org +1053 -0
  49. readcon_chemfiles-0.13.0/docs/source/_static/.gitkeep +0 -0
  50. readcon_chemfiles-0.13.0/docs/source/_templates/partials/extra-head.html +2 -0
  51. readcon_chemfiles-0.13.0/docs/source/_templates/partials/site-foot.html +71 -0
  52. readcon_chemfiles-0.13.0/docs/source/conf.py +49 -0
  53. readcon_chemfiles-0.13.0/docs/source/references.bib +9 -0
  54. readcon_chemfiles-0.13.0/examples/c_api_sample.c +172 -0
  55. readcon_chemfiles-0.13.0/examples/cpp_api_sample.cpp +127 -0
  56. readcon_chemfiles-0.13.0/examples/meson.build +29 -0
  57. readcon_chemfiles-0.13.0/examples/rust_usage.rs +79 -0
  58. readcon_chemfiles-0.13.0/include/readcon-core.h +1395 -0
  59. readcon_chemfiles-0.13.0/include/readcon-core.hpp +1512 -0
  60. readcon_chemfiles-0.13.0/julia/ReadCon/Project.toml +12 -0
  61. readcon_chemfiles-0.13.0/julia/ReadCon/src/ReadCon.jl +10 -0
  62. readcon_chemfiles-0.13.0/julia/ReadCon/src/types.jl +225 -0
  63. readcon_chemfiles-0.13.0/julia/ReadCon/src/wrapper.jl +521 -0
  64. readcon_chemfiles-0.13.0/julia/ReadCon/test/runtests.jl +171 -0
  65. readcon_chemfiles-0.13.0/julia/ReadCon/test/test_chemfiles_selection.jl +62 -0
  66. readcon_chemfiles-0.13.0/meson.build +157 -0
  67. readcon_chemfiles-0.13.0/meson_options.txt +12 -0
  68. readcon_chemfiles-0.13.0/pixi.lock +5281 -0
  69. readcon_chemfiles-0.13.0/pixi.toml +46 -0
  70. readcon_chemfiles-0.13.0/pyproject.chemfiles.toml +31 -0
  71. readcon_chemfiles-0.13.0/pyproject.toml +31 -0
  72. readcon_chemfiles-0.13.0/readme_src.org +141 -0
  73. readcon_chemfiles-0.13.0/resources/test/cuh2.con +231 -0
  74. readcon_chemfiles-0.13.0/resources/test/sulfolene.con +30 -0
  75. readcon_chemfiles-0.13.0/resources/test/tiny_cuh2.con +17 -0
  76. readcon_chemfiles-0.13.0/resources/test/tiny_cuh2.convel +26 -0
  77. readcon_chemfiles-0.13.0/resources/test/tiny_cuh2_forces.con +26 -0
  78. readcon_chemfiles-0.13.0/resources/test/tiny_cuh2_vel_forces.con +35 -0
  79. readcon_chemfiles-0.13.0/resources/test/tiny_multi_cuh2.con +34 -0
  80. readcon_chemfiles-0.13.0/resources/test/tiny_multi_cuh2.convel +52 -0
  81. readcon_chemfiles-0.13.0/schema/ReadCon.capnp +45 -0
  82. readcon_chemfiles-0.13.0/scripts/org_to_md.sh +57 -0
  83. readcon_chemfiles-0.13.0/scripts/regen-capi-headers.sh +50 -0
  84. readcon_chemfiles-0.13.0/scripts/release-prep.sh +62 -0
  85. readcon_chemfiles-0.13.0/src/array.rs +197 -0
  86. readcon_chemfiles-0.13.0/src/chemfiles_import.rs +138 -0
  87. readcon_chemfiles-0.13.0/src/chemfiles_import_imp.rs +635 -0
  88. readcon_chemfiles-0.13.0/src/chemfiles_selection.rs +101 -0
  89. readcon_chemfiles-0.13.0/src/chemfiles_selection_imp.rs +703 -0
  90. readcon_chemfiles-0.13.0/src/compression.rs +158 -0
  91. readcon_chemfiles-0.13.0/src/error.rs +97 -0
  92. readcon_chemfiles-0.13.0/src/ffi.rs +3197 -0
  93. readcon_chemfiles-0.13.0/src/helpers.rs +266 -0
  94. readcon_chemfiles-0.13.0/src/iterators.rs +356 -0
  95. readcon_chemfiles-0.13.0/src/lib.rs +59 -0
  96. readcon_chemfiles-0.13.0/src/main.rs +77 -0
  97. readcon_chemfiles-0.13.0/src/metatensor_export.rs +204 -0
  98. readcon_chemfiles-0.13.0/src/parser.rs +1821 -0
  99. readcon_chemfiles-0.13.0/src/python.rs +1347 -0
  100. readcon_chemfiles-0.13.0/src/rpc/client.rs +79 -0
  101. readcon_chemfiles-0.13.0/src/rpc/mod.rs +7 -0
  102. readcon_chemfiles-0.13.0/src/rpc/server.rs +227 -0
  103. readcon_chemfiles-0.13.0/src/types.rs +2406 -0
  104. readcon_chemfiles-0.13.0/src/writer.rs +366 -0
  105. readcon_chemfiles-0.13.0/tests/common/mod.rs +13 -0
  106. readcon_chemfiles-0.13.0/tests/convelwriter.rs +68 -0
  107. readcon_chemfiles-0.13.0/tests/conwriter.rs +236 -0
  108. readcon_chemfiles-0.13.0/tests/ffi_compressed_writer.rs +160 -0
  109. readcon_chemfiles-0.13.0/tests/parsecon.rs +184 -0
  110. readcon_chemfiles-0.13.0/tests/parseconvel.rs +109 -0
  111. readcon_chemfiles-0.13.0/tests/parseforces.rs +242 -0
  112. readcon_chemfiles-0.13.0/tests/python/test_ase.py +230 -0
  113. readcon_chemfiles-0.13.0/tests/python/test_chemfiles_selection.py +112 -0
  114. readcon_chemfiles-0.13.0/tests/python/test_readcon.py +426 -0
  115. readcon_chemfiles-0.13.0/valgrind.supp +46 -0
@@ -0,0 +1,6 @@
1
+ # chemfiles-sys vendors an older CMakeLists that still declares
2
+ # cmake_minimum_required(< 3.5). Modern CMake rejects that unless
3
+ # CMAKE_POLICY_VERSION_MINIMUM is set; export it for all cargo builds
4
+ # that pull the optional `chemfiles` feature.
5
+ [env]
6
+ CMAKE_POLICY_VERSION_MINIMUM = "3.5"
@@ -0,0 +1,55 @@
1
+ name: Basic tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ concurrency:
9
+ group: btest_rust-${{ github.ref }}
10
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
11
+
12
+ jobs:
13
+ btest_rust:
14
+ runs-on: ubuntu-22.04
15
+ name: Run basic tests and build
16
+
17
+ steps:
18
+ - uses: actions/checkout@v6
19
+
20
+ - name: Install Rust toolchain
21
+ uses: dtolnay/rust-toolchain@stable
22
+
23
+ - name: Setup sccache
24
+ uses: mozilla-actions/sccache-action@v0.0.9
25
+ with:
26
+ version: "v0.10.0"
27
+
28
+ - name: Setup sccache environment
29
+ run: |
30
+ echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
31
+ echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
32
+
33
+ - name: Install dependencies
34
+ run: |
35
+ python -m pip install meson ninja
36
+ cargo install cbindgen
37
+ sudo snap install valgrind --classic
38
+ sudo apt-get update && sudo apt-get install -y libc6-dbg --fix-missing
39
+
40
+ - name: Verify shipped C header matches cbindgen output
41
+ run: scripts/regen-capi-headers.sh --check
42
+
43
+ - name: Run Rust tests
44
+ run: cargo test
45
+
46
+ - name: Build and test FFI bindings
47
+ id: btest_rust
48
+ run: |
49
+ meson setup bbdir \
50
+ -Dwith_tests=False \
51
+ -Dwith_cpp=True \
52
+ -Dwith_examples=True \
53
+ --buildtype=release
54
+ meson test -C bbdir \
55
+ --wrap="valgrind --leak-check=full --show-leak-kinds=definite,indirect,possible --track-origins=yes --error-exitcode=1 --suppressions=$GITHUB_WORKSPACE/valgrind.supp --gen-suppressions=all"
@@ -0,0 +1,38 @@
1
+ name: Comment benchmark results
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["Benchmark PR"]
6
+ types: [completed]
7
+
8
+ jobs:
9
+ comment:
10
+ if: >-
11
+ github.event.workflow_run.event == 'pull_request' &&
12
+ github.event.workflow_run.conclusion == 'success'
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ pull-requests: write
16
+ issues: write
17
+ actions: read
18
+
19
+ steps:
20
+ - name: Download benchmark results
21
+ uses: actions/download-artifact@v4
22
+ with:
23
+ name: benchmark-results
24
+ path: results/
25
+ run-id: ${{ github.event.workflow_run.id }}
26
+ github-token: ${{ secrets.GITHUB_TOKEN }}
27
+
28
+ - name: Post benchmark comment
29
+ uses: HaoZeke/asv-perch@v1
30
+ with:
31
+ github-token: ${{ secrets.GITHUB_TOKEN }}
32
+ comparison-text-file: results/comparison.txt
33
+ metadata-file: results/metadata.txt
34
+ regression-threshold: '10'
35
+ auto-draft-on-regression: 'true'
36
+ label-before: main
37
+ label-after: pr
38
+ runner-info: ubuntu-22.04
@@ -0,0 +1,105 @@
1
+ name: Benchmark PR
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
4
+ cancel-in-progress: true
5
+ on:
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ SCCACHE_GHA_ENABLED: "true"
11
+
12
+ jobs:
13
+ benchmark:
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ include:
18
+ - label: main
19
+ sha: ${{ github.event.pull_request.base.sha }}
20
+ - label: pr
21
+ sha: ${{ github.event.pull_request.head.sha }}
22
+ runs-on: ubuntu-22.04
23
+ steps:
24
+ - uses: actions/checkout@v6
25
+ with:
26
+ fetch-depth: 0
27
+
28
+ - name: Checkout target commit
29
+ run: |
30
+ mkdir -p /tmp/_bench_preserve
31
+ cp -r benches/ /tmp/_bench_preserve/
32
+ git checkout -f ${{ matrix.sha }}
33
+ git clean -fd
34
+ cp -r /tmp/_bench_preserve/benches/ benches/
35
+
36
+ - name: Install Rust toolchain
37
+ uses: dtolnay/rust-toolchain@stable
38
+
39
+ - name: Configure sccache
40
+ uses: mozilla-actions/sccache-action@v0.0.9
41
+ with:
42
+ version: "v0.10.0"
43
+
44
+ - name: Setup sccache environment
45
+ run: |
46
+ echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
47
+
48
+ - name: Run benchmarks
49
+ run: |
50
+ cargo bench --bench iterator_bench -- --save-baseline ${{ matrix.label }}
51
+
52
+ - name: Export Criterion results
53
+ run: |
54
+ tar czf criterion-${{ matrix.label }}.tar.gz -C target criterion/
55
+
56
+ - uses: actions/upload-artifact@v4
57
+ with:
58
+ name: criterion-${{ matrix.label }}
59
+ path: criterion-${{ matrix.label }}.tar.gz
60
+ retention-days: 7
61
+
62
+ compare:
63
+ needs: benchmark
64
+ runs-on: ubuntu-latest
65
+ steps:
66
+ - name: Install Rust toolchain
67
+ uses: dtolnay/rust-toolchain@stable
68
+
69
+ - name: Install critcmp
70
+ run: cargo install critcmp
71
+
72
+ - name: Download main results
73
+ uses: actions/download-artifact@v4
74
+ with:
75
+ name: criterion-main
76
+ path: .
77
+
78
+ - name: Download PR results
79
+ uses: actions/download-artifact@v4
80
+ with:
81
+ name: criterion-pr
82
+ path: .
83
+
84
+ - name: Extract and compare
85
+ run: |
86
+ mkdir -p target
87
+ tar xzf criterion-main.tar.gz -C target/
88
+ tar xzf criterion-pr.tar.gz -C target/
89
+ mkdir -p results
90
+ critcmp main pr --threshold 5 > results/comparison.txt || true
91
+ if [ ! -s results/comparison.txt ]; then
92
+ echo "No benchmark comparison output" > results/comparison.txt
93
+ fi
94
+ cat results/comparison.txt
95
+
96
+ - name: Write metadata
97
+ run: |
98
+ echo "main_sha=${{ github.event.pull_request.base.sha }}" > results/metadata.txt
99
+ echo "pr_sha=${{ github.event.pull_request.head.sha }}" >> results/metadata.txt
100
+
101
+ - uses: actions/upload-artifact@v4
102
+ with:
103
+ name: benchmark-results
104
+ path: results/
105
+ retention-days: 7
@@ -0,0 +1,23 @@
1
+ name: Comment on pull request
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["Documentation"]
6
+ types: [completed]
7
+
8
+ jobs:
9
+ pr_comment:
10
+ if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ pull-requests: write
14
+ issues: write
15
+ actions: read
16
+
17
+ steps:
18
+ - uses: HaoZeke/doc-previewer@0e1094735b4f7ee9a2c60a18a34d7a7e5bc6bb63
19
+ with:
20
+ workflow_run_id: ${{ github.event.workflow_run.id }}
21
+ head_sha: ${{ github.event.workflow_run.head_sha }}
22
+ artifact_name: github-pages
23
+ comment_header: "### readcon-core Documentation Preview"
@@ -0,0 +1,55 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ concurrency:
15
+ group: "pages"
16
+ cancel-in-progress: false
17
+
18
+ jobs:
19
+ build:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v6
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - uses: prefix-dev/setup-pixi@v0.9.4
27
+ with:
28
+ cache: true
29
+ cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
30
+ environments: docs
31
+
32
+ - name: Add cargo bin to PATH
33
+ run: echo "${{ runner.temp }}/.cargo/bin" >> "$GITHUB_PATH"
34
+
35
+ - name: Build documentation
36
+ run: pixi r -e docs docbld
37
+ env:
38
+ CARGO_HOME: ${{ runner.temp }}/.cargo
39
+
40
+ - name: Upload artifact
41
+ uses: actions/upload-pages-artifact@v4
42
+ with:
43
+ path: docs/build
44
+
45
+ deploy:
46
+ if: github.ref == 'refs/heads/main'
47
+ needs: build
48
+ runs-on: ubuntu-latest
49
+ environment:
50
+ name: github-pages
51
+ url: ${{ steps.deployment.outputs.page_url }}
52
+ steps:
53
+ - name: Deploy to GitHub Pages
54
+ id: deployment
55
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,76 @@
1
+ name: Coverage
2
+ # Adapted from https://github.com/metatensor/metatensor/pull/939
3
+
4
+ on:
5
+ push:
6
+ branches: [main]
7
+ pull_request:
8
+
9
+ concurrency:
10
+ group: coverage-${{ github.ref }}
11
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
12
+
13
+ jobs:
14
+ coverage:
15
+ runs-on: ubuntu-22.04
16
+ name: collect code coverage
17
+ # Adapted from https://www.scivision.dev/github-actions-latest-llvm-clang-flang/
18
+ strategy:
19
+ matrix:
20
+ llvm-version: [20]
21
+ env:
22
+ CMAKE_C_COMPILER: clang-${{ matrix.llvm-version }}
23
+ CMAKE_CXX_COMPILER: clang++-${{ matrix.llvm-version }}
24
+ CC: clang-${{ matrix.llvm-version }}
25
+ CXX: clang++-${{ matrix.llvm-version }}
26
+
27
+ steps:
28
+ - uses: actions/checkout@v6
29
+
30
+ - name: Setup LLVM
31
+ run: |
32
+ wget https://apt.llvm.org/llvm.sh
33
+ chmod +x llvm.sh
34
+ sudo ./llvm.sh ${{ matrix.llvm-version }}
35
+ sudo apt-get update
36
+ sudo apt-get install --no-install-recommends -y clang-${{ matrix.llvm-version }}
37
+
38
+ - name: Install Rust toolchain
39
+ uses: dtolnay/rust-toolchain@stable
40
+ with:
41
+ components: llvm-tools-preview
42
+
43
+ - name: Install cargo-llvm-cov
44
+ uses: taiki-e/install-action@cargo-llvm-cov
45
+
46
+ - uses: prefix-dev/setup-pixi@v0.9.4
47
+ with:
48
+ cache: true
49
+ environments: default
50
+
51
+ - name: Setup sccache
52
+ uses: mozilla-actions/sccache-action@v0.0.9
53
+ with:
54
+ version: "v0.10.0"
55
+
56
+ - name: Setup sccache environment
57
+ run: |
58
+ echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
59
+ echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
60
+
61
+ - name: Generate rust code coverage
62
+ id: coverage
63
+ run: |
64
+ PIXI_PYTHON="$(pixi r -e default which python)"
65
+ PYO3_PYTHON="$PIXI_PYTHON" pixi r -e default \
66
+ cargo llvm-cov --features rpc,python --workspace \
67
+ --no-fail-fast --codecov \
68
+ --include-ffi \
69
+ --output-path rust_codecov.json
70
+
71
+ # - name: Upload to codecov.io
72
+ # uses: codecov/codecov-action@v5
73
+ # with:
74
+ # fail_ci_if_error: true
75
+ # files: rust_codecov.json
76
+ # token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,69 @@
1
+ # Publish readcon-core to crates.io on version tags.
2
+ # Secret: CARGO_REGISTRY_TOKEN (crates.io API token for the publish owner).
3
+ # cargo-dist's Release workflow handles binary archives + GitHub Release only.
4
+ name: Publish to crates.io
5
+
6
+ on:
7
+ push:
8
+ tags:
9
+ - 'v*'
10
+ workflow_dispatch:
11
+ inputs:
12
+ tag:
13
+ description: 'Tag to publish (e.g. v0.13.0); defaults to ref'
14
+ required: false
15
+ type: string
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ publish-crates-io:
22
+ name: Publish to crates.io
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v6
26
+ with:
27
+ ref: ${{ inputs.tag || github.ref }}
28
+
29
+ - name: Install Rust toolchain
30
+ uses: dtolnay/rust-toolchain@stable
31
+
32
+ - name: Resolve crate version
33
+ id: check
34
+ run: |
35
+ # Prefer Cargo.toml so workflow_dispatch on `main` still targets the
36
+ # package version. On a v* tag, ref name must match Cargo.toml.
37
+ version="$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -1)"
38
+ ref_name="${GITHUB_REF_NAME:-}"
39
+ if [ -n "${{ inputs.tag }}" ]; then
40
+ ref_name="${{ inputs.tag }}"
41
+ fi
42
+ if [[ "$ref_name" == v* ]]; then
43
+ tag_ver="${ref_name#v}"
44
+ if [ "$tag_ver" != "$version" ]; then
45
+ echo "tag ${ref_name} does not match Cargo.toml version ${version}" >&2
46
+ exit 1
47
+ fi
48
+ fi
49
+ echo "version=${version}" >> "$GITHUB_OUTPUT"
50
+ if curl -sfL \
51
+ -H "User-Agent: readcon-core-release-check (lode-org)" \
52
+ "https://crates.io/api/v1/crates/readcon-core/${version}" \
53
+ -o /dev/null; then
54
+ echo "already_published=true" >> "$GITHUB_OUTPUT"
55
+ echo "readcon-core ${version} is already published; skipping."
56
+ else
57
+ echo "already_published=false" >> "$GITHUB_OUTPUT"
58
+ fi
59
+
60
+ - name: cargo publish
61
+ if: steps.check.outputs.already_published != 'true'
62
+ env:
63
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
64
+ run: |
65
+ if [ -z "${CARGO_REGISTRY_TOKEN:-}" ]; then
66
+ echo "CARGO_REGISTRY_TOKEN secret is empty; set it on the repo." >&2
67
+ exit 1
68
+ fi
69
+ cargo publish --locked
@@ -0,0 +1,21 @@
1
+ name: Lint
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ jobs:
7
+ lint:
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v6
12
+ with:
13
+ fetch-depth: 0
14
+
15
+ - name: Conventional commits check
16
+ uses: cocogitto/cocogitto-action@v3
17
+
18
+ - name: Audit for large files
19
+ uses: HaoZeke/large-file-auditor@v0.1.0
20
+ with:
21
+ file-size-threshold: "1M"
@@ -0,0 +1,208 @@
1
+ name: Python wheels
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ pull_request:
8
+ paths:
9
+ - 'src/**'
10
+ - 'Cargo.toml'
11
+ - 'Cargo.lock'
12
+ - 'pyproject.toml'
13
+ - 'pyproject.chemfiles.toml'
14
+ - '.github/workflows/python_wheels.yml'
15
+ workflow_dispatch:
16
+
17
+ concurrency:
18
+ group: python-wheels-${{ github.ref }}
19
+ cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
20
+
21
+ permissions:
22
+ contents: read
23
+
24
+ env:
25
+ CARGO_HTTP_MULTIPLEXING: "false"
26
+ CARGO_NET_RETRY: "10"
27
+ CARGO_HTTP_TIMEOUT: "120"
28
+
29
+ jobs:
30
+ # Lean `readcon` + chemfiles-linked `readcon-chemfiles` (separate PyPI names,
31
+ # same extension module `readcon`). Matrix is the usual dual-distribution pattern.
32
+ sdist:
33
+ name: Build sdist (${{ matrix.variant }})
34
+ runs-on: ubuntu-latest
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ include:
39
+ - variant: default
40
+ pyproject: pyproject.toml
41
+ - variant: chemfiles
42
+ pyproject: pyproject.chemfiles.toml
43
+ steps:
44
+ - uses: actions/checkout@v6
45
+
46
+ - name: Select pyproject for variant
47
+ shell: bash
48
+ run: |
49
+ if [ "${{ matrix.pyproject }}" != "pyproject.toml" ]; then
50
+ cp "${{ matrix.pyproject }}" pyproject.toml
51
+ fi
52
+ head -15 pyproject.toml
53
+
54
+ - name: Build sdist
55
+ uses: PyO3/maturin-action@v1
56
+ with:
57
+ command: sdist
58
+ args: --out dist
59
+
60
+ - name: Validate sdist
61
+ run: pipx run twine check --strict dist/*
62
+
63
+ - uses: actions/upload-artifact@v4
64
+ with:
65
+ name: sdist-${{ matrix.variant }}
66
+ path: dist/*.tar.gz
67
+ if-no-files-found: error
68
+
69
+ wheels:
70
+ name: Wheel ${{ matrix.variant }} (${{ matrix.os }}, ${{ matrix.target }})
71
+ runs-on: ${{ matrix.os }}
72
+ strategy:
73
+ fail-fast: false
74
+ # Explicit rows only (no axis × include cartesian product).
75
+ matrix:
76
+ include:
77
+ # --- default (lean): features from pyproject.toml [tool.maturin]
78
+ - variant: default
79
+ os: ubuntu-latest
80
+ target: x86_64
81
+ pyproject: pyproject.toml
82
+ features: python
83
+ - variant: default
84
+ os: ubuntu-22.04
85
+ target: aarch64
86
+ pyproject: pyproject.toml
87
+ features: python
88
+ - variant: default
89
+ os: macos-15
90
+ target: x86_64
91
+ pyproject: pyproject.toml
92
+ features: python
93
+ - variant: default
94
+ os: macos-14
95
+ target: aarch64
96
+ pyproject: pyproject.toml
97
+ features: python
98
+ - variant: default
99
+ os: windows-latest
100
+ target: x86_64
101
+ pyproject: pyproject.toml
102
+ features: python
103
+ # --- chemfiles-linked distribution (readcon-chemfiles on PyPI)
104
+ - variant: chemfiles
105
+ os: ubuntu-latest
106
+ target: x86_64
107
+ pyproject: pyproject.chemfiles.toml
108
+ features: python,chemfiles
109
+ - variant: chemfiles
110
+ os: ubuntu-22.04
111
+ target: aarch64
112
+ pyproject: pyproject.chemfiles.toml
113
+ features: python,chemfiles
114
+ - variant: chemfiles
115
+ os: macos-15
116
+ target: x86_64
117
+ pyproject: pyproject.chemfiles.toml
118
+ features: python,chemfiles
119
+ - variant: chemfiles
120
+ os: macos-14
121
+ target: aarch64
122
+ pyproject: pyproject.chemfiles.toml
123
+ features: python,chemfiles
124
+ # Windows + chemfiles-sys/CMake is unreliable on GHA; ship lean
125
+ # Windows wheels only. Linux/macOS cover full chemfiles matrices.
126
+ # - variant: chemfiles / windows-latest — omitted on purpose
127
+ steps:
128
+ - uses: actions/checkout@v6
129
+
130
+ - uses: actions/setup-python@v5
131
+ with:
132
+ python-version: '3.12'
133
+
134
+ - name: Select pyproject for variant
135
+ shell: bash
136
+ run: |
137
+ if [ "${{ matrix.pyproject }}" != "pyproject.toml" ]; then
138
+ cp "${{ matrix.pyproject }}" pyproject.toml
139
+ fi
140
+ echo "Building features=${{ matrix.features }} from:"
141
+ head -20 pyproject.toml
142
+
143
+ - name: Build wheels
144
+ id: build1
145
+ continue-on-error: true
146
+ uses: PyO3/maturin-action@v1
147
+ with:
148
+ target: ${{ matrix.target }}
149
+ args: --release --out dist --features ${{ matrix.features }} --find-interpreter
150
+ manylinux: auto
151
+ docker-options: >-
152
+ -e CARGO_HTTP_MULTIPLEXING=false
153
+ -e CARGO_NET_RETRY=10
154
+ -e CARGO_HTTP_TIMEOUT=120
155
+ -e CMAKE_POLICY_VERSION_MINIMUM=3.5
156
+
157
+ - name: Build wheels (retry)
158
+ if: steps.build1.outcome == 'failure'
159
+ uses: PyO3/maturin-action@v1
160
+ with:
161
+ target: ${{ matrix.target }}
162
+ args: --release --out dist --features ${{ matrix.features }} --find-interpreter
163
+ manylinux: auto
164
+ docker-options: >-
165
+ -e CARGO_HTTP_MULTIPLEXING=false
166
+ -e CARGO_NET_RETRY=10
167
+ -e CARGO_HTTP_TIMEOUT=120
168
+ -e CMAKE_POLICY_VERSION_MINIMUM=3.5
169
+
170
+ - name: Validate wheels
171
+ if: matrix.target != 'aarch64' || runner.os != 'Linux'
172
+ run: pipx run twine check --strict dist/*
173
+
174
+ - uses: actions/upload-artifact@v4
175
+ with:
176
+ name: wheels-${{ matrix.variant }}-${{ matrix.os }}-${{ matrix.target }}
177
+ path: dist/*.whl
178
+ if-no-files-found: error
179
+
180
+ publish:
181
+ name: Publish to PyPI
182
+ needs: [sdist, wheels]
183
+ runs-on: ubuntu-latest
184
+ if: startsWith(github.ref, 'refs/tags/v')
185
+ environment:
186
+ name: pypi
187
+ url: https://pypi.org/p/readcon
188
+ permissions:
189
+ id-token: write
190
+ steps:
191
+ - uses: actions/download-artifact@v4
192
+ with:
193
+ pattern: '{sdist-*,wheels-*}'
194
+ merge-multiple: true
195
+ path: dist/
196
+
197
+ - name: List artifacts
198
+ run: |
199
+ ls -la dist/
200
+ echo "--- expected packages: readcon (lean) and readcon-chemfiles (full) ---"
201
+ ls dist/*.whl dist/*.tar.gz | sed 's|.*/||' | sort -u
202
+
203
+ # Trusted publishers must be configured on PyPI for *both* project names
204
+ # `readcon` and `readcon-chemfiles` (same workflow + environment `pypi`).
205
+ - name: Publish to PyPI
206
+ uses: pypa/gh-action-pypi-publish@release/v1
207
+ with:
208
+ skip-existing: true