Skip to content

Commit a18a1d9

Browse files
committed
Fix from_dict methods so that data and prim arguments are not mixed up; bump version 2.0.1
1 parent 03ab2df commit a18a1d9

File tree

13 files changed

+70
-22
lines changed

13 files changed

+70
-22
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## [2.0.1] - 2025-05-16
10+
11+
### Fixed
12+
13+
- Fixed `StructureMapping.from_dict`, `ScoredStructureMapping.from_dict`, `StructureMappingResults.from_dict` so that `prim` and `data` argument names are no longer mixed up
14+
15+
916
## [2.0.0] - 2025-05-02
1017

1118
### Fixed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.20)
22
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
33

4-
project(CASMcode_mapping VERSION 2.0.0 LANGUAGES CXX)
4+
project(CASMcode_mapping VERSION 2.0.1 LANGUAGES CXX)
55

66
# set CMAKE_INSTALL_X variables
77
include(GNUInstallDirs)

CMakeLists.txt.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.20)
22
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
33

4-
project(CASMcode_mapping VERSION 2.0.0 LANGUAGES CXX)
4+
project(CASMcode_mapping VERSION 2.0.1 LANGUAGES CXX)
55

66
# set CMAKE_INSTALL_X variables
77
include(GNUInstallDirs)

doc/doxygen_config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "CASM_mapping"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 2.0.0
41+
PROJECT_NUMBER = 2.0.1
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@ build-backend = "setuptools.build_meta"
1313

1414
[project]
1515
name = "libcasm-mapping"
16-
version = "2.0.0"
16+
version = "2.0.1"
1717
authors = [
1818
{ name="CASM developers", email="casm-developers@lists.engr.ucsb.edu" },
1919
]
2020
description = "CASM structure mapping"
2121
readme = "README.md"
2222
requires-python = ">=3.9,<3.14"
23-
license = {text = "LGPL2.1+"}
23+
license = "LGPL-2.1-or-later"
2424
classifiers = [
2525
"Development Status :: 5 - Production/Stable",
2626
"Programming Language :: Python :: 3",
2727
"Programming Language :: C++",
28-
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
2928
"Topic :: Scientific/Engineering",
3029
]
3130
dependencies = [

python/doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# -- package specific configuration --
44
project = "libcasm-mapping"
55
version = "2.0" # The short X.Y version.
6-
release = "2.0.0" # The full version, including alpha/beta/rc tags.
6+
release = "2.0.1" # The full version, including alpha/beta/rc tags.
77
project_desc = "CASM structure mapping"
88
logo_text = "libcasm-mapping"
99
github_url = "https://github.com/prisms-center/CASMcode_mapping/"

python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
__version__ = "2.0.0"
3+
__version__ = "2.0.1"
44

55
# Available at setup time due to pyproject.toml
66
from pybind11.setup_helpers import Pybind11Extension, build_ext

python/src/mapping_info.cpp

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,22 @@ PYBIND11_MODULE(_mapping_info, m) {
561561
return jsonConstructor<mapping::StructureMapping>::from_json(json,
562562
prim);
563563
},
564-
"Construct a StructureMapping from a Python dict.", py::arg("prim"),
565-
py::arg("data"))
564+
R"pbdoc(
565+
Construct a StructureMapping from a Python dict.
566+
567+
Parameters
568+
----------
569+
data : dict
570+
The StructureMapping as a Python dict
571+
prim : ~libcasm.xtal.Prim
572+
A :class:`~libcasm.xtal.Prim`
573+
574+
Returns
575+
-------
576+
structure_mapping : ~libcasm.mapping.info.StructureMapping
577+
The structure mapping
578+
)pbdoc",
579+
py::arg("data"), py::arg("prim"))
566580
.def(
567581
"to_dict",
568582
[](mapping::StructureMapping const &m) -> nlohmann::json {
@@ -616,8 +630,22 @@ PYBIND11_MODULE(_mapping_info, m) {
616630
return jsonConstructor<mapping::ScoredStructureMapping>::from_json(
617631
json, prim);
618632
},
619-
"Construct a ScoredStructureMapping from a Python dict.",
620-
py::arg("prim"), py::arg("data"))
633+
R"pbdoc(
634+
Construct a ScoredStructureMapping from a Python dict.
635+
636+
Parameters
637+
----------
638+
data : dict
639+
The ScoredStructureMapping as a Python dict
640+
prim : ~libcasm.xtal.Prim
641+
A :class:`~libcasm.xtal.Prim`
642+
643+
Returns
644+
-------
645+
scored_structure_mapping : ~libcasm.mapping.info.ScoredStructureMapping
646+
The scored structure mapping
647+
)pbdoc",
648+
py::arg("data"), py::arg("prim"))
621649
.def(
622650
"to_dict",
623651
[](mapping::ScoredStructureMapping const &m) -> nlohmann::json {
@@ -666,8 +694,22 @@ PYBIND11_MODULE(_mapping_info, m) {
666694
from_json(results, json, prim);
667695
return results;
668696
},
669-
"Construct StructureMappingResults from a Python dict.",
670-
py::arg("prim"), py::arg("data"))
697+
R"pbdoc(
698+
Construct StructureMappingResults from a Python dict.
699+
700+
Parameters
701+
----------
702+
data : dict
703+
The StructureMappingResults as a Python dict
704+
prim : ~libcasm.xtal.Prim
705+
A :class:`~libcasm.xtal.Prim`
706+
707+
Returns
708+
-------
709+
results : ~libcasm.mapping.info.StructureMappingResults
710+
The structure mapping results
711+
)pbdoc",
712+
py::arg("data"), py::arg("prim"))
671713
.def(
672714
"to_dict",
673715
[](mapping::StructureMappingResults const &m) -> nlohmann::json {

python/tests/test_info_io.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_structure_mapping_io():
2828
assert isinstance(structure_mappings, info.StructureMappingResults)
2929
data = structure_mappings.to_dict()
3030
assert isinstance(data, list)
31-
obj = info.StructureMappingResults.from_dict(data, prim)
31+
obj = info.StructureMappingResults.from_dict(data=data, prim=prim)
3232
assert isinstance(obj, info.StructureMappingResults)
3333
assert len(obj) == 3
3434

@@ -37,15 +37,15 @@ def test_structure_mapping_io():
3737
assert isinstance(scored, info.ScoredStructureMapping)
3838
data = scored.to_dict()
3939
assert isinstance(data, dict)
40-
obj = info.ScoredStructureMapping.from_dict(data, prim)
40+
obj = info.ScoredStructureMapping.from_dict(data=data, prim=prim)
4141
assert isinstance(obj, info.ScoredStructureMapping)
4242

4343
# StructureMapping
4444
smap = info.StructureMapping(prim, scored.lattice_mapping(), scored.atom_mapping())
4545
assert isinstance(smap, info.StructureMapping)
4646
data = smap.to_dict()
4747
assert isinstance(data, dict)
48-
obj = info.StructureMapping.from_dict(data, prim)
48+
obj = info.StructureMapping.from_dict(data=data, prim=prim)
4949
assert isinstance(obj, info.StructureMapping)
5050

5151
# LatticeMapping

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="libcasm-mapping",
5-
version="2.0.0",
5+
version="2.0.1",
66
packages=[
77
"libcasm",
88
"libcasm.mapping",

0 commit comments

Comments
 (0)