Skip to content

Commit 168e341

Browse files
Add tests for source layout inference and import linter contracts with setup.py; fix AGENTS.md size limit by skipping private functions in export
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/2513930c-0ee9-4750-a2de-37bf989b5189 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
1 parent b22dd0d commit 168e341

5 files changed

Lines changed: 41 additions & 75 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ repos:
154154
- id: export-functions
155155
name: export-functions
156156
entry: uv run --frozen --offline hooks/export-functions.py
157-
args: ["--source-root=src/usethis", "--output-file=docs/functions.txt", "--strict"]
157+
args: ["--source-root=src/usethis", "--output-file=docs/functions.txt", "--strict", "--skip-private"]
158158
language: system
159159
always_run: true
160160
pass_filenames: false

AGENTS.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,12 @@ ALWAYS check whether an existing function already covers your use case before im
210210
- `call_backend_subprocess()` (`usethis._backend.dispatch`) — Dispatch a subprocess call to the appropriate backend.
211211
- `is_poetry_available()` (`usethis._backend.poetry.available`) — Check if the `poetry` command is available in the current environment.
212212
- `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.
215213
- `add_dep_to_group_via_poetry()` (`usethis._backend.poetry.deps`) — Add a dependency to the named group using Poetry.
216214
- `remove_dep_from_group_via_poetry()` (`usethis._backend.poetry.deps`) — Remove a dependency from the named group using Poetry.
217215
- `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.
219216
- `ensure_pyproject_toml_via_poetry()` (`usethis._backend.poetry.init`) — Create a pyproject.toml file using `poetry init`.
220217
- `opinionated_poetry_init()` (`usethis._backend.poetry.init`) — Subprocess `poetry init` with opinionated arguments.
221218
- `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.
223219
- `call_uv_subprocess()` (`usethis._backend.uv.call`) — Run a subprocess using the uv command-line tool.
224220
- `add_default_groups_via_uv()` (`usethis._backend.uv.call`) — Add default groups using the uv command-line tool.
225221
- `add_dep_to_group_via_uv()` (`usethis._backend.uv.deps`) — Add a dependency to the named group using uv.
@@ -240,7 +236,6 @@ ALWAYS check whether an existing function already covers your use case before im
240236
- `err_print()` (`usethis._console`) — Print a ✗ error message to stderr (red).
241237
- `warn_print()` (`usethis._console`) — Print a ⚠ warning message (yellow; deduplicated).
242238
- `get_icon_mode()` (`usethis._console`) — Detect terminal's icon support level.
243-
- `_get_icon()` (`usethis._console`) — Get the appropriate icon based on terminal capabilities.
244239
- `add_author()` (`usethis._core.author`) — Add an author entry to the project metadata in pyproject.toml.
245240
- `get_pre_commit_badge()` (`usethis._core.badge`) — Return the pre-commit badge.
246241
- `get_pypi_badge()` (`usethis._core.badge`) — Return the PyPI version badge for the project.
@@ -252,15 +247,12 @@ ALWAYS check whether an existing function already covers your use case before im
252247
- `get_usethis_badge()` (`usethis._core.badge`) — Return the usethis badge.
253248
- `get_badge_order()` (`usethis._core.badge`) — Return the canonical ordered list of all supported badges.
254249
- `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.
256250
- `is_blank()` (`usethis._core.badge`) — Return True if the line is empty or contains only whitespace.
257251
- `is_header()` (`usethis._core.badge`) — Return True if the line is a Markdown header.
258252
- `is_badge()` (`usethis._core.badge`) — Return True if the line looks like a Markdown badge (heuristic).
259253
- `remove_badge()` (`usethis._core.badge`) — Remove a badge from the README.md file.
260254
- `browse_pypi()` (`usethis._core.browse`) — Open or display the PyPI project page URL for a package.
261255
- `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.
264256
- `show_usage_table()` (`usethis._core.list`) — Show the usage table.
265257
- `get_usage_table()` (`usethis._core.list`) — Get the usage table.
266258
- `add_readme()` (`usethis._core.readme`) — Add a README.md file to the project.
@@ -285,12 +277,10 @@ ALWAYS check whether an existing function already covers your use case before im
285277
- `use_pytest()` (`usethis._core.tool`) — Add and configure the pytest testing framework.
286278
- `use_requirements_txt()` (`usethis._core.tool`) — Add and configure a requirements.txt file exported from the uv lockfile.
287279
- `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.
289280
- `use_tach()` (`usethis._core.tool`) — Add and configure the Tach architecture enforcement tool.
290281
- `use_ty()` (`usethis._core.tool`) — Add and configure the ty type checker tool.
291282
- `get_project_deps()` (`usethis._deps`) — Get all project dependencies.
292283
- `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.
294284
- `get_deps_from_group()` (`usethis._deps`) — Get the list of dependencies in a named dependency group.
295285
- `register_default_group()` (`usethis._deps`) — Register a group in the default-groups configuration if it's not already there.
296286
- `add_default_groups()` (`usethis._deps`) — Register the given dependency groups as default groups in the package manager configuration.
@@ -300,42 +290,27 @@ ALWAYS check whether an existing function already covers your use case before im
300290
- `remove_deps_from_group()` (`usethis._deps`) — Remove dependencies from the named group if present.
301291
- `is_dep_in_any_group()` (`usethis._deps`) — Check if a dependency exists in any dependency group.
302292
- `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.
305293
- `is_pre_commit_used()` (`usethis._detect.pre_commit`) — Check if pre-commit is being used in the project.
306294
- `is_readme_used()` (`usethis._detect.readme`) — Check if the README.md file is used.
307295
- `next_breaking_version()` (`usethis._fallback`) — Get the next breaking version for a version string, following semver.
308296
- `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.
311297
- `deep_merge()` (`usethis._file.merge`) — Recursively merge source into target in place, returning target.
312298
- `print_keys()` (`usethis._file.print_`) — Convert a list of keys to a string.
313299
- `get_project_deps()` (`usethis._file.pyproject_toml.deps`) — Get all project dependencies from [project.dependencies].
314300
- `get_dep_groups()` (`usethis._file.pyproject_toml.deps`) — Get all dependency groups from [dependency-groups].
315301
- `get_poetry_project_deps()` (`usethis._file.pyproject_toml.deps`) — Get project dependencies from [tool.poetry.dependencies].
316302
- `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.
318303
- `get_name()` (`usethis._file.pyproject_toml.name`) — Get the project name from pyproject.toml.
319304
- `get_description()` (`usethis._file.pyproject_toml.name`) — Get the project description from pyproject.toml.
320305
- `get_project_dict()` (`usethis._file.pyproject_toml.project`) — Get the contents of the [project] section from pyproject.toml.
321306
- `get_requires_python()` (`usethis._file.pyproject_toml.requires_python`) — Get the requires-python constraint from pyproject.toml.
322307
- `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.
326308
- `ensure_pyproject_validity()` (`usethis._file.pyproject_toml.valid`) — Ensure pyproject.toml has a valid structure, adding missing required fields.
327309
- `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.
332310
- `get_yaml_document()` (`usethis._file.yaml.io_`) — Get a YAML document representation from a string or file-like object.
333311
- `update_ruamel_yaml_map()` (`usethis._file.yaml.update`) — Update the values of a ruamel.yaml map in-place using a diff-like algorithm.
334312
- `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__`.
336313
- `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.
339314
- `write_simple_requirements_txt()` (`usethis._init`) — Write a simple requirements.txt file with -e . and any project dependencies.
340315
- `ensure_dep_declaration_file()` (`usethis._init`) — Ensure that the file where dependencies are declared exists, if necessary.
341316
- `ensure_pyproject_toml()` (`usethis._init`) — Ensure that a pyproject.toml file exists, creating it if necessary.
@@ -345,7 +320,6 @@ ALWAYS check whether an existing function already covers your use case before im
345320
- `uninstall_pre_commit_hooks()` (`usethis._integrations.pre_commit.core`) — Uninstall pre-commit hooks.
346321
- `add_repo()` (`usethis._integrations.pre_commit.hooks`) — Add a pre-commit repo configuration to the pre-commit configuration file.
347322
- `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.
349323
- `add_placeholder_hook()` (`usethis._integrations.pre_commit.hooks`) — Add a placeholder hook to the pre-commit configuration with instructions for the user.
350324
- `remove_hook()` (`usethis._integrations.pre_commit.hooks`) — Remove pre-commit hook configuration.
351325
- `get_hook_ids()` (`usethis._integrations.pre_commit.hooks`) — Get the list of hook IDs currently configured in the pre-commit configuration file.
@@ -356,34 +330,23 @@ ALWAYS check whether an existing function already covers your use case before im
356330
- `get_minimum_pre_commit_version()` (`usethis._integrations.pre_commit.version`) — Get the declared minimum supported pre-commit version from the configuration.
357331
- `has_pyproject_toml_declared_build_system()` (`usethis._integrations.project.build`) — Check if a build system is declared in the project.
358332
- `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.
360333
- `augment_pythonpath()` (`usethis._integrations.project.imports`) — Temporarily add a directory to the Python path.
361334
- `get_source_dir_str()` (`usethis._integrations.project.layout`) — Get the source directory as a string ('src' or '.').
362335
- `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`.
367336
- `get_project_name()` (`usethis._integrations.project.name`) — The project name, from pyproject.toml if available or fallback to heuristics.
368337
- `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.
371338
- `fancy_model_dump()` (`usethis._integrations.pydantic.dump`) — Like `pydantic.model_dump` but with bespoke formatting options.
372339
- `add_pytest_dir()` (`usethis._integrations.pytest.core`) — Create the tests directory and conftest.py if they do not already exist.
373340
- `add_example_test()` (`usethis._integrations.pytest.core`) — Create an example test file in the tests directory if it does not already exist.
374341
- `remove_pytest_dir()` (`usethis._integrations.pytest.core`) — Remove the tests directory if it contains only managed files.
375342
- `get_readme_path()` (`usethis._integrations.readme.path`) — Return the path to the README file, searching for common README filenames.
376343
- `get_markdown_readme_path()` (`usethis._integrations.readme.path`) — Return the path to the Markdown README file, raising an error if it is not Markdown.
377344
- `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.
379345
- `parallel()` (`usethis._pipeweld.containers`) — Create a Parallel pipeline composition from the given components.
380346
- `series()` (`usethis._pipeweld.containers`) — Create a Series pipeline composition from the given components.
381347
- `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.
383348
- `get_endpoint()` (`usethis._pipeweld.func`) — Get the last step name (endpoint) from a pipeline component.
384349
- `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.
387350
- `call_subprocess()` (`usethis._subprocess`) — Run a subprocess and return its stdout, raising SubprocessFailedError on failure.
388351
- `ensure_managed_file_exists()` (`usethis._tool.config`) — Ensure a file manager's managed file exists.
389352
- `is_likely_used()` (`usethis._tool.heuristics`) — Determine whether a tool is likely used in the current project.

0 commit comments

Comments
 (0)