Skip to content

Commit

Permalink
Make naming consistent (#9)
Browse files Browse the repository at this point in the history
* Make naming consistent

- Fix `KeyError` when config doesn't contain an `ignore` section

* Add ADR about name stylization
  • Loading branch information
daneah authored Nov 14, 2023
1 parent 2d9f9e2 commit 24b1ab2
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 32 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.0.4] - 2023-11-14

### Changed

- Use `repo-man` stylization consistently (and `repo_man` where needed for Python). This changes the executable command name, most notably.

### Fixed

- Fix `KeyError` when config doesn't contain an `ignore` section

## [0.0.3] - 2023-11-07

### Changed
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 4. Use consistent repo-man stylization

Date: 2023-11-14

## Status

Accepted

## Context

It is often nice to use a single word for shell command names and Python package names.
If the name is short enough to work as a single word it is probably usable and memorable.
The `repoman` name was already taken on the Python Package Index, but `repo-man` was available.

As the maintainer I have already tripped on the fact that there exist both `repo-man` and `repoman` instances in this project.
Using a consistent name stylization relieves this friction.

## Decision

Use `repo-man` and its Python-compatible equivalent `repo_man` consistently for everything.

## Consequences

- The shell command name most notably changes from `repoman` to `repo-man`
- The Python package import name changes from `repoman` to `repo_man`
- Confusion will be minimized about stylization; it's always two-worded
- Those using tab completion in their shell should be minimally impacted
- Those using the command in scripts will need to update it
- There is little utility to using the Python package directly at present, so little impact is expected
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
from pathlib import Path

PROJECT_ROOT = Path(__file__).parent.parent
PACKAGE_ROOT = PROJECT_ROOT / "src" / "repoman"
PACKAGE_ROOT = PROJECT_ROOT / "src" / "repo_man"

def run_apidoc(_):
from sphinx.ext import apidoc
Expand Down
26 changes: 13 additions & 13 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ To get started, install the ``repo-man`` package using your favorite package man
If you want to use ``repo-man`` in a global context, you can use a tool like `pipx <https://pypa.github.io/pipx/>`_.

After you've installed ``repo-man`` and have activated its environment as needed,
the :command:`repoman` command will be available for you to use.
You can run :command:`repoman --help` to see all the available options.
the :command:`repo-man` command will be available for you to use.
You can run :command:`repo-man --help` to see all the available options.

Configuration
*************
Expand All @@ -65,7 +65,7 @@ A valid :file:`repo-types.cfg` file might look something like the following:
repo-three
With this configuration, you can now use the :command:`repoman` command to manage your repositories.
With this configuration, you can now use the :command:`repo-man` command to manage your repositories.

Ignoring directories
++++++++++++++++++++
Expand All @@ -89,15 +89,15 @@ This section describes some of the useful ways to leverage repo-man for producti

.. admonition:: info

Always check the output of the :command:`repoman --help` command for the most accurate usage information.
Always check the output of the :command:`repo-man --help` command for the most accurate usage information.


Listing repositories
++++++++++++++++++++

.. code-block:: shell
$ repoman list --type some-flavor
$ repo-man list --type some-flavor
repo-one
repo-two
Expand All @@ -106,7 +106,7 @@ Listing flavors for a repository

.. code-block:: shell
$ repoman flavors repo-one
$ repo-man flavors repo-one
some-flavor
Adding a repository
Expand All @@ -116,33 +116,33 @@ You can add a repository to an existing flavor:

.. code-block:: shell
$ repoman add repo-four --type some-flavor
$ repo-man add repo-four --type some-flavor
You can also add a repository to an existing flavor:

.. code-block:: shell
$ repoman add repo-five --type some-brand-new-flavor
$ repo-man add repo-five --type some-brand-new-flavor
Listing known flavors
+++++++++++++++++++++

.. code-block:: shell
$ repoman --known
$ repo-man --known
some-flavor
some-other-flavor
Combining with other tools
++++++++++++++++++++++++++

The value of repoman comes in when combining its output with other tools.
The value of repo-man comes in when combining its output with other tools.
As an example, you can iterate over all the repositories of a given flavor to take some action:

.. code-block:: shell
$ for repo in $(repoman list --type some-flavor); do
$ for repo in $(repo-man list --type some-flavor); do
cd $repo;
# take some action;
cd ..;
Expand All @@ -161,7 +161,7 @@ List repositories you have cloned but that have no configured flavor:

.. code-block:: shell
$ repoman --unconfigured
$ repo-man --unconfigured
some-unknown-repo
some-other-unknown-repo
Expand All @@ -185,7 +185,7 @@ You can list all the repositories that you've configured as more than one flavor
.. code-block:: shell
$ repoman --duplicates
$ repo-man --duplicates
repo-one
Tips and tricks
Expand Down
21 changes: 8 additions & 13 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exclude =

[options.entry_points]
console_scripts =
repoman = repoman.cli:main
repo-man = repo_man.cli:main

[options.extras_require]
docs =
Expand Down Expand Up @@ -67,7 +67,7 @@ addopts = --cov --strict-markers
xfail_strict = True

[coverage:run]
source = repoman
source = repo_man
branch = True

[coverage:report]
Expand All @@ -77,8 +77,8 @@ skip_covered = True

[coverage:paths]
source =
src/repoman
*/site-packages/repoman
src/repo_man
*/site-packages/repo_man

[tox:tox]
envlist = py39,py312
Expand Down Expand Up @@ -109,10 +109,9 @@ commands =
[testenv:lint]
skip_install = True
deps =
flake8
flake8-bugbear
ruff
commands =
flake8 {posargs:src test}
ruff check {posargs:src test}

[testenv:docs]
extras =
Expand All @@ -125,9 +124,7 @@ commands =
--module-first \
--separate \
-o docs/reference/ \
src/repoman/ \
src/repoman/*.c \
src/repoman/*.so
src/repo_man/
sphinx-build -n -W --keep-going -b html docs/ docs/_build/

[testenv:devdocs]
Expand All @@ -140,7 +137,5 @@ commands =
--module-first \
--separate \
-o docs/reference/ \
src/repoman/ \
src/repoman/*.c \
src/repoman/*.so
src/repo_man/
sphinx-autobuild -n -W -b html docs/ docs/_build/
File renamed without changes.
6 changes: 3 additions & 3 deletions src/repoman/cli.py → src/repo_man/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

FAIL = "\033[91m"
ENDC = "\033[0m"
REPO_TYPES_CFG = "repo-types.cfg"
REPO_TYPES_CFG = "repo-man.cfg"


def check_if_allowed(path: Path) -> Union[bool, NoReturn]:
Expand Down Expand Up @@ -178,7 +178,7 @@ def handle_meta(path: Path, config: configparser.ConfigParser, args, repo_types:
if (
directory.is_dir()
and str(directory) not in repo_types["all"]
and str(directory) not in repo_types["ignore"]
and str(directory) not in repo_types.get("ignore", [])
):
print(directory)

Expand All @@ -198,7 +198,7 @@ def main():
check_if_allowed(path)

parser = argparse.ArgumentParser(
prog="repoman",
prog="repo-man",
description="Manage repositories of different types",
)

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions test/test_repoman.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def test_package_is_importable():
import repoman
import repo_man

print(repoman)
print(repo_man)

0 comments on commit 24b1ab2

Please sign in to comment.