Skip to content

Commit 5cae19b

Browse files
authored
Merge pull request #4 from JerilynFranz/doc-fixes
Updated documenation
2 parents cd1bd08 + 0d979f4 commit 5cae19b

5 files changed

Lines changed: 122 additions & 84 deletions

File tree

docs_source/configuration.rst

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Configuration
55
autopypath can be configured in several ways to suit different project structures
66
and user preferences. The configuration sources include:
77

8-
- Configuration files: `autopypath.toml` and `pyproject.toml`.
8+
- Configuration files: ``autopypath.toml`` and ``pyproject.toml``.
99
- Function parameters: Directly passing configuration options to the `configure_pypath()` function.
1010
- Default settings: Built-in defaults used when no other configuration is provided.
1111

@@ -16,9 +16,9 @@ By default, autopypath identifies the repository root by looking for specific
1616
marker files or directories. The default markers are:
1717

1818
- ``autopypath.toml``: A configuration file that can specify custom repository
19-
root markers in addition to other settings. Only the first autopypath.toml file
20-
found when searching upwards from the starting directory is used. Additional autopypath.toml files
21-
found higher up the directory tree are ignored.
19+
root markers in addition to other settings. Only the first ``autopypath.toml`` file
20+
found when searching upwards from the starting directory is used. Additional
21+
``autopypath.toml`` files found higher up the directory tree are ignored.
2222
- ``pyproject.toml``: A common project configuration file that can also
2323
contain autopypath settings.
2424
- ``.git``: Indicates a Git repository root by the presence of this directory.
@@ -34,10 +34,10 @@ root of the repository. Autopypath searches upwards from the starting directory
3434
until it finds one of these markers.
3535

3636
It is possible to customize the repository root markers by providing a
37-
list of marker names to the `repo_markers` parameter of the `configure_pypath()`
38-
function or by specifying them in the `autopypath.toml` configuration file.
37+
list of marker names to the ``repo_markers`` parameter of the ``configure_pypath()``
38+
function or by specifying them in the ``autopypath.toml`` configuration file.
3939

40-
Example of customizing repository root markers in `autopypath.toml` or `pyproject.toml`:
40+
Example of customizing repository root markers in ``autopypath.toml`` or ``pyproject.toml``:
4141

4242
.. code-block:: toml
4343
@@ -48,73 +48,73 @@ Example of customizing repository root markers in `autopypath.toml` or `pyprojec
4848
Load Strategy
4949
=============
5050

51-
Load Strategy determines how found paths are added to `sys.path`. The default
52-
strategy is `prepend`, but it can be customized using the `load_strategy` parameter
53-
to `configure_pypath()` or configured in `pyproject.toml`` file in the repository root, or in
54-
an `autopypath.toml` file.
51+
Load Strategy determines how found paths are added to :data:`sys.path`. The default
52+
strategy is ``prepend``, but it can be customized using the ``load_strategy`` parameter
53+
to `configure_pypath()` or configured in ``pyproject.toml`` file in the repository root, or in
54+
an ``autopypath.toml`` file.
5555

5656
The available load strategies are:
5757

5858
prepend
5959
-------
6060

61-
`prepend` adds merged found paths to the start of `sys.path`
61+
``prepend`` adds merged found paths to the start of :data:`sys.path`
6262
in precedence resolution ordered from highest to lowest. This ensures that
6363
modules in the repository take precedence over globally installed modules.
6464

65-
prepend_highest_only
65+
prepend_highest_priority
6666
--------------------
6767

68-
`prepend_highest_only` adds only the highest precedence found path to the start of `sys.path`.
68+
``prepend_highest_priority`` adds only the highest precedence found path to the start of :data:`sys.path`.
6969
This is useful when you want to ensure that only the most relevant path is used.
7070

7171
replace
7272
-------
7373

74-
`replace` clears `sys.path` and adds only the found paths. This is useful for isolated environments
74+
``replace`` clears :data:`sys.path` and adds only the found paths. This is useful for isolated environments
7575
where you want to avoid any interference from globally installed modules. This
7676
is a highly advanced use case and should be used with **extreme** caution as it will remove all
77-
other paths from `sys.path` - including standard library paths.
77+
other paths from :data:`sys.path` - including standard library paths.
7878

7979
.. warning::
8080

8181
This **WILL** break many Python functionalities and is in the category of "if you don't know why you need it,
8282
you don't need it". Expert users only!
8383

84-
The load strategy can be set in either `pyproject.toml` or `autopypath.toml` like this:
84+
The load strategy can be set in either ``pyproject.toml`` or ``autopypath.toml`` like this:
8585

8686
.. code-block:: toml
8787
:caption: pyproject.toml or autopypath.toml
8888
8989
[tool.autopypath]
90-
load_strategy = "prepend" # or "prepend_highest_only" or "replace"
90+
load_strategy = "prepend" # or "prepend_highest_priority" or "replace"
9191
9292
Paths
9393
=====
9494

95-
By default, autopypath adds several common project directories to `sys.path`
95+
By default, autopypath adds several common project directories to :data:`sys.path`
9696
relative to the repository root. These default paths are intended to cover
9797
the most common project layouts. The default paths, in order of priority, are:
9898

99-
- `src`: Common source directory for project code.
100-
- `tests`: Common source directory for test code.
101-
- `lib`: Common source directory for library code.
102-
- `src/test`: Alternate test source directory.
99+
- ``src``: Common source directory for project code.
100+
- ``tests``: Common source directory for test code.
101+
- ``lib``: Common source directory for library code.
102+
- ``src/test``: Alternate test source directory.
103103

104104
These directories are added to :data:`sys.path` if they exist in the repository root -
105105
but only if no other paths are provided.
106106

107-
You can customize the paths added to `sys.path` using the `paths` parameter
108-
to `configure_pypath()`, in a `pyproject.toml`, or a `autopypath.toml` file
109-
in the `[tool.autopypath]` section.
107+
You can customize the paths added to :data:`sys.path` using the ``paths`` parameter
108+
to `configure_pypath()`, in a ``pyproject.toml``, or a ``autopypath.toml`` file
109+
in the ``[tool.autopypath]`` section.
110110

111111
This is just the 'out-of-the-box' default configuration and is intended to cover
112112
the most common project layouts. You can (and **should**) customize it as needed for your project.
113113

114114

115115
If a configured path does not exist or is not a directory, it will be logged at 'INFO' level and skipped.
116116

117-
In either `pyproject.toml` or `autopypath.toml`, the configuration for paths looks like this:
117+
In either ``pyproject.toml`` or ``autopypath.toml``, the configuration for paths looks like this:
118118

119119
.. code-block:: toml
120120
@@ -125,28 +125,27 @@ Path Resolution Order
125125
=====================
126126

127127
The order in which autopypath resolves paths can be customized using the
128-
`path_resolution_order` parameter to `configure_pypath()` or in a
129-
`pyproject.toml` or `autopypath.toml` file. This setting determines the sequence
130-
of configuration sources that autopypath checks for paths to add to `sys.path`.
128+
``path_resolution_order`` parameter to `configure_pypath()` or in a
129+
``pyproject.toml`` or ``autopypath.toml`` file. This setting determines the sequence
130+
of configuration sources that autopypath checks for paths to add to :data:`sys.path`.
131131

132132
The available sources are:
133133

134-
- `manual`: Paths provided directly via the `paths` parameter to `configure_pypath()`.
135-
- `autopypath`: Paths specified in `autopypath.toml` configuration files.
136-
- `pyproject`: Paths specified in `pyproject.toml` configuration files.
134+
- ``manual``: Paths provided directly via the ``paths`` parameter to `configure_pypath()`.
135+
- ``autopypath``: Paths specified in ``autopypath.toml`` configuration files.
136+
- ``pyproject``: Paths specified in ``pyproject.toml`` configuration files.
137137

138-
The default resolution order is `['manual', 'autopypath', 'pyproject']`, meaning
139-
that manually provided paths take precedence over those specified in `autopypath.toml`,
140-
which in turn take precedence over those in `pyproject.toml`. '
138+
The default resolution order is ``['manual', 'autopypath', 'pyproject']``, meaning
139+
that manually provided paths take precedence over those specified in ``autopypath.toml``,
140+
which in turn take precedence over those in ``pyproject.toml``.
141141

142-
This primarily affect the order in which paths are added to `sys.path` when using
143-
the `prepend` load strategy.
142+
This primarily affects the order in which paths are added to :data:`sys.path` when using
143+
the ``prepend`` load strategy.
144144

145-
In either `pyproject.toml` or `autopypath.toml`, the configuration for path resolution
145+
In either ``pyproject.toml`` or ``autopypath.toml``, the configuration for path resolution
146146
order looks like this:
147147

148148
.. code-block:: toml
149149
150150
[tool.autopypath]
151151
path_resolution_order = ["manual", "autopypath", "pyproject"]
152-

docs_source/contributing.rst

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ To contribute code or documentation updates to `autopypath`, follow these steps:
4242
cd python-autopypath
4343
4444
4. Create a new branch for your changes. Please use descriptive names for your branches
45-
to indicate the purpose of your changes such as `feature/my-feature-branch` or
46-
`fix/issue-123`, `docs/update-readme`, etc.
45+
to indicate the purpose of your changes such as ``feature/my-feature-branch`` or
46+
``fix/issue-123``, ``docs/update-readme``, etc.
4747

4848
.. code-block:: shell
4949
5050
git checkout -b feature/my-feature-branch
5151
5252
5. Setup the development environment as described in the :ref:`development-installation` section
53-
by running the `bootstrap.py` script and activating the virtual environment.
53+
by running the ``bootstrap.py`` script and activating the virtual environment.
5454

5555
This will install all necessary dependencies for development and testing including current versions of
5656
`tox <https://python-basics-tutorial.readthedocs.io/en/latest/test/tox.html>`_, `ruff <https://ruff.rs/>`_,
@@ -61,7 +61,7 @@ To contribute code or documentation updates to `autopypath`, follow these steps:
6161
6262
python bootstrap.py
6363
64-
.. code-block:: text
64+
.. code-block:: shell
6565
:caption: Activating the virtual environment on Linux/macOS
6666
6767
source .venv/bin/activate
@@ -71,22 +71,28 @@ To contribute code or documentation updates to `autopypath`, follow these steps:
7171
7272
.venv\Scripts\activate.bat
7373
74+
.. code-block:: text
75+
:caption: Activating the virtual environment on Windows PowerShell
76+
77+
.venv\Scripts\Activate.ps1
78+
7479
6. Make your changes and test them thoroughly using the existing test suite
7580
and by adding new tests if necessary. Our goal is to maintain high code quality
7681
and ensure that all code is tested and all tests pass before merging any contributions.
7782

7883
We use `ruff <https://ruff.rs/>`_ and `mypy <https://mypy.readthedocs.io/en/stable/>`_ for linting,
7984
code style, and type checking, so please ensure your code adheres to the project's coding standards.
80-
This is largely automated via `tox` and the `tox` configuration already includes `ruff` and `mypy` checks
85+
This is largely automated via `tox <https://python-basics-tutorial.readthedocs.io/en/latest/test/tox.html>`_
86+
and the ``tox`` configuration already includes `ruff <https://ruff.rs/>`_ and `mypy <https://mypy.readthedocs.io/en/stable/>`_ checks
8187
as part of the test suite.
8288

8389
If the tests don't pass or don't cover your changes, the pull request may be delayed or rejected.
8490

85-
You can run the test suite using `tox`:
91+
You can run the test suite using ``tox``:
8692

8793
.. code-block:: shell
8894
89-
tox
95+
tox run
9096
9197
It checks your code against multiple Python versions and runs all tests to ensure compatibility
9298
and correctness.
@@ -100,8 +106,8 @@ To contribute code or documentation updates to `autopypath`, follow these steps:
100106
the source files are located in the `docs_source <https://github.com/JerilynFranz/python-autopypath/tree/main/docs_source>`_
101107
directory of the project.
102108

103-
You can locally build the documentation using `tox run -e docs` to verify your changes.
104-
The built documentation will be available in the `documentation` directory.
109+
You can locally build the documentation using ``tox run -e docs`` to verify your changes.
110+
The built documentation will be available in the ``documentation`` directory.
105111

106112
.. code-block:: shell
107113
@@ -113,7 +119,7 @@ To contribute code or documentation updates to `autopypath`, follow these steps:
113119
114120
git push origin my-feature-branch
115121
116-
9. Open a pull request on the `python-autopypath` repository.
122+
9. Open a pull request on the ``python-autopypath`` repository.
117123

118124
Make sure to provide a clear description of your changes, the problem they solve,
119125
and any relevant context. Link to any related issues if applicable.
@@ -139,7 +145,7 @@ To contribute code or documentation updates to `autopypath`, follow these steps:
139145
uv.lock
140146
-------
141147

142-
uv.lock is included in the source distribution to support reproducible
148+
``uv.lock`` is included in the source distribution to support reproducible
143149
builds and independent verification. Use of uv is optional for contributors.
144150

145151
Need Help?

docs_source/installation.rst

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ repository and install it manually. Here are the steps to do so:
2020

2121
.. code-block:: shell
2222
23-
git clone https://github.com/JerilynFranz/autopypath.git
24-
cd autopypath
23+
git clone https://github.com/JerilynFranz/python-autopypath.git
24+
cd python-autopypath
2525
pip install .
2626
2727
.. _development-installation:
@@ -39,12 +39,33 @@ To make this easier, a bootstrap script is provided.
3939
You can run the following commands:
4040

4141
.. code-block:: shell
42+
:caption: Setting up the development environment
4243
4344
git clone https://github.com/JerilynFranz/python-autopypath.git
4445
cd python-autopypath
45-
python3 bootstrap.py
46+
python bootstrap.py
47+
48+
And then activate the virtual environment with:
49+
50+
.. code-block:: shell
51+
:caption: Activating the virtual environment on Linux/macOS
52+
4653
source .venv/bin/activate
4754
55+
or on Windows use:
56+
57+
.. code-block:: text
58+
:caption: Activating the virtual environment on Windows
59+
60+
.venv\Scripts\activate.bat
61+
62+
or if using PowerShell:
63+
64+
.. code-block:: text
65+
:caption: Activating the virtual environment on Windows PowerShell
66+
67+
.venv\Scripts\Activate.ps1
68+
4869
This will set up the development environment and install `autopypath` in
4970
editable mode.
5071

docs_source/public_api.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ configure_pypath
126126

127127
:param strict:
128128
If `True`, raises an error for conditions that would normally only log a warning.
129-
Default is `False`. It also turns logged warnings into logged errors and raised
129+
Default is `False`. It also turns logged warnings into logged errors and raises
130130
:class:`~autopypath.custom.AutopypathError` exceptions.
131131

132132
Conditions that normally trigger logged warnings include:
@@ -165,7 +165,7 @@ pyproject.toml and autopypath.toml Configurations and Defaults
165165

166166
For information on configuring `autopypath` using `pyproject.toml` or
167167
`autopypath.toml` files, and for the defaults used when no configurations
168-
are explicitly set, please refer to the :ref:`configuration section <configuration>`
168+
are explicitly set, please refer to the :doc:`configuration section <configuration>`
169169
of the documentation.
170170

171171
Logging

0 commit comments

Comments
 (0)