Skip to content

Commit

Permalink
Use find_namespace: instead of find:
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Jun 4, 2022
1 parent 3d07802 commit de88e8f
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ In Development
to `.readthedocs.yaml`
- Update `.pre-commit-config.yaml`
- Update `Sphinx` version to `~=5.0`
- `setup.cfg`: Use `find_namespace:` instead of `find:` (See
<https://github.com/pypa/setuptools/issues/3340>)
- Internal API:
- Store project details in a `ProjectDetails` class
- Add `Templater` and `TemplateWriter` classes
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/pyrepo/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
4 changes: 2 additions & 2 deletions src/pyrepo/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def unflatten(self) -> None:
log.info("Updating setup.cfg ...")
setup_cfg = ConfigUpdater()
setup_cfg.read(str(self.directory / "setup.cfg"), encoding="utf-8")
setup_cfg["options"]["py_modules"].value = "find:"
setup_cfg["options"]["py_modules"].value = "find_namespace:"
setup_cfg["options"]["py_modules"].key = "packages"
setup_cfg["options"].add_after.section("options.packages.find")
opf = setup_cfg["options.packages.find"]
Expand Down Expand Up @@ -229,7 +229,7 @@ def add_pyversion(self, v: str) -> None:
add_line_to_file(
self.directory / ".github" / "workflows" / "test.yml",
f"{' ' * 10}- '{pyv}'\n",
inserter=AfterLast(fr"^{' ' * 10}- ['\x22]?\d+\.\d+['\x22]?$"),
inserter=AfterLast(rf"^{' ' * 10}- ['\x22]?\d+\.\d+['\x22]?$"),
encoding="utf-8",
)
insort(self.details.python_versions, pyv)
Expand Down
2 changes: 1 addition & 1 deletion src/pyrepo/templates/setup.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ project_urls =
{% if is_flat_module %}
py_modules = {{import_name}}
{% else %}
packages = find:
packages = find_namespace:
{% endif %}
package_dir =
=src
Expand Down
2 changes: 1 addition & 1 deletion test/data/add_typing/flat/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/command-noflat-req/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/command-noflat/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/flat-typing/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/nonflat-ci/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/nonflat-noreq/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/nonflat-req/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/nonflat-tests-typing/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/nonflat-tests/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/nonflat-typing/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/requires-noflat/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/pyrepo_init/src-nonflat-tests/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ project_urls =
Bug Tracker = https://github.com/jwodder/foobar/issues

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
include_package_data = True
Expand Down
2 changes: 1 addition & 1 deletion test/data/unflatten/command-flat/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ project_urls =
Say Thanks! = https://saythanks.io/to/jwodder

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
python_requires = ~=3.4
Expand Down
2 changes: 1 addition & 1 deletion test/data/unflatten/flat/after/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ project_urls =
Say Thanks! = https://saythanks.io/to/jwodder

[options]
packages = find:
packages = find_namespace:
package_dir =
=src
python_requires = ~=3.4
Expand Down

0 comments on commit de88e8f

Please sign in to comment.