You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hooks: include private functions in export-functions.py by default; add --skip-private flag (#1842)
* Initial plan
* Add --skip-private flag to export-functions.py; include all functions by default
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
* Fix: suppress B009 in test file to prevent ruff from reverting getattr
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
* Add comment explaining why private functions without docstrings are omitted
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -210,12 +210,16 @@ ALWAYS check whether an existing function already covers your use case before im
210
210
-`call_backend_subprocess()` (`usethis._backend.dispatch`) — Dispatch a subprocess call to the appropriate backend.
211
211
-`is_poetry_available()` (`usethis._backend.poetry.available`) — Check if the `poetry` command is available in the current environment.
212
212
-`call_poetry_subprocess()` (`usethis._backend.poetry.call`) — Run a subprocess using the Poetry command-line tool.
213
+
-`_frozen_poetry_lock()` (`usethis._backend.poetry.call`) — Preserve the state of poetry.lock across the enclosed block.
214
+
-`_noop_context()` (`usethis._backend.poetry.call`) — A no-op context manager used when frozen mode is not applicable.
213
215
-`add_dep_to_group_via_poetry()` (`usethis._backend.poetry.deps`) — Add a dependency to the named group using Poetry.
214
216
-`remove_dep_from_group_via_poetry()` (`usethis._backend.poetry.deps`) — Remove a dependency from the named group using Poetry.
215
217
-`is_poetry_used()` (`usethis._backend.poetry.detect`) — Check if Poetry is being used in the project.
218
+
-`_get_poetry_python_constraint()` (`usethis._backend.poetry.init`) — Get a bounded Python version constraint for Poetry projects.
216
219
-`ensure_pyproject_toml_via_poetry()` (`usethis._backend.poetry.init`) — Create a pyproject.toml file using `poetry init`.
217
220
-`opinionated_poetry_init()` (`usethis._backend.poetry.init`) — Subprocess `poetry init` with opinionated arguments.
218
221
-`is_uv_available()` (`usethis._backend.uv.available`) — Check if the `uv` command is available in the current environment.
222
+
-`_is_uv_a_dep()` (`usethis._backend.uv.available`) — Check if uv is declared as a project dependency or in a dependency group.
219
223
-`call_uv_subprocess()` (`usethis._backend.uv.call`) — Run a subprocess using the uv command-line tool.
220
224
-`add_default_groups_via_uv()` (`usethis._backend.uv.call`) — Add default groups using the uv command-line tool.
221
225
-`add_dep_to_group_via_uv()` (`usethis._backend.uv.deps`) — Add a dependency to the named group using uv.
@@ -236,6 +240,7 @@ ALWAYS check whether an existing function already covers your use case before im
236
240
-`err_print()` (`usethis._console`) — Print a ✗ error message to stderr (red).
237
241
-`warn_print()` (`usethis._console`) — Print a ⚠ warning message (yellow; deduplicated).
238
242
-`get_icon_mode()` (`usethis._console`) — Detect terminal's icon support level.
243
+
-`_get_icon()` (`usethis._console`) — Get the appropriate icon based on terminal capabilities.
239
244
-`add_author()` (`usethis._core.author`) — Add an author entry to the project metadata in pyproject.toml.
240
245
-`get_pre_commit_badge()` (`usethis._core.badge`) — Return the pre-commit badge.
241
246
-`get_pypi_badge()` (`usethis._core.badge`) — Return the PyPI version badge for the project.
@@ -247,12 +252,15 @@ ALWAYS check whether an existing function already covers your use case before im
247
252
-`get_usethis_badge()` (`usethis._core.badge`) — Return the usethis badge.
248
253
-`get_badge_order()` (`usethis._core.badge`) — Return the canonical ordered list of all supported badges.
249
254
-`add_badge()` (`usethis._core.badge`) — Add a badge to the README.md file in the correct position.
255
+
-`_get_prerequisites()` (`usethis._core.badge`) — Get the prerequisites for a badge.
250
256
-`is_blank()` (`usethis._core.badge`) — Return True if the line is empty or contains only whitespace.
251
257
-`is_header()` (`usethis._core.badge`) — Return True if the line is a Markdown header.
252
258
-`is_badge()` (`usethis._core.badge`) — Return True if the line looks like a Markdown badge (heuristic).
253
259
-`remove_badge()` (`usethis._core.badge`) — Remove a badge from the README.md file.
254
260
-`browse_pypi()` (`usethis._core.browse`) — Open or display the PyPI project page URL for a package.
255
261
-`use_docstyle()` (`usethis._core.docstyle`) — Configure the docstring style convention for the project using Ruff.
262
+
-`_rich_status()` (`usethis._core.list`) — Get richly formatted status.
263
+
-`_rich_category()` (`usethis._core.list`) — Get richly formatted category.
256
264
-`show_usage_table()` (`usethis._core.list`) — Show the usage table.
257
265
-`get_usage_table()` (`usethis._core.list`) — Get the usage table.
258
266
-`add_readme()` (`usethis._core.readme`) — Add a README.md file to the project.
@@ -277,10 +285,12 @@ ALWAYS check whether an existing function already covers your use case before im
277
285
-`use_pytest()` (`usethis._core.tool`) — Add and configure the pytest testing framework.
278
286
-`use_requirements_txt()` (`usethis._core.tool`) — Add and configure a requirements.txt file exported from the uv lockfile.
279
287
-`use_ruff()` (`usethis._core.tool`) — Add Ruff to the project.
288
+
-`_get_basic_rule_config()` (`usethis._core.tool`) — Get the basic rule config for Ruff.
280
289
-`use_tach()` (`usethis._core.tool`) — Add and configure the Tach architecture enforcement tool.
281
290
-`use_ty()` (`usethis._core.tool`) — Add and configure the ty type checker tool.
282
291
-`get_project_deps()` (`usethis._deps`) — Get all project dependencies.
283
292
-`get_dep_groups()` (`usethis._deps`) — Get all dependency groups from pyproject.toml.
293
+
-`_merge_deps()` (`usethis._deps`) — Merge two dependency lists, avoiding duplicates by name.
284
294
-`get_deps_from_group()` (`usethis._deps`) — Get the list of dependencies in a named dependency group.
285
295
-`register_default_group()` (`usethis._deps`) — Register a group in the default-groups configuration if it's not already there.
286
296
-`add_default_groups()` (`usethis._deps`) — Register the given dependency groups as default groups in the package manager configuration.
@@ -290,27 +300,42 @@ ALWAYS check whether an existing function already covers your use case before im
290
300
-`remove_deps_from_group()` (`usethis._deps`) — Remove dependencies from the named group if present.
291
301
-`is_dep_in_any_group()` (`usethis._deps`) — Check if a dependency exists in any dependency group.
292
302
-`add_deps_to_group()` (`usethis._deps`) — Add dependencies to a named group using PEP 735 dependency groups.
303
+
-`_register_poetry_default_group()` (`usethis._deps`) — Ensure a poetry dependency group is installed by default (non-optional).
304
+
-`_get_poetry_default_groups()` (`usethis._deps`) — Get the list of poetry dependency groups that are installed by default.
293
305
-`is_pre_commit_used()` (`usethis._detect.pre_commit`) — Check if pre-commit is being used in the project.
294
306
-`is_readme_used()` (`usethis._detect.readme`) — Check if the README.md file is used.
295
307
-`next_breaking_version()` (`usethis._fallback`) — Get the next breaking version for a version string, following semver.
296
308
-`get_project_name_from_dir()` (`usethis._file.dir`) — Derive a valid project name from the current directory name.
309
+
-`_itermatches()` (`usethis._file.ini.io_`) — Iterate through an iterable and find all matches for a key.
310
+
-`_ensure_newline()` (`usethis._file.ini.io_`) — Add a newline to the INI file.
297
311
-`deep_merge()` (`usethis._file.merge`) — Recursively merge source into target in place, returning target.
298
312
-`print_keys()` (`usethis._file.print_`) — Convert a list of keys to a string.
299
313
-`get_project_deps()` (`usethis._file.pyproject_toml.deps`) — Get all project dependencies from [project.dependencies].
300
314
-`get_dep_groups()` (`usethis._file.pyproject_toml.deps`) — Get all dependency groups from [dependency-groups].
301
315
-`get_poetry_project_deps()` (`usethis._file.pyproject_toml.deps`) — Get project dependencies from [tool.poetry.dependencies].
302
316
-`get_poetry_dep_groups()` (`usethis._file.pyproject_toml.deps`) — Get dependency groups from [tool.poetry.group.*.dependencies].
317
+
-`_parse_poetry_deps()` (`usethis._file.pyproject_toml.deps`) — Parse a Poetry dependencies table into a list of Dependency objects.
303
318
-`get_name()` (`usethis._file.pyproject_toml.name`) — Get the project name from pyproject.toml.
304
319
-`get_description()` (`usethis._file.pyproject_toml.name`) — Get the project description from pyproject.toml.
305
320
-`get_project_dict()` (`usethis._file.pyproject_toml.project`) — Get the contents of the [project] section from pyproject.toml.
306
321
-`get_requires_python()` (`usethis._file.pyproject_toml.requires_python`) — Get the requires-python constraint from pyproject.toml.
307
322
-`get_required_minor_python_versions()` (`usethis._file.pyproject_toml.requires_python`) — Get Python minor versions that match the project's requires-python constraint.
323
+
-`_get_minimum_minor_python_version_tuple()` (`usethis._file.pyproject_toml.requires_python`) — Get the minimum (major, minor) Python version from requires-python specifier.
324
+
-`_get_maximum_minor_python_version_tuple()` (`usethis._file.pyproject_toml.requires_python`) — Get the maximum (major, minor) Python version from requires-python specifier.
325
+
-`_get_maximum_python_minor_version()` (`usethis._file.pyproject_toml.requires_python`) — Get the hard-coded maximum minor version for a given Python major version.
308
326
-`ensure_pyproject_validity()` (`usethis._file.pyproject_toml.valid`) — Ensure pyproject.toml has a valid structure, adding missing required fields.
309
327
-`prepare_pyproject_write()` (`usethis._file.pyproject_toml.write`) — Prepare the pyproject.toml file for a subprocess that will modify it.
328
+
-`_set_value_in_existing()` (`usethis._file.toml.io_`) — Set a new value in an existing container.
329
+
-`_validate_keys()` (`usethis._file.toml.io_`) — Validate the keys.
330
+
-`_raise_already_set()` (`usethis._file.toml.io_`) — Raise an error if the configuration is already set.
331
+
-`_validate_keys()` (`usethis._file.yaml.io_`) — Validate the keys.
310
332
-`get_yaml_document()` (`usethis._file.yaml.io_`) — Get a YAML document representation from a string or file-like object.
311
333
-`update_ruamel_yaml_map()` (`usethis._file.yaml.update`) — Update the values of a ruamel.yaml map in-place using a diff-like algorithm.
312
334
-`lcs_list_update()` (`usethis._file.yaml.update`) — Update in-place using a longest common subsequence solver.
335
+
-`_shared_id_sequences()` (`usethis._file.yaml.update`) — Map list elements to integers which are equal iff the objects are with `__eq__`.
313
336
-`project_init()` (`usethis._init`) — Initialize the project by creating the pyproject.toml and project structure.
337
+
-`_create_project_structure()` (`usethis._init`) — Create the standard project structure files.
338
+
-`_regularize_package_name()` (`usethis._init`) — Regularize the package name to be suitable for Python packaging.
314
339
-`write_simple_requirements_txt()` (`usethis._init`) — Write a simple requirements.txt file with -e . and any project dependencies.
315
340
-`ensure_dep_declaration_file()` (`usethis._init`) — Ensure that the file where dependencies are declared exists, if necessary.
316
341
-`ensure_pyproject_toml()` (`usethis._init`) — Ensure that a pyproject.toml file exists, creating it if necessary.
@@ -320,6 +345,7 @@ ALWAYS check whether an existing function already covers your use case before im
-`add_repo()` (`usethis._integrations.pre_commit.hooks`) — Add a pre-commit repo configuration to the pre-commit configuration file.
322
347
-`insert_repo()` (`usethis._integrations.pre_commit.hooks`) — Insert a repo into the list of repos after the named predecessor hook.
348
+
-`_report_adding_repo()` (`usethis._integrations.pre_commit.hooks`) — Append a repo to the end of the existing repos with message.
323
349
-`add_placeholder_hook()` (`usethis._integrations.pre_commit.hooks`) — Add a placeholder hook to the pre-commit configuration with instructions for the user.
-`get_hook_ids()` (`usethis._integrations.pre_commit.hooks`) — Get the list of hook IDs currently configured in the pre-commit configuration file.
@@ -330,23 +356,34 @@ ALWAYS check whether an existing function already covers your use case before im
330
356
-`get_minimum_pre_commit_version()` (`usethis._integrations.pre_commit.version`) — Get the declared minimum supported pre-commit version from the configuration.
331
357
-`has_pyproject_toml_declared_build_system()` (`usethis._integrations.project.build`) — Check if a build system is declared in the project.
332
358
-`get_layered_architectures()` (`usethis._integrations.project.imports`) — Get the suggested layers for a package.
359
+
-`_get_child_dependencies()` (`usethis._integrations.project.imports`) — For each child submodule, give a set of the sibling submodules it depends on.
333
360
-`augment_pythonpath()` (`usethis._integrations.project.imports`) — Temporarily add a directory to the Python path.
334
361
-`get_source_dir_str()` (`usethis._integrations.project.layout`) — Get the source directory as a string ('src' or '.').
335
362
-`get_license_id()` (`usethis._integrations.project.license`) — Get the SPDX license identifier for the current project.
363
+
-`_get_license_from_file()` (`usethis._integrations.project.license`) — Try to detect the license from common license files at the project root.
364
+
-`_get_license_from_pyproject_field()` (`usethis._integrations.project.license`) — Try to detect the license from pyproject.toml `project.license` field.
365
+
-`_resolve_license_table()` (`usethis._integrations.project.license`) — Resolve a PEP 621 license table to an SPDX identifier.
366
+
-`_get_license_from_classifiers()` (`usethis._integrations.project.license`) — Try to detect the license from pyproject.toml `project.classifiers`.
336
367
-`get_project_name()` (`usethis._integrations.project.name`) — The project name, from pyproject.toml if available or fallback to heuristics.
337
368
-`get_importable_packages()` (`usethis._integrations.project.packages`) — Get the names of packages in the source directory that can be imported.
369
+
-`_get_packages_in_dir()` (`usethis._integrations.project.packages`) — Get the names of packages in the given directory.
370
+
-`_is_excluded()` (`usethis._integrations.project.packages`) — Check if the given name is excluded from importable packages.
338
371
-`fancy_model_dump()` (`usethis._integrations.pydantic.dump`) — Like `pydantic.model_dump` but with bespoke formatting options.
339
372
-`add_pytest_dir()` (`usethis._integrations.pytest.core`) — Create the tests directory and conftest.py if they do not already exist.
340
373
-`add_example_test()` (`usethis._integrations.pytest.core`) — Create an example test file in the tests directory if it does not already exist.
341
374
-`remove_pytest_dir()` (`usethis._integrations.pytest.core`) — Remove the tests directory if it contains only managed files.
342
375
-`get_readme_path()` (`usethis._integrations.readme.path`) — Return the path to the README file, searching for common README filenames.
343
376
-`get_markdown_readme_path()` (`usethis._integrations.readme.path`) — Return the path to the Markdown README file, raising an error if it is not Markdown.
344
377
-`get_sonar_project_properties()` (`usethis._integrations.sonarqube.config`) — Get contents for (or from) the sonar-project.properties file.
378
+
-`_validate_project_key()` (`usethis._integrations.sonarqube.config`) — Validate the SonarQube project key.
345
379
-`parallel()` (`usethis._pipeweld.containers`) — Create a Parallel pipeline composition from the given components.
346
380
-`series()` (`usethis._pipeweld.containers`) — Create a Series pipeline composition from the given components.
347
381
-`depgroup()` (`usethis._pipeweld.containers`) — Create a DepGroup pipeline composition tied to a named configuration group.
382
+
-`_get_instructions_for_insertion()` (`usethis._pipeweld.func`) — Get the instructions to insert a component after the given step.
348
383
-`get_endpoint()` (`usethis._pipeweld.func`) — Get the last step name (endpoint) from a pipeline component.
349
384
-`get_predecessor()` (`usethis._pipeweld.func`) — Find the step that immediately precedes `step` in a pipeline component.
385
+
-`_extract_ordered_steps()` (`usethis._pipeweld.func`) — Extract all step names from a component in depth-first order.
386
+
-`_linearize_component()` (`usethis._pipeweld.func`) — Flatten a pipeline component to a linear list of step names.
350
387
-`call_subprocess()` (`usethis._subprocess`) — Run a subprocess and return its stdout, raising SubprocessFailedError on failure.
351
388
-`ensure_managed_file_exists()` (`usethis._tool.config`) — Ensure a file manager's managed file exists.
352
389
-`is_likely_used()` (`usethis._tool.heuristics`) — Determine whether a tool is likely used in the current project.
0 commit comments