knit-graphs 0.0.10__tar.gz → 0.0.11__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 (41) hide show
  1. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/PKG-INFO +3 -2
  2. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/conf.py +71 -71
  3. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/index.rst +0 -4
  4. knit_graphs-0.0.11/pyproject.toml +251 -0
  5. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/Course.py +3 -1
  6. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/Knit_Graph.py +17 -11
  7. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/Knit_Graph_Visualizer.py +362 -149
  8. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/Loop.py +3 -2
  9. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/Pull_Direction.py +2 -0
  10. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/Yarn.py +35 -10
  11. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/artin_wale_braids/Crossing_Direction.py +2 -0
  12. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/artin_wale_braids/Loop_Braid_Graph.py +16 -5
  13. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/artin_wale_braids/Wale.py +16 -7
  14. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/artin_wale_braids/Wale_Braid.py +1 -0
  15. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/artin_wale_braids/Wale_Braid_Word.py +9 -8
  16. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/artin_wale_braids/Wale_Group.py +8 -5
  17. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/basic_knit_graph_generators.py +45 -10
  18. knit_graphs-0.0.11/src/knit_graphs/py.typed +0 -0
  19. knit_graphs-0.0.10/pyproject.toml +0 -296
  20. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/LICENSE +0 -0
  21. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/README.md +0 -0
  22. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/Makefile +0 -0
  23. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/make.bat +0 -0
  24. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.Course.rst +0 -0
  25. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.Knit_Graph.rst +0 -0
  26. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.Knit_Graph_Visualizer.rst +0 -0
  27. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.Loop.rst +0 -0
  28. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.Pull_Direction.rst +0 -0
  29. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.Yarn.rst +0 -0
  30. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.artin_wale_braids.Crossing_Direction.rst +0 -0
  31. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.artin_wale_braids.Loop_Braid_Graph.rst +0 -0
  32. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.artin_wale_braids.Wale.rst +0 -0
  33. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.artin_wale_braids.Wale_Braid.rst +0 -0
  34. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.artin_wale_braids.Wale_Braid_Word.rst +0 -0
  35. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.artin_wale_braids.Wale_Group.rst +0 -0
  36. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.artin_wale_braids.rst +0 -0
  37. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.basic_knit_graph_generators.rst +0 -0
  38. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/api/knit_graphs.rst +0 -0
  39. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/docs/source/installation.rst +0 -0
  40. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/__init__.py +0 -0
  41. {knit_graphs-0.0.10 → knit_graphs-0.0.11}/src/knit_graphs/artin_wale_braids/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: knit-graphs
3
- Version: 0.0.10
3
+ Version: 0.0.11
4
4
  Summary: A graph representation of knitted structures where each loop is a node and edges represent yarn and stitch relationships.
5
5
  Home-page: https://mhofmann-khoury.github.io/knit_graph/
6
6
  License: MIT
@@ -20,8 +20,9 @@ Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
21
  Classifier: Programming Language :: Python :: 3.13
22
22
  Classifier: Topic :: Scientific/Engineering
23
+ Classifier: Typing :: Typed
23
24
  Requires-Dist: networkx (>=3.5)
24
- Requires-Dist: plotly (>=6.3.0,<7.0.0)
25
+ Requires-Dist: plotly (>=6.3.0)
25
26
  Project-URL: Documentation, https://mhofmann-khoury.github.io/knit_graph/
26
27
  Project-URL: Repository, https://github.com/mhofmann-Khoury/knit_graph/
27
28
  Description-Content-Type: text/markdown
@@ -1,11 +1,11 @@
1
1
  """
2
- Configuration file for the Sphinx documentation builder.
3
- =============================================================================
4
- SPHINX DOCUMENTATION CONFIGURATION
5
- =============================================================================
6
- This file configures how Sphinx generates documentation from your Python code.
7
- For the full list of built-in configuration values, see:
8
- https://www.sphinx-doc.org/en/master/usage/configuration.html
2
+ Configuration file for the Sphinx documentation builder.
3
+ =============================================================================
4
+ SPHINX DOCUMENTATION CONFIGURATION
5
+ =============================================================================
6
+ This file configures how Sphinx generates documentation from your Python code.
7
+ For the full list of built-in configuration values, see:
8
+ https://www.sphinx-doc.org/en/master/usage/configuration.html
9
9
  """
10
10
 
11
11
  import os
@@ -19,17 +19,17 @@ from importlib.metadata import PackageNotFoundError, version
19
19
  # Add the project root and source directory to Python path so Sphinx can import your modules
20
20
 
21
21
  # Path to your source code (adjust if not using src/ layout)
22
- sys.path.insert(0, os.path.abspath('..')) # Project root
23
- sys.path.insert(0, os.path.abspath('../src')) # Source directory
24
- sys.path.insert(0, os.path.abspath('.')) # Docs directory
22
+ sys.path.insert(0, os.path.abspath("..")) # Project root
23
+ sys.path.insert(0, os.path.abspath("../src")) # Source directory
24
+ sys.path.insert(0, os.path.abspath(".")) # Docs directory
25
25
 
26
26
  # =============================================================================
27
27
  # PROJECT INFORMATION
28
28
  # =============================================================================
29
29
 
30
- project = 'knit-graphs'
31
- copyright = f'{datetime.now().year}, Megan Hofmann'
32
- author = 'Megan Hofmann'
30
+ project = "knit-graphs"
31
+ copyright = f"{datetime.now().year}, Megan Hofmann"
32
+ author = "Megan Hofmann"
33
33
 
34
34
  try:
35
35
  # Get version from installed package metadata
@@ -49,19 +49,17 @@ release = version
49
49
  # Extensions to enable (these add functionality to Sphinx)
50
50
  extensions = [
51
51
  # Core Sphinx extensions
52
- 'sphinx.ext.autodoc', # Generate docs from docstrings
53
- 'sphinx.ext.autosummary', # Generate summary tables automatically
54
- 'sphinx.ext.viewcode', # Add [source] links to documentation
55
- 'sphinx.ext.napoleon', # Support Google/NumPy docstring styles
56
- 'sphinx.ext.intersphinx', # Link to other project docs (e.g., Python docs)
57
- 'sphinx.ext.githubpages', # Publish to GitHub Pages (.nojekyll file)
58
- 'sphinx.ext.todo', # Support TODO items in docs
59
- 'sphinx.ext.coverage', # Check documentation coverage
60
- 'sphinx.ext.doctest', # Test code snippets in documentation
61
-
52
+ "sphinx.ext.autodoc", # Generate docs from docstrings
53
+ "sphinx.ext.autosummary", # Generate summary tables automatically
54
+ "sphinx.ext.viewcode", # Add [source] links to documentation
55
+ "sphinx.ext.napoleon", # Support Google/NumPy docstring styles
56
+ "sphinx.ext.intersphinx", # Link to other project docs (e.g., Python docs)
57
+ "sphinx.ext.githubpages", # Publish to GitHub Pages (.nojekyll file)
58
+ "sphinx.ext.todo", # Support TODO items in docs
59
+ "sphinx.ext.coverage", # Check documentation coverage
60
+ "sphinx.ext.doctest", # Test code snippets in documentation
62
61
  # Third-party extensions (these need to be installed)
63
- 'sphinx_autodoc_typehints', # Better type hint rendering
64
- 'myst_parser', # Support for Markdown files (optional)
62
+ "myst_parser", # Support for Markdown files (optional)
65
63
  ]
66
64
 
67
65
  # =============================================================================
@@ -70,19 +68,19 @@ extensions = [
70
68
 
71
69
  # File extensions that Sphinx will process
72
70
  source_suffix = {
73
- '.rst': None, # RestructuredText (default)
74
- '.md': 'myst_parser', # Markdown (requires myst_parser extension)
71
+ ".rst": None, # RestructuredText (default)
72
+ ".md": "myst_parser", # Markdown (requires myst_parser extension)
75
73
  }
76
74
 
77
75
  # The master toctree document (main page)
78
- master_doc = 'index'
76
+ master_doc = "index"
79
77
 
80
78
  # Files and directories to exclude from processing
81
79
  exclude_patterns = [
82
- '_build', # Build output directory
83
- 'Thumbs.db', # Windows thumbnail cache
84
- '.DS_Store', # macOS metadata
85
- '**.ipynb_checkpoints', # Jupyter notebook checkpoints
80
+ "_build", # Build output directory
81
+ "Thumbs.db", # Windows thumbnail cache
82
+ ".DS_Store", # macOS metadata
83
+ "**.ipynb_checkpoints", # Jupyter notebook checkpoints
86
84
  ]
87
85
 
88
86
  # =============================================================================
@@ -90,31 +88,29 @@ exclude_patterns = [
90
88
  # =============================================================================
91
89
 
92
90
  # The theme to use for HTML pages
93
- html_theme = 'sphinx_rtd_theme' # Read the Docs theme (clean, professional)
91
+ html_theme = "sphinx_rtd_theme" # Read the Docs theme (clean, professional)
94
92
 
95
93
  # Directories containing static files (CSS, JS, images)
96
- html_static_path = ['_static']
94
+ html_static_path = ["_static"]
97
95
 
98
96
 
99
97
  # Theme-specific options
100
98
  html_theme_options = {
101
- 'logo_only': False, # Show project name with logo
102
- 'display_version': True, # Show version in sidebar
103
- 'prev_next_buttons_location': 'bottom', # Navigation button placement
104
- 'style_external_links': True, # Style external links differently
105
- 'vcs_pageview_mode': '', # Version control integration
106
- 'style_nav_header_background': '#2980B9', # Header background color
107
-
99
+ "logo_only": False, # Show project name with logo
100
+ "prev_next_buttons_location": "bottom", # Navigation button placement
101
+ "style_external_links": True, # Style external links differently
102
+ "vcs_pageview_mode": "", # Version control integration
103
+ "style_nav_header_background": "#2980B9", # Header background color
108
104
  # Table of contents options
109
- 'collapse_navigation': True, # Collapse subsections in nav
110
- 'sticky_navigation': True, # Keep navigation visible on scroll
111
- 'navigation_depth': 4, # Maximum navigation depth
112
- 'includehidden': True, # Include hidden toctrees
113
- 'titles_only': False, # Show subsection titles in nav
105
+ "collapse_navigation": True, # Collapse subsections in nav
106
+ "sticky_navigation": True, # Keep navigation visible on scroll
107
+ "navigation_depth": 4, # Maximum navigation depth
108
+ "includehidden": True, # Include hidden toctrees
109
+ "titles_only": False, # Show subsection titles in nav
114
110
  }
115
111
 
116
112
  # Additional HTML options
117
- html_title = f'{project} Documentation' # Browser window title
113
+ html_title = f"{project} Documentation" # Browser window title
118
114
  html_short_title = project # Short title for navigation
119
115
 
120
116
 
@@ -136,20 +132,20 @@ html_short_title = project # Short title for navigation
136
132
 
137
133
  # Default options for all autodoc directives
138
134
  autodoc_default_options = {
139
- 'members': True, # Include all members
140
- 'member-order': 'bysource', # Order members as they appear in source
141
- 'special-members': '__init__', # Include __init__ methods
142
- 'undoc-members': True, # Include members without docstrings
143
- 'exclude-members': '__weakref__', # Exclude certain members
144
- 'show-inheritance': True, # Show class inheritance
145
- 'inherited-members': True, # Include inherited methods
135
+ "members": True, # Include all members
136
+ "member-order": "bysource", # Order members as they appear in source
137
+ "special-members": "__init__", # Include __init__ methods
138
+ "undoc-members": True, # Include members without docstrings
139
+ "exclude-members": "__weakref__", # Exclude certain members
140
+ "show-inheritance": True, # Show class inheritance
141
+ "inherited-members": True, # Include inherited methods
146
142
  }
147
143
 
148
144
  # How to display class signatures
149
145
  autodoc_class_signature = "mixed" # Show __init__ parameters with class
150
146
 
151
147
  # Order of members in documentation
152
- autodoc_member_order = 'bysource' # bysource, alphabetical, or groupwise
148
+ autodoc_member_order = "bysource" # bysource, alphabetical, or groupwise
153
149
 
154
150
  # Mock imports for modules that might not be available during doc building
155
151
  # Add any modules that cause import errors during doc building
@@ -159,6 +155,10 @@ autodoc_mock_imports = [
159
155
  # 'some_optional_dependency',
160
156
  ]
161
157
 
158
+ # Enable type hints in signatures
159
+ autodoc_typehints = "signature" # Show type hints in function signatures
160
+ autodoc_typehints_description_target = "documented" # Where to show type info
161
+
162
162
  # =============================================================================
163
163
  # AUTOSUMMARY CONFIGURATION
164
164
  # =============================================================================
@@ -193,13 +193,13 @@ napoleon_attr_annotations = True # Include attribute annotations
193
193
  # Links to external documentation
194
194
 
195
195
  intersphinx_mapping = {
196
- 'python': ('https://docs.python.org/3', None),
197
- 'numpy': ('https://numpy.org/doc/stable/', None),
198
- 'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
199
- 'matplotlib': ('https://matplotlib.org/stable/', None),
200
- 'scipy': ('https://docs.scipy.org/doc/scipy/', None),
201
- 'sklearn': ('https://scikit-learn.org/stable/', None),
202
- 'typing': ('https://typing.readthedocs.io/en/latest/', None),
196
+ "python": ("https://docs.python.org/3", None),
197
+ "numpy": ("https://numpy.org/doc/stable/", None),
198
+ "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
199
+ "matplotlib": ("https://matplotlib.org/stable/", None),
200
+ "scipy": ("https://docs.scipy.org/doc/scipy/", None),
201
+ "sklearn": ("https://scikit-learn.org/stable/", None),
202
+ "typing": ("https://typing.readthedocs.io/en/latest/", None),
203
203
  }
204
204
 
205
205
  # =============================================================================
@@ -207,10 +207,8 @@ intersphinx_mapping = {
207
207
  # =============================================================================
208
208
  # Controls how type hints are displayed in documentation
209
209
 
210
- typehints_fully_qualified = False # Use short names for types
210
+ # Note: These settings work with sphinx.ext.autodoc built-in type hint support
211
211
  always_document_param_types = True # Always show parameter types
212
- typehints_document_rtype = True # Document return types
213
- typehints_use_rtype = True # Use :rtype: directive for return types
214
212
 
215
213
  # =============================================================================
216
214
  # TODO EXTENSION CONFIGURATION
@@ -245,16 +243,17 @@ add_module_names = False # Don't prepend module names to functions
245
243
  show_authors = False # Don't show author info by default
246
244
 
247
245
  # Syntax highlighting style
248
- pygments_style = 'sphinx' # Code highlighting theme
246
+ pygments_style = "sphinx" # Code highlighting theme
249
247
 
250
248
  # Language for content that doesn't specify a language
251
- language = 'en'
249
+ language = "en"
252
250
 
253
251
 
254
252
  # =============================================================================
255
253
  # CUSTOM FUNCTIONS AND SETUP
256
254
  # =============================================================================
257
255
 
256
+
258
257
  def autodoc_skip_member(app, what, name, obj, skip, options):
259
258
  """
260
259
  Custom function to control which members are included in documentation.
@@ -288,15 +287,16 @@ def setup(app):
288
287
  app: The Sphinx application instance
289
288
  """
290
289
  # Connect custom functions to Sphinx events
291
- app.connect('autodoc-skip-member', autodoc_skip_member)
290
+ app.connect("autodoc-skip-member", autodoc_skip_member)
292
291
 
293
292
  # Return extension metadata
294
293
  return {
295
- 'version': version,
296
- 'parallel_read_safe': True,
297
- 'parallel_write_safe': True,
294
+ "version": version,
295
+ "parallel_read_safe": True,
296
+ "parallel_write_safe": True,
298
297
  }
299
298
 
299
+
300
300
  # =============================================================================
301
301
  # CHECKLIST FOR SPHINX SETUP
302
302
  # =============================================================================
@@ -3,10 +3,6 @@ knit-graphs
3
3
 
4
4
  A graph representation of knitted structures where each loop is a node and edges represent yarn and stitch relationships.
5
5
 
6
- .. image:: https://img.shields.io/github/workflow/status/mhofmann-Khoury/knit-graphs/CI
7
- :target: https://github.com/mhofmann-Khoury/knit-graphs/actions
8
- :alt: Build Status
9
-
10
6
  .. image:: https://img.shields.io/pypi/v/knit-graphs
11
7
  :target: https://pypi.org/project/knit-graphs/
12
8
  :alt: PyPI Version
@@ -0,0 +1,251 @@
1
+ # =============================================================================
2
+ # POETRY BUILD SYSTEM CONFIGURATION
3
+ # =============================================================================
4
+ # This section tells Poetry how to build your package
5
+ [build-system]
6
+ requires = ["poetry-core>=2.0.0,<3.0.0"] # Poetry build backend version
7
+ build-backend = "poetry.core.masonry.api" # Use Poetry's build system
8
+
9
+ # =============================================================================
10
+ # PROJECT METADATA AND CONFIGURATION
11
+ # =============================================================================
12
+ # All the information about your project that will appear on PyPI
13
+ [tool.poetry]
14
+ name = "knit-graphs"
15
+ version = "0.0.11"
16
+ description = "A graph representation of knitted structures where each loop is a node and edges represent yarn and stitch relationships."
17
+ authors = ["Megan Hofmann <m.hofmann@northeastern.edu>"]
18
+ maintainers = ["Megan Hofmann <m.hofmann@northeastern.edu>"]
19
+ license = "MIT" # License type (shows up on PyPI)
20
+ readme = "README.md" # File to use as long description on PyPI
21
+ homepage = "https://mhofmann-khoury.github.io/knit_graph/"
22
+ repository = "https://github.com/mhofmann-Khoury/knit_graph/"
23
+ documentation = "https://mhofmann-khoury.github.io/knit_graph/"
24
+ keywords = [
25
+ "ACT Lab",
26
+ "Northeastern University",
27
+ "knit",
28
+ "machine knit",
29
+ "fabrication",
30
+ "textile"]
31
+ classifiers = [ # PyPI classifiers for categorization
32
+ "Development Status :: 3 - Alpha", # Update as project matures (Alpha -> Beta -> Production/Stable)
33
+ "Natural Language :: English", # Human language
34
+ "Intended Audience :: Developers", # Add other audiences if relevant
35
+ "License :: OSI Approved :: MIT License", # Update if using different license
36
+ "Operating System :: OS Independent", # Platform support
37
+ "Programming Language :: Python :: 3", # Python support
38
+ "Programming Language :: Python :: 3.11", # Update supported Python versions
39
+ "Programming Language :: Python :: 3.12",
40
+ "Programming Language :: Python :: 3.13", # Latest Python version
41
+ "Topic :: Scientific/Engineering",
42
+ "Typing :: Typed", # Signals type hint support
43
+ ]
44
+
45
+ # =============================================================================
46
+ # PACKAGE STRUCTURE CONFIGURATION
47
+ # =============================================================================
48
+ # Tell Poetry where to find your Python packages in your repository
49
+ packages = [
50
+ {include = "knit_graphs", from = "src"},
51
+ ]
52
+
53
+ # =============================================================================
54
+ # FILES TO INCLUDE/EXCLUDE IN DISTRIBUTION
55
+ # =============================================================================
56
+ # Include additional files when building the package for distribution
57
+ include = [
58
+ "README.md", # Project description
59
+ "LICENSE", # License file
60
+ "docs/**/*", # All documentation files
61
+ "src/knit_graphs/py.typed", # PEP 561 marker for type information
62
+ ]
63
+
64
+ # Exclude files from the distribution package (keeps package size down)
65
+ exclude = [
66
+ "tests/**/*", # Don't include test files in distribution
67
+ "docs/_build/**/*", # Don't include built documentation
68
+ "*.pyc", # No compiled Python files
69
+ "__pycache__/**/*", # No Python cache directories
70
+ ".coverage", # No coverage data files
71
+ "htmlcov/**/*", # No coverage HTML reports
72
+ ".git/**/*", # No git files
73
+ ".github/**/*", # No GitHub workflow files
74
+ ".pytest_cache/**/*", # No pytest cache
75
+ ".mypy_cache/**/*", # No MyPy cache
76
+ "*.egg-info/**/*", # No build artifacts
77
+ "dist/**/*", # No distribution files
78
+ ]
79
+
80
+ # =============================================================================
81
+ # RUNTIME DEPENDENCIES
82
+ # =============================================================================
83
+ # These are packages your project needs to run in production
84
+ [tool.poetry.dependencies]
85
+ python = ">=3.11,<3.14"
86
+ networkx = ">=3.5"
87
+ plotly = ">=6.3.0"
88
+
89
+ # =============================================================================
90
+ # DEVELOPMENT DEPENDENCIES
91
+ # =============================================================================
92
+ # These packages are only needed during development and testing
93
+ [tool.poetry.group.dev.dependencies]
94
+ importlib-resources = ">=6.5.2"
95
+ coverage = "^7.3.0"
96
+ black = "^24.10.0"
97
+ ruff = "^0.7.4"
98
+ isort = "^5.13.2"
99
+ mypy = "^1.13.0"
100
+ pre-commit = "^3.8.0"
101
+ twine = "^5.1.0"
102
+
103
+ # =============================================================================
104
+ # DOCUMENTATION-SPECIFIC DEPENDENCIES
105
+ # =============================================================================
106
+ # Separate dependency group for building documentation (allows selective installation)
107
+ [tool.poetry.group.docs.dependencies]
108
+ sphinx = "^7.4.0"
109
+ sphinx-rtd-theme = "^3.0.0"
110
+ sphinx-autoapi = "^3.4.0"
111
+ myst-parser = "^4.0.0"
112
+
113
+ # =============================================================================
114
+ # BLACK CODE FORMATTER CONFIGURATION
115
+ # =============================================================================
116
+ [tool.black]
117
+ line-length = 120
118
+ target-version = ["py311"]
119
+ extend-exclude = "tests"
120
+
121
+ # =============================================================================
122
+ # RUFF LINTER CONFIGURATION
123
+ # =============================================================================
124
+ [tool.ruff]
125
+ line-length = 120
126
+ target-version = "py311"
127
+
128
+ exclude = [
129
+ ".git",
130
+ ".mypy_cache",
131
+ ".ruff_cache",
132
+ ".venv",
133
+ "__pycache__",
134
+ "build",
135
+ "dist",
136
+ "docs",
137
+ "tests",
138
+ ]
139
+
140
+ [tool.ruff.lint]
141
+ select = [
142
+ "E", # pycodestyle errors
143
+ "W", # pycodestyle warnings
144
+ "F", # pyflakes
145
+ "I", # isort
146
+ "N", # pep8-naming
147
+ "UP", # pyupgrade
148
+ "B", # flake8-bugbear
149
+ "C4", # flake8-comprehensions
150
+ "SIM", # flake8-simplify
151
+ ]
152
+
153
+ ignore = [
154
+ "E501", # Line too long (handled by Black)
155
+ "E741", # Ambiguous variable name (l, O, I) - allow single-letter loop variables
156
+ "N801", # CapWords convention ignored
157
+ "N999", # Module name conventions ignored
158
+ "UP038", # Use older isinstance tuple syntax for mypy compatibility
159
+ ]
160
+
161
+ [tool.ruff.lint.per-file-ignores]
162
+ "tests/**/*.py" = [
163
+ "S101", # Allow assert statements in tests
164
+ ]
165
+
166
+ [tool.ruff.format]
167
+ quote-style = "double"
168
+ indent-style = "space"
169
+
170
+ # =============================================================================
171
+ # ISORT IMPORT SORTER CONFIGURATION
172
+ # =============================================================================
173
+ [tool.isort]
174
+ profile = "black"
175
+ line_length = 120
176
+ multi_line_output = 3
177
+ include_trailing_comma = true
178
+ force_grid_wrap = 0
179
+ use_parentheses = true
180
+ ensure_newline_before_comments = true
181
+ known_first_party = ["knit_graphs"]
182
+ skip_glob = ["tests/*"]
183
+
184
+ # =============================================================================
185
+ # MYPY STATIC TYPE CHECKER CONFIGURATION
186
+ # =============================================================================
187
+ [tool.mypy]
188
+ python_version = "3.11"
189
+ warn_return_any = true
190
+ warn_unused_configs = true
191
+ disallow_untyped_defs = true
192
+ disallow_incomplete_defs = true
193
+ check_untyped_defs = true
194
+ disallow_untyped_decorators = true
195
+ no_implicit_optional = true
196
+ warn_redundant_casts = true
197
+ warn_unused_ignores = true
198
+ warn_no_return = false
199
+ warn_unreachable = true
200
+ strict_equality = true
201
+ show_error_codes = true
202
+ ignore_missing_imports = true
203
+ allow_redefinition = true
204
+ allow_untyped_globals = true
205
+ implicit_reexport = true
206
+
207
+ disable_error_code = [
208
+ "attr-defined",
209
+ "no-redef",
210
+ ]
211
+
212
+ exclude = [
213
+ "tests/",
214
+ ]
215
+
216
+ [[tool.mypy.overrides]]
217
+ module = "tests.*"
218
+ disallow_untyped_defs = false
219
+ disallow_incomplete_defs = false
220
+ check_untyped_defs = false
221
+
222
+ # =============================================================================
223
+ # COVERAGE.PY CONFIGURATION
224
+ # =============================================================================
225
+ [tool.coverage.run]
226
+ source = ["src"]
227
+ omit = [
228
+ "*/tests/*",
229
+ "*/test_*",
230
+ "*/__pycache__/*",
231
+ "*/site-packages/*",
232
+ "*/.venv/*",
233
+ ]
234
+ branch = true
235
+
236
+ [tool.coverage.report]
237
+ exclude_lines = [
238
+ "pragma: no cover",
239
+ "def __repr__",
240
+ "if self.debug:",
241
+ "if settings.DEBUG",
242
+ "raise AssertionError",
243
+ "raise NotImplementedError",
244
+ "if 0:",
245
+ "if __name__ == .__main__.:",
246
+ "class .*\\bProtocol\\):",
247
+ "@(abc\\.)?abstractmethod",
248
+ ]
249
+ show_missing = true
250
+ skip_covered = false
251
+ skip_empty = true
@@ -2,9 +2,11 @@
2
2
 
3
3
  This module contains the Course class which represents a horizontal row of loops in a knitting pattern.
4
4
  """
5
+
5
6
  from __future__ import annotations
6
7
 
7
- from typing import TYPE_CHECKING, Iterator, cast
8
+ from collections.abc import Iterator
9
+ from typing import TYPE_CHECKING, cast
8
10
 
9
11
  from knit_graphs.Loop import Loop
10
12
 
@@ -3,9 +3,11 @@
3
3
  This module contains the main Knit_Graph class which serves as the central data structure for representing knitted fabrics.
4
4
  It manages the relationships between loops, yarns, and structural elements like courses and wales.
5
5
  """
6
+
6
7
  from __future__ import annotations
7
8
 
8
- from typing import Any, Iterator, cast
9
+ from collections.abc import Iterator
10
+ from typing import Any, cast
9
11
 
10
12
  from networkx import DiGraph
11
13
 
@@ -118,9 +120,13 @@ class Knit_Graph:
118
120
  """
119
121
  self.yarns.add(yarn)
120
122
 
121
- def connect_loops(self, parent_loop: Loop, child_loop: Loop,
122
- pull_direction: Pull_Direction = Pull_Direction.BtF,
123
- stack_position: int | None = None) -> None:
123
+ def connect_loops(
124
+ self,
125
+ parent_loop: Loop,
126
+ child_loop: Loop,
127
+ pull_direction: Pull_Direction = Pull_Direction.BtF,
128
+ stack_position: int | None = None,
129
+ ) -> None:
124
130
  """Create a stitch edge by connecting a parent and child loop.
125
131
 
126
132
  Args:
@@ -151,7 +157,7 @@ class Knit_Graph:
151
157
  if len(last_loop.parent_loops) == 0:
152
158
  return {Wale(last_loop, self)}
153
159
  ancestors = last_loop.ancestor_loops()
154
- return {Wale(l, self) for l in ancestors}
160
+ return {Wale(ancestor_loop, self) for ancestor_loop in ancestors}
155
161
 
156
162
  def get_terminal_wales(self) -> dict[Loop, list[Wale]]:
157
163
  """
@@ -162,7 +168,7 @@ class Knit_Graph:
162
168
  """
163
169
  wale_groups = {}
164
170
  for loop in self.terminal_loops():
165
- wale_groups[loop] = [wale for wale in self.get_wales_ending_with_loop(loop)]
171
+ wale_groups[loop] = list(self.get_wales_ending_with_loop(loop))
166
172
  return wale_groups
167
173
 
168
174
  def get_courses(self) -> list[Course]:
@@ -190,7 +196,7 @@ class Knit_Graph:
190
196
  Returns:
191
197
  set[Wale_Group]: The set of wale-groups that lead to the terminal loops of this graph. Each wale group represents a collection of wales that end at the same terminal loop.
192
198
  """
193
- return set(Wale_Group(l, self) for l in self.terminal_loops())
199
+ return {Wale_Group(terminal_loop, self) for terminal_loop in self.terminal_loops()}
194
200
 
195
201
  def __contains__(self, item: Loop | tuple[Loop, Loop]) -> bool:
196
202
  """Check if a loop is contained in the knit graph.
@@ -214,7 +220,7 @@ class Knit_Graph:
214
220
  return cast(Iterator[Loop], iter(self.stitch_graph.nodes))
215
221
 
216
222
  def __getitem__(self, item: int) -> Loop:
217
- loop = next((l for l in self if l.loop_id == item), None)
223
+ loop = next((loop for loop in self if loop.loop_id == item), None)
218
224
  if loop is None:
219
225
  raise KeyError(f"Loop of id {item} not in knit graph")
220
226
  return loop
@@ -224,7 +230,7 @@ class Knit_Graph:
224
230
  Returns:
225
231
  list[Loop]: The list of loops in the stitch graph sorted from the earliest formed loop to the latest formed loop.
226
232
  """
227
- return sorted(list(self.stitch_graph.nodes))
233
+ return sorted(self.stitch_graph.nodes)
228
234
 
229
235
  def get_pull_direction(self, parent: Loop, child: Loop) -> Pull_Direction | None:
230
236
  """Get the pull direction of the stitch edge between parent and child loops.
@@ -240,7 +246,7 @@ class Knit_Graph:
240
246
  if edge is None:
241
247
  return None
242
248
  else:
243
- return cast(Pull_Direction, edge['pull_direction'])
249
+ return cast(Pull_Direction, edge["pull_direction"])
244
250
 
245
251
  def get_stitch_edge(self, parent: Loop, child: Loop) -> dict[str, Any] | None:
246
252
  """Get the stitch edge data between two loops.
@@ -298,4 +304,4 @@ class Knit_Graph:
298
304
  Returns:
299
305
  Iterator[Loop]: An iterator over all terminal loops in the knit graph.
300
306
  """
301
- return iter(l for l in self if self.is_terminal_loop(l))
307
+ return iter(loop for loop in self if self.is_terminal_loop(loop))