diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..ce928e86 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,33 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +## Describe the bug + + + +## To Reproduce + + + +## Expected behavior + + + +## Environment + +- Python version: +- Spglib's version: + +## Additional context + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..a725315a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,24 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +## Is your feature request related to a problem? Please describe. + + + +## Describe the solution you'd like + + + +## Describe alternatives you've considered + + + +## Additional context + + diff --git a/.github/workflows/pypi-wheel-builds.yml b/.github/workflows/pypi-wheel-builds.yml new file mode 100644 index 00000000..c3113ea7 --- /dev/null +++ b/.github/workflows/pypi-wheel-builds.yml @@ -0,0 +1,78 @@ +name: Spglib PyPI Wheel builds for linux + +on: + push: + branches: + - rc + - master + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, windows-2019, macOS-11] + + steps: + - uses: actions/checkout@v3 + + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v2 + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v2.9.0 + env: + CIBW_ARCHS_LINUX: auto aarch64 + CIBW_ARCHS_MACOS: x86_64 arm64 + with: + package-dir: python + output-dir: wheelhouse + config-file: "{package}/pyproject.toml" + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build sdist + run: | + pip install numpy + cd python + sh pre-build-script.sh + python setup.py sdist + cd .. + - uses: actions/upload-artifact@v3 + with: + path: python/dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + + - name: Publish package to TestPyPI + if: startsWith(github.ref, 'refs/heads/rc') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + - name: Publish package to PyPI + if: startsWith(github.ref, 'refs/heads/master') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/pypi-wheels-win-mac.yml b/.github/workflows/pypi-wheels-win-mac.yml deleted file mode 100644 index 63bfdf8f..00000000 --- a/.github/workflows/pypi-wheels-win-mac.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Spglib PyPI Wheel builds for win and mac - -on: - push: - branches: - - rc - - master - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-2019, macOS-11] - - steps: - - uses: actions/checkout@v3 - - # Used to host cibuildwheel - - uses: actions/setup-python@v3 - - - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.9.0 - # to supply options, put them in 'env', like: - # env: - # CIBW_SOME_OPTION: value - - - name: Build wheels for macOS - if: matrix.os == 'macOS-11' - env: - CIBW_ARCHS_MACOS: x86_64 arm64 - run: | - python -m cibuildwheel --output-dir wheelhouse python - - - name: Build wheels for win - if: matrix.os != 'macOS-11' - run: | - python -m cibuildwheel --output-dir wheelhouse python - - - uses: actions/upload-artifact@v3 - with: - path: ./wheelhouse/*.whl - - # build_sdist: - # name: Build source distribution - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Build sdist - # run: | - # pip install numpy - # cd python - # sh pre-build-script.sh - # python setup.py sdist - # cd .. - # - uses: actions/upload-artifact@v3 - # with: - # path: python/dist/*.tar.gz - - upload_pypi: - # needs: [build_wheels, build_sdist] - needs: [build_wheels] - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - - name: Publish package to TestPyPI - if: startsWith(github.ref, 'refs/heads/rc') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - - - name: Publish package to PyPI - if: startsWith(github.ref, 'refs/heads/master') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/pypi-wheels.yml b/.github/workflows/pypi-wheels.yml deleted file mode 100644 index 5f1e9e53..00000000 --- a/.github/workflows/pypi-wheels.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Spglib PyPI Wheel builds - -on: - push: - branches: - - rc - - master - -jobs: - build-wheel: - name: Build ${{ matrix.platform }} wheels - runs-on: ubuntu-latest - strategy: - matrix: - platform: - - manylinux2014_x86_64 - - manylinux2014_aarch64 - - manylinux2010_x86_64 - fail-fast: false - steps: - - uses: actions/checkout@v2 - - - name: Set up QEMU - if: matrix.platform == 'manylinux2014_aarch64' - uses: docker/setup-qemu-action@v1 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Build sdist - if: matrix.platform == 'manylinux2010_x86_64' - run: | - pip install numpy - cd python - sh pre-build-script.sh - python setup.py sdist - cd .. - - name: Build manylinux Python wheels manylinux2014_x86_64 - if: matrix.platform == 'manylinux2014_x86_64' - uses: RalfG/python-wheels-manylinux-build@v0.3.4-manylinux2014_x86_64 - with: - python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310' - pre-build-command: 'sh pre-build-script.sh' - package-path: ./python - - name: Build manylinux Python wheels manylinux2014_aarch64 - if: matrix.platform == 'manylinux2014_aarch64' - uses: RalfG/python-wheels-manylinux-build@v0.3.4-manylinux2014_aarch64 - with: - python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310' - pre-build-command: 'sh pre-build-script.sh' - package-path: ./python - - name: Build manylinux Python wheels manylinux2010_x86_64 - if: matrix.platform == 'manylinux2010_x86_64' - uses: RalfG/python-wheels-manylinux-build@v0.3.4-manylinux2010_x86_64 - with: - python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310' - pre-build-command: 'sh pre-build-script.sh' - package-path: ./python - - name: mkdir - run: | - mkdir dist - - name: copy source - if: matrix.platform == 'manylinux2010_x86_64' - run: | - cp ./python/dist/*.tar.gz dist - - name: copy manylinux wheels - run: | - cp ./python/dist/*manylinux*whl dist - - - name: Publish package to TestPyPI - if: startsWith(github.ref, 'refs/heads/rc') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - - - name: Publish package to PyPI - if: startsWith(github.ref, 'refs/heads/master') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index e75ef1a6..4cd00535 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,17 @@ set(SOURCES ${PROJECT_SOURCE_DIR}/src/arithmetic.c ${PROJECT_SOURCE_DIR}/src/spin.c ${PROJECT_SOURCE_DIR}/src/symmetry.c) +# avoid One Definition Rule problems +# only available since 3.16.0 +# VERSION_GREATER_EQUAL only available since 3.7.0, so let's do it manually +if (NOT CMAKE_MAJOR_VERSION LESS "3") + if (CMAKE_MAJOR_VERSION GREATER "3" OR NOT CMAKE_MINOR_VERSION LESS "16") + set_source_files_properties( + ${SOURCES} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON + ) + endif() +endif() + # Shared library add_library(symspg SHARED ${SOURCES}) diff --git a/admin.md b/admin.md new file mode 100644 index 00000000..bda4f474 --- /dev/null +++ b/admin.md @@ -0,0 +1,6 @@ +# Releasing a new Spglib version + +1. Update +2. Increment version at +3. Push the commit to `rc` branch (Github actions publishes the package to TestPyPI automatically) +4. Push the commit to `master` branch (Github actions publishes the package to PyPI automatically) diff --git a/doc/magnetic_symmetry_flags.md b/doc/magnetic_symmetry_flags.md index 828024ba..6b14f5da 100644 --- a/doc/magnetic_symmetry_flags.md +++ b/doc/magnetic_symmetry_flags.md @@ -30,10 +30,10 @@ - `tensor_rank=1` - `with_time_reversal=true`: {math}`1' \circ \mathbf{m} = -\mathbf{m}` - `is_axial=true`: {math}`(\mathbf{R}, \mathbf{v}) \circ \mathbf{m} = (\mathrm{det} \mathbf{R}) \mathbf{R} \mathbf{m}` - - `is_axial=true`: {math}`(\mathbf{R}, \mathbf{v}) \circ \mathbf{m} = \mathbf{R} \mathbf{m}` + - `is_axial=false`: {math}`(\mathbf{R}, \mathbf{v}) \circ \mathbf{m} = \mathbf{R} \mathbf{m}` - `with_time_reversal=false`: {math}`1' \circ \mathbf{m} = \mathbf{m}` - `is_axial=true`: {math}`(\mathbf{R}, \mathbf{v}) \circ \mathbf{m} = (\mathrm{det} \mathbf{R}) \mathbf{R} \mathbf{m}` - - `is_axial=true`: {math}`(\mathbf{R}, \mathbf{v}) \circ \mathbf{m} = \mathbf{R} \mathbf{m}` + - `is_axial=false`: {math}`(\mathbf{R}, \mathbf{v}) \circ \mathbf{m} = \mathbf{R} \mathbf{m}`