diff --git a/README.md b/README.md deleted file mode 100644 index 82a17987..00000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# MapplePy diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..290badf4 --- /dev/null +++ b/README.rst @@ -0,0 +1,29 @@ +############################### +MapplePy +############################### + +MapplePy is a python library for enumerating Cayley permutation classes which avoid non-classical patterns and grid classes. + +A Cayley permutation is a word `π ∈ ℕ*` such that every number between 1 and the maximum value of `π` appears at least once. Cayley permutations can be seen as a generalisation of permutations where repeated values are allowed. Definitions of pattern containment and Cayley permutation classes follow the same ideas as defined for permutations where the patterns contained are also Cayley permutations, so the Cayley permutation class Av(11) describes all permutations. Cayley permutations are in bijection with ordered set partitions. + +If you need support, you can join us in our `Discord support server`_. + +.. _Discord support server: https://discord.gg/ngPZVT5 + +========== +Installing +========== + +To install MapplePy on your system, run the following after cloning the repository: + +.. code-block:: bash + + ./pip install . + +It is also possible to install MapplePy in development mode to work on the +source code, in which case you run the following after cloning the repository: + +.. code-block:: bash + + ./pip install -e . + diff --git a/mapplings/algorithms/__init__.py b/mapplings/algorithms/__init__.py index c6284125..d4fe5fd6 100644 --- a/mapplings/algorithms/__init__.py +++ b/mapplings/algorithms/__init__.py @@ -4,7 +4,6 @@ from .row_col_sep_mt import MTLTRowColSeparation, MTLTORERowColSeparation from .point_placement import MTRequirementPlacement - __all__ = [ "MTFactors", "MTILFactorNormal", diff --git a/mapplings/algorithms/factor.py b/mapplings/algorithms/factor.py index 836cdf2f..792ad31b 100644 --- a/mapplings/algorithms/factor.py +++ b/mapplings/algorithms/factor.py @@ -9,7 +9,6 @@ from mapplings import MappedTiling, ParameterList, Parameter from mapplings.cleaners import MTCleaner - Cell = tuple[int, int] diff --git a/mapplings/cleaners/mappling_cleaner.py b/mapplings/cleaners/mappling_cleaner.py index f0209770..4a4464b5 100644 --- a/mapplings/cleaners/mappling_cleaner.py +++ b/mapplings/cleaners/mappling_cleaner.py @@ -14,6 +14,7 @@ from .cleaner import GenericCleaner, Register, CleanerLog from .parameter_cleaner import ParamCleaner +from .unplacement import ParamUnplacement default_param_cleaner = ParamCleaner.make_full_cleaner("Param Default Cleaner") @@ -83,6 +84,22 @@ def fully_clean_parameters(mappling: MappedTiling) -> MappedTiling: """Applies all parameter cleanning functions to all parameters""" return MTCleaner.clean_parameters(default_param_cleaner)(mappling) + @staticmethod + @reg(7) + def param_unplacement(mappling: MappedTiling) -> MappedTiling: + """Applies point unplacement to all avoiders and containers""" + avoiders, containers, enumerators = mappling.ace_parameters() + new_avoiders = ParameterList( + ParamUnplacement(av, mappling).auto_unplace() for av in avoiders + ) + new_containers = [ + ParameterList( + ParamUnplacement(co, mappling).auto_unplace() for co in c_list + ) + for c_list in containers + ] + return MappedTiling(mappling.tiling, new_avoiders, new_containers, enumerators) + @staticmethod @reg(0) def try_to_kill(mappling: MappedTiling) -> MappedTiling: @@ -106,7 +123,7 @@ def try_to_kill(mappling: MappedTiling) -> MappedTiling: return mappling @staticmethod - @reg(8, False) # Broken + @reg(9, False) # Broken def factor_containters(mappling: MappedTiling) -> MappedTiling: """Factors out the intersection factors of a containing parameter list""" new_containers = list( @@ -129,7 +146,7 @@ def factor_containters(mappling: MappedTiling) -> MappedTiling: ) @staticmethod - @reg(10, update_register=False) + @reg(11, update_register=False) def backmap_points(mappling: MappedTiling) -> MappedTiling: """Backmaps point obstructions to all parameters""" point_obstructions = (ob for ob in mappling.obstructions if len(ob) == 1) @@ -152,14 +169,22 @@ def reap_all_contradictions(mappling: MappedTiling) -> MappedTiling: return MappedTiling.empty_mappling() new_containers.append(new_c_list) new_avoiders = mappling.avoiding_parameters.remove_contradictions(base) - new_enumerators = [] + avoiders: list[Parameter] = [] + for param in new_avoiders: + if param.dimensions == (0, 0): + if ( + not GriddedCayleyPerm(CayleyPermutation(()), ()) + in param.obstructions + ): + return MappedTiling.empty_mappling() + else: + avoiders.append(param) + new_enumerators: list[ParameterList] = [] for e_list in mappling.enumerating_parameters: new_e_list = e_list.remove_contradictions(base) if new_e_list: new_enumerators.append(e_list) - return MappedTiling( - mappling.tiling, new_avoiders, new_containers, new_enumerators - ) + return MappedTiling(mappling.tiling, avoiders, new_containers, new_enumerators) @staticmethod @reg(2) @@ -224,7 +249,7 @@ def remove_empty_rows_and_cols(mappling: MappedTiling) -> MappedTiling: ) @staticmethod - @reg(12) + @reg(13) def simple_reduce_redundant_parameters(mappling: MappedTiling) -> MappedTiling: """Removes any parameter implied by another with a basic check""" new_avoiders = mappling.avoiding_parameters.simple_remove_redundant() @@ -247,11 +272,11 @@ def reduce_all_parameter_gcps(mappling: MappedTiling) -> MappedTiling: avoiders, containers, enumerators = mappling.apply_to_all_parameters( param_reducer ).ace_parameters() - new_avoiders = ParameterList(av for av in avoiders if av.dimensions != (0, 0)) + new_avoiders = ParameterList(avoiders) return MappedTiling(mappling.tiling, new_avoiders, containers, enumerators) @staticmethod - @reg(11) + @reg(12) def small_ob_inferral(mappling: MappedTiling) -> MappedTiling: """Adds point obstructions implied by param point cells and small base tiling obstructions""" @@ -270,7 +295,6 @@ def small_ob_inferral(mappling: MappedTiling) -> MappedTiling: for avoider in new_mappling.avoiding_parameters.apply_to_all( MTCleaner._cayley_ob_adjust_param, (ob,) ) - if avoider.dimensions != (0, 0) ) new_containers = tuple( ParameterList( @@ -293,7 +317,6 @@ def small_ob_inferral(mappling: MappedTiling) -> MappedTiling: for avoider in new_mappling.avoiding_parameters.apply_to_all( MTCleaner._ob_adjust_param, (ob,) ) - if avoider.dimensions != (0, 0) ) new_containers = tuple( ParameterList( @@ -313,7 +336,7 @@ def small_ob_inferral(mappling: MappedTiling) -> MappedTiling: return new_mappling @staticmethod - @reg(7) + @reg(8) def forward_map_parameter_gcps_from_avoiders( mappling: MappedTiling, ) -> MappedTiling: @@ -362,7 +385,7 @@ def forward_map_parameter_gcps_from_avoiders( return MappedTiling(new_base, new_avoiders, containers, enumerators) @staticmethod - @reg(9) + @reg(10) def forward_map_parameter_gcps_from_containers( mappling: MappedTiling, ) -> MappedTiling: @@ -432,7 +455,7 @@ def reap_blank(mappling: MappedTiling) -> MappedTiling: ) @staticmethod - @reg(13) + @reg(14) def remove_blank_rows_and_cols_params(mappling: MappedTiling) -> MappedTiling: """Deletes all rows and cols in the parameters which have no obs or reqs, ignoring point rows and columns and obstructions which are already on the diff --git a/mapplings/cleaners/parameter_cleaner.py b/mapplings/cleaners/parameter_cleaner.py index 8bbf388c..733c5643 100644 --- a/mapplings/cleaners/parameter_cleaner.py +++ b/mapplings/cleaners/parameter_cleaner.py @@ -4,7 +4,6 @@ from itertools import chain from cayley_permutations import CayleyPermutation from gridded_cayley_permutations.row_col_map import RowColMap -from gridded_cayley_permutations.unplacement import PartialUnplacement from gridded_cayley_permutations import Tiling from mapplings import Parameter @@ -131,38 +130,6 @@ def to_remove( return Parameter(Tiling([], [], (0, 0)), RowColMap({}, {})) return param.delete_rows_and_columns(cols_to_remove, rows_to_remove) - @staticmethod - @reg(4, run_on_enumerators=False) - def unplace_points(param: Parameter) -> Parameter: - """Unplaces all possible points in the parameter""" - algo = PartialUnplacement(param.ghost) - points = param.single_value_cells() - cells, cols, rows = set[tuple[int, int]](), set[int](), set[int]() - for cell in points: - valid = algo.cell_in_valid_region(cell) - if valid[0] and param.col_map[cell[0] - 1] == param.col_map[cell[0] + 1]: - cells.add(cell) - cols.add(cell[0]) - if valid[1] and param.row_map[cell[1] - 1] == param.row_map[cell[1] + 1]: - cells.add(cell) - rows.add(cell[1]) - unplace_cols, unplace_rows = algo.fusable_check(cells, cols, rows) - if not (unplace_cols or unplace_rows): - return param - new_ghost = algo.unplace(unplace_cols, unplace_rows) - col_preimages, row_preimages = algo.adjustment_map( - unplace_cols, unplace_rows - ).preimage_map() - new_col_map = { - i: param.col_map[col_preimages[i][0]] - for i in range(new_ghost.dimensions[0]) - } - new_row_map = { - i: param.row_map[row_preimages[i][0]] - for i in range(new_ghost.dimensions[1]) - } - return Parameter(new_ghost, RowColMap(new_col_map, new_row_map)) - @staticmethod @reg(3, run_on_enumerators=False) def insert_blank_size_1(param: Parameter) -> Parameter: diff --git a/mapplings/cleaners/unplacement.py b/mapplings/cleaners/unplacement.py new file mode 100644 index 00000000..252e42fa --- /dev/null +++ b/mapplings/cleaners/unplacement.py @@ -0,0 +1,94 @@ +"""Contains the ParamUnplacement class""" + +from itertools import product +from typing import Iterator +from functools import cached_property + +from gridded_cayley_permutations import RowColMap, GriddedCayleyPerm +from gridded_cayley_permutations.simplify_obstructions_and_requirements import ( + SimplifyObstructionsAndRequirements as Simplify, +) +from gridded_cayley_permutations.unplacement import PartialUnplacement +from mapplings import Parameter, MappedTiling + + +class ParamUnplacement(PartialUnplacement): + """A class for unplacing point rows and cols in a parameter""" + + def __init__(self, param: Parameter, parent_mappling: MappedTiling): + self.param = param + self.base = parent_mappling + self.base_obs = parent_mappling.obstructions + super().__init__(param.ghost) + + def implied_point_obs(self) -> Iterator[GriddedCayleyPerm]: + """Finds point obs in the parameter that are implied by the base mappling""" + for cells in product(self.param.empty_cells(), self.param.positive_cells()): + pos = sorted(cells) + pattern = (pos[0][1] > pos[1][1], pos[1][1] > pos[0][1]) + gcp = GriddedCayleyPerm(pattern, pos) + if self.param.map.map_gridded_cperm(gcp) not in self.base_obs: + yield GriddedCayleyPerm((0,), (cells[0],)) + + @cached_property + def expected_obs(self) -> set[GriddedCayleyPerm]: + unsimplified = tuple(super().expected_obs | set(self.implied_point_obs())) + algo = Simplify(unsimplified, tuple(tuple()), self.param.dimensions) + algo.simplify() + return set(algo.obstructions) + + def check_cols_and_rows( + self, check_cols: set[int], check_rows: set[int] + ) -> tuple[set[int], set[int]]: + """Filters the input cols and rows to only include those which can be unplaced.""" + valid_cols = { + col + for col in check_cols & self.positive_cols + if (0 < col < self.dimensions[0] - 1) + } + valid_rows = { + row + for row in check_rows & self.positive_rows + if (0 < row < self.dimensions[1] - 1) + } + valid_cols = { + col + for col in valid_cols + if self.param.col_map[col - 1] == self.param.col_map[col + 1] + } + valid_rows = { + row + for row in valid_rows + if self.param.row_map[row - 1] == self.param.row_map[row + 1] + } + valid_cols = set(filter(self.col_fuse_check, valid_cols)) + valid_rows = set(filter(self.row_fuse_check, valid_rows)) + return valid_cols, valid_rows + + def param_unplace( + self, unplace_cols: set[int], unplace_rows: set[int] + ) -> Parameter: + """Unplaces rows and cols in the ghost and creates a new row col map""" + if not any((unplace_cols, unplace_rows)): + return self.param + new_ghost = self.unplace(unplace_cols, unplace_rows) + + col_preimages, row_preimages = self.adjustment_map( + unplace_cols, unplace_rows + ).preimage_map() + + new_col_map = { + i: self.param.col_map[col_preimages[i][0]] + for i in range(new_ghost.dimensions[0]) + } + new_row_map = { + i: self.param.row_map[row_preimages[i][0]] + for i in range(new_ghost.dimensions[1]) + } + return Parameter(new_ghost, RowColMap(new_col_map, new_row_map)) + + def auto_unplace(self): + """Does all valid unplacements for the tiling's point cells""" + temp = self.param_unplace(set(), self.find_cols_and_rows()[1]) + new_algo = ParamUnplacement(temp, self.base) + return new_algo.param_unplace(new_algo.find_cols_and_rows()[0], set()) diff --git a/mapplings/mapped_tiling.py b/mapplings/mapped_tiling.py index 1f2cf5df..3be5b9e7 100644 --- a/mapplings/mapped_tiling.py +++ b/mapplings/mapped_tiling.py @@ -15,7 +15,6 @@ from .parameter import Parameter from .parameter_list import ParameterList - Objects = DefaultDict[tuple[int, ...], List[GriddedCayleyPerm]] Cell = tuple[int, int] @@ -42,6 +41,12 @@ def __init__( self.containing_parameters = tuple(sorted(containing_parameters)) self.enumerating_parameters = tuple(sorted(enumerating_parameters)) self.tiling = tiling + + if any(param.dimensions == (0, 0) for param in avoiding_parameters): + self.tiling = Tiling.empty_tiling() + self.avoiding_parameters = ParameterList() + self.containing_parameters = tuple() + self.enumerating_parameters = tuple() super().__init__( tiling.obstructions, tiling.requirements, tiling.dimensions, simplify ) diff --git a/mapplings/parameter.py b/mapplings/parameter.py index 699324e6..4ce7ff65 100644 --- a/mapplings/parameter.py +++ b/mapplings/parameter.py @@ -50,6 +50,11 @@ def injective_cells(self) -> set[Cell]: ) return set(product(inj_cols, inj_rows)) + def add_obstructions(self, gcps: Iterable[GriddedCayleyPerm]) -> "Parameter": + """Returns a new parameter with the obstructions added to the ghost.""" + new_ghost = super().add_obstructions(gcps) + return Parameter(new_ghost, self.map) + def preimage_of_gcp(self, gcperm: GriddedCayleyPerm) -> Iterator[GriddedCayleyPerm]: """Returns the preimage of a gridded cayley permutation""" for gcp in self.map.preimage_of_gridded_cperm(gcperm): diff --git a/mapplings/parameter_list.py b/mapplings/parameter_list.py index 6e027763..19fc8b8a 100644 --- a/mapplings/parameter_list.py +++ b/mapplings/parameter_list.py @@ -165,3 +165,6 @@ def __lt__(self, other: object): if isinstance(other, ParameterList): return tuple(sorted(self)) < tuple(sorted(other)) return NotImplemented + + def __getitem__(self, key): + return sorted(self)[key] diff --git a/mapplings/strategies/__init__.py b/mapplings/strategies/__init__.py index 3db7f5d0..6dcd69ad 100644 --- a/mapplings/strategies/__init__.py +++ b/mapplings/strategies/__init__.py @@ -2,6 +2,5 @@ from .mapped_tilescope import MappedTileScopePack - __all__ = ["MappedTileScopePack"] __version__ = "0.1.0" diff --git a/mapplings/strategies/mapped_tilescope.py b/mapplings/strategies/mapped_tilescope.py index 16cfd2be..dd4378fe 100644 --- a/mapplings/strategies/mapped_tilescope.py +++ b/mapplings/strategies/mapped_tilescope.py @@ -19,6 +19,7 @@ MapplingLessThanRowColSeparationStrategy, MapplingLessThanOrEqualRowColSeparationFactory, MapplingCellInsertionFactory, + MapplingObstructionTransitivityStrategy, ) @@ -38,6 +39,7 @@ def atom_verification_point_placement(cls): MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), MapplingPointPlacementFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), @@ -66,6 +68,7 @@ def no_param_ver_point_placement(cls): MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), MapplingPointPlacementFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), @@ -95,6 +98,7 @@ def no_param_ver_row_and_col_placement(cls): initial_strats=[ MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), @@ -125,6 +129,7 @@ def atom_verification_row_and_col_placement(cls): initial_strats=[ MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), @@ -154,6 +159,7 @@ def point_placement(cls, rootmt: MappedTiling): MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), MapplingPointPlacementFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), @@ -184,6 +190,7 @@ def row_placement(cls, rootmt: MappedTiling): initial_strats=[ MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), @@ -214,6 +221,7 @@ def col_placement(cls, rootmt: MappedTiling): initial_strats=[ MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), @@ -244,6 +252,7 @@ def row_and_col_placement(cls, rootmt: MappedTiling): initial_strats=[ MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), @@ -276,6 +285,7 @@ def point_row_and_col_placement(cls, rootmt: MappedTiling): MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), MapplingPointPlacementFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), @@ -308,6 +318,7 @@ def vertical_insertion_encoding(cls): initial_strats=[ MapplingFactorStrategy(), MapplingVerticalInsertionEncodingRequirementInsertionFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[], # CleaningStrategy() expansion_strats=[[MapplingVerticalInsertionEncodingPlacementFactory()]], @@ -326,6 +337,7 @@ def horizontal_insertion_encoding(cls): initial_strats=[ MapplingFactorStrategy(), MapplingHorizontalInsertionEncodingRequirementInsertionFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[], # CleaningStrategy() expansion_strats=[[MapplingHorizontalInsertionEncodingPlacementFactory()]], @@ -346,6 +358,7 @@ def insertion_row_and_col_placement(cls, rootmt: MappedTiling): MapplingFactorStrategy(), MapplingLessThanOrEqualRowColSeparationFactory(), MapplingCellInsertionFactory(), + MapplingObstructionTransitivityStrategy(), ], inferral_strats=[ # CleaningStrategy(), diff --git a/mapplings/strategies/tilescope_strategies.py b/mapplings/strategies/tilescope_strategies.py index 62d881d7..52e32568 100644 --- a/mapplings/strategies/tilescope_strategies.py +++ b/mapplings/strategies/tilescope_strategies.py @@ -1,7 +1,11 @@ """Strategies for mapplings tilescope.""" -from typing import Iterator -from gridded_cayley_permutations import Tiling, GriddedCayleyPerm +from typing import Iterator, Iterable +from gridded_cayley_permutations import ( + Tiling, + GriddedCayleyPerm, + ObstructionTransitivity, +) from gridded_cayley_permutations.point_placements import ( DIRECTIONS, DIR_LEFT_BOT, @@ -23,17 +27,16 @@ AbstractRowInsertionFactory, AbstractColInsertionFactory, AbstractRequirementInsertionStrategy, + AbstractObstructionTransitivityStrategy, ) from tilescope.strategies.row_column_separation import LessThanOrEqualRowColSeparation - - from comb_spec_searcher import ( DisjointUnionStrategy, CombinatorialSpecificationSearcher, ) from comb_spec_searcher.exception import StrategyDoesNotApply from cayley_permutations import CayleyPermutation -from mapplings import MappedTiling +from mapplings import MappedTiling, Parameter, ParameterList from mapplings.algorithms import ( MTRequirementPlacement, MTFactors, @@ -44,7 +47,6 @@ ) from mapplings.cleaners import MTCleaner, ParamCleaner - MTCleaner.global_log_toggle(1) temp = CombinatorialSpecificationSearcher.status @@ -409,3 +411,56 @@ def __call__( yield MapplingLessThanOrEqualRowColSeparationStrategy( row_order=row_order, ) + + +class MapplingObstructionTransitivityStrategy(AbstractObstructionTransitivityStrategy): + """A strategy for adding new obstructions to the tiling based on the current obstructions.""" + + def decomposition_function( + self, comb_class: MappedTiling + ) -> tuple[MappedTiling, ...]: + """Updates base tiling, avoiding parameters, and containing parameters + based on obstruction transitivity. + + TODO: As we're adding obstructions, we should simplify the parameter's tilings + too. Should this happen when simplify=True for a mappling?""" + new_bt_obs = ObstructionTransitivity(comb_class).new_obs() + found_new_obs = bool(new_bt_obs) + new_av_params, found_new = self.obs_trans_for_param_list( + comb_class.avoiding_parameters + ) + found_new_obs = found_new_obs or found_new + new_cont_params = [] + for cont_param_list in comb_class.containing_parameters: + new_cont_param_list, found_new = self.obs_trans_for_param_list( + cont_param_list + ) + new_cont_params.append(ParameterList(new_cont_param_list)) + found_new_obs = found_new_obs or found_new + + if not found_new_obs: + raise StrategyDoesNotApply("No new obstructions to add.") + return ( + MappedTiling( + comb_class.add_obstructions(new_bt_obs).tiling, + new_av_params, + new_cont_params, + comb_class.enumerating_parameters, + simplify=True, + ), + ) + + def obs_trans_for_param_list( + self, param_list: Iterable[Parameter] + ) -> tuple[list[Parameter], bool]: + """Does obstruction transitivity on each param in a param list, + returns the new list and a bool if any new obstructions were added.""" + added_obs = False + new_param_list = [] + for param in param_list: + new_obs = ObstructionTransitivity(param).new_obs() + if new_obs: + added_obs = True + param = param.add_obstructions(new_obs) + new_param_list.append(param) + return new_param_list, added_obs diff --git a/playground/all_vincular_pairs.py b/playground/all_vincular_pairs.py index c8886fdb..339f61ea 100644 --- a/playground/all_vincular_pairs.py +++ b/playground/all_vincular_pairs.py @@ -48,9 +48,9 @@ f.write(json_str) spec.get_genf() from_table.append(mappling) - results[ - name - ] = f"Success: {[spec.count_objects_of_size(i) for i in range(check_depth)]}" + results[name] = ( + f"Success: {[spec.count_objects_of_size(i) for i in range(check_depth)]}" + ) except Exception as e: print(f"Av({key1}), Av({key2}): {e}") results[name] = f"Failure: {e}" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..c945fd84 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,44 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "mapped_tilings" +version = "0.1.0" +description = "A module for using mapped tilings." +authors = [ + { name = "Reed Acton" }, + { name = "Christian Bean", email = "c.n.bean@keele.ac.uk" }, + { name = "Abigail Ollson" } +] +dependencies = [ + "comb-spec-searcher>=4.2.1", + "cayley_perms @ git+https://github.com/Ollson2921/CayleyPerms@main", +] +readme = "README.rst" + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ["."] + +[tool.hatchling.build.targets.sdist] +include = [ + "mapplings", + "tests", + "README.rst", +] + +[tool.black] +target-version = ["py312"] +line-length = 88 +include = "\\.pyi?$" +exclude = ''' +/( + \.git + | \.venv + | build + | dist +)/ +''' \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index ed15c212..00000000 --- a/setup.py +++ /dev/null @@ -1,14 +0,0 @@ -from setuptools import setup, find_namespace_packages - -setup( - name="mapped_tilings", - version="0.1.0", - description="A module for using mapped tilings.", - author="Reed Acton, Christian Bean, and Abigail Ollson", - author_email="c.n.bean@keele.ac.uk", - packages=find_namespace_packages(), - install_requires=[ - "comb_spec_searcher @ git+https://github.com/PermutaTriangle/comb_spec_searcher", - "cayley_perms @ git+https://github.com/Ollson2921/CayleyPerms", - ], # external packages as dependencies -) diff --git a/tox.ini b/tox.ini index 8de40f9e..d09fbe40 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,7 @@ skip_install = True deps = flake8 commands = - flake8 mapplings tests setup.py + flake8 mapplings tests [testenv:pylint] description = run pylint (static code analysis) @@ -59,5 +59,5 @@ commands = mypy mapplings description = check that comply with autoformating basepython = {[default]basepython} deps = - black==22.12.0 -commands = black --check --diff . + black>=24.0.0 +commands = black --check --diff mapplings