mapping-commons / sssom-py

Python toolkit for SSSOM mapping format
https://mapping-commons.github.io/sssom-py/index.html#
MIT License
49 stars 12 forks source link

Add list of breaking changes since sssom release 0.3.31 #461

Open matentzn opened 10 months ago

matentzn commented 10 months ago

We need a list of breaking changes since sssom release 0.3.31, to communicate this with stakeholders before the 0.4 release.

@cthoyt my assumption is you dont want to do this, right?

hrshdhgd commented 9 months ago

Active list being updated:

hrshdhgd commented 9 months ago

The above were the refactors for oaklib. For the rest, Charlie knows best...

matentzn commented 9 months ago

Fantastic! Is there a way to get a list of all functions that

  1. changed name
  2. changed package
  3. changed parameter list

using some tool?

cthoyt commented 9 months ago

Reading through https://github.com/mapping-commons/sssom-py/compare/v0.3.41...v0.4.0-rc1 is not fun but is one way to do it. Maybe also contextualizing with the various PR descriptions

matentzn commented 9 months ago

@hrshdhgd I made a quick diff to get a sense of some of the more important changes:

-def validate(input: str, validation_types: tuple):
+def validate(input: str, validation_types: List[SchemaValidationType]):
-def crosstab(input: str, output: TextIO, transpose: bool, fields: Tuple):
+def crosstab(input: str, output: TextIO, transpose: bool, fields: Tuple[str, str]):
-def correlations(input: str, output: TextIO, transpose: bool, fields: Tuple):
+def correlations(input: str, output: TextIO, transpose: bool, fields: Tuple[str, str]):
-def get_jsonld_context():
-def get_extended_prefix_map():
-def get_built_in_prefix_map() -> PrefixMap:
+def _get_built_in_prefix_map() -> Converter:
-def add_built_in_prefixes_to_prefix_map(
+def ensure_converter(prefix_map: ConverterHint = None, *, use_defaults: bool = True) -> Converter:
-def get_default_metadata() -> Metadata:
-def _raise_on_invalid_prefix_map(prefix_map):
-def set_default_mapping_set_id(meta: Metadata) -> Metadata:
-def set_default_license(meta: Metadata) -> Metadata:
-def _get_prefix_map(metadata: Metadata, prefix_map_mode: str = None):
-def get_list_of_predicate_iri(predicate_filter: tuple, prefix_map: dict) -> list:
+def get_list_of_predicate_iri(predicate_filter: Iterable[str], converter: Converter) -> list:
-def extract_iri(input: str, prefix_map: Dict[str, str]) -> List[str]:
+def extract_iris(
-def read_sssom_table(
-def read_sssom_rdf(
-def read_sssom_json(
-def _cell_element_values(cell_node, converter: Converter, mapping_predicates) -> Optional[Mapping]:
+def _cell_element_values(cell_node, converter: Converter, mapping_predicates) -> Dict[str, Any]:
-def sha256sum(path: str) -> str:
-def read_csv(
-def read_metadata(filename: str) -> Metadata:
-def read_pandas(file: Union[str, Path, TextIO], sep: Optional[str] = None) -> pd.DataFrame:
-def extract_global_metadata(msdoc: MappingSetDocument) -> Dict[str, PrefixMap]:
+def _extract_global_metadata(msdoc: MappingSetDocument) -> MetadataType:
-def get_prefixes_used_in_table(df: pd.DataFrame) -> List[str]:
+def get_prefixes_used_in_table(df: pd.DataFrame, converter: Converter) -> Set[str]:
-def guess_file_format(filename: Union[str, TextIO]) -> str:
-def get_all_prefixes(msdf: MappingSetDataFrame) -> list:
+def get_all_prefixes(msdf: MappingSetDataFrame) -> Set[str]:
-def to_dataframe(msdf: MappingSetDataFrame) -> pd.DataFrame:

A big red flag is:

-def read_sssom_table(
-def read_sssom_rdf(
-def read_sssom_json(
-def read_csv(
-def read_metadata(filename: str) -> Metadata:
-def read_pandas(file: Union[str, Path, TextIO], sep: Optional[str] = None) -> pd.DataFrame:

-> we should never delete public methods, always deprecate them. Can we chase down why this happened, and reinstate them (wrapping their replacements)?

cthoyt commented 9 months ago

I think all of the public methods deleted were marked as deprecated and the version where they were marked to be removed had already passed.

cthoyt commented 9 months ago

The minuses could have also happened if better type annotations got put and the defintion spilled over onto multiple lines. I don't think there are any places we removed non-expired code from the public interface

hrshdhgd commented 9 months ago

And Charlie is right, the deprecations were long overdue

matentzn commented 9 months ago

Ok thanks for checking!

matentzn commented 9 months ago

@hrshdhgd I will leave it to you to move this forward then!