Installation Guide
This guide provides step-by-step instructions for installing and setting up the sphinx-linkfix project template. Choose the installation section that best fits your needs.
Prerequisites
Before installing the project, ensure you have the following requirements:
Python 3.9 (required for this project)
Git for cloning the repository
Internet connection for downloading dependencies
User Installation
This section is for users who want to use the extension.
Quick Start
Install the Extension: Install the package using pip
pip install sphinx-linkfix
Configure Sphinx: In your Sphinx
conf.pyfile, add the extension
extensions = [
...,
'sphinx_linkfix',
]
Set Configuration Options (Optional): You can customize the behavior of the extension by adding the following options to your
conf.pyfile:
# Path prefix to strip from links (default: "docs/")
docs_relative_path = 'docs/'
# List of file extensions to process
sphinx_linkfix_file_extensions = ('.rst', '.md')
Developer Installation
This section is for developers who want to contribute to the project or modify the source code.
Development Setup
Clone and Navigate
git clone https://github.com/j-moralejo-pinas/sphinx-linkfix.git
cd sphinx-linkfix
Set Up Development Environment: Create a virtual environment (recommended)
conda create -n sphinx-linkfix-dev python=3.9
conda activate sphinx-linkfix-dev
- Install in Development Mode: Install the package with development dependencies
This installs the project in editable mode with all development tools including:
pytest- Testing frameworkpyright- Type checkingpre-commit- Git hooks for code qualityruff- Fast Python linter and formatterpydoclint- Documentation lintingdocformatter- Documentation formattingpytest-cov- Test coveragepyupgrade- Code modernizationsphinx- Documentation generationsphinx-autoapi- Automatic API documentation generation
pip install -e ".[dev,docs]"
Set Up Pre-commit Hooks: Install pre-commit hooks to ensure code quality
pre-commit install
Configure Type Checking: Link your development environment to Pyright for proper type checking. Create a
pyrightconfig.local.jsonfile in the project root
{
"venvPath": "/path/to/your/conda/envs",
"venv": "sphinx-linkfix-dev"
}
Configure Environment: Set the
PYTHONPATHenvironment variable or add it to your shell profile to include the source directory (~/.bashrc,~/.zshrc, etc.)
export PYTHONPATH="${PWD}/src:${PYTHONPATH}"
Verify Installation: Test that the development installation was successful
python -c "import sphinx_linkfix; print('Development installation successful!')"
pytest --version
ruff --version
pyright --version
Troubleshooting
Common Issues
Import Errors
If you encounter import errors, ensure the PYTHONPATH is set correctly
export PYTHONPATH="${PWD}/src:${PYTHONPATH}"
Virtual Environment Issues
If you have issues with virtual environments, try
# For conda environments
conda info --envs # List all environments
conda activate sphinx-linkfix-dev # Activate the environment
# For venv environments
which python # Check which Python you're using
pip list # Check installed packages
Getting Help
Check the project’s GitHub issues: https://github.com/j-moralejo-pinas/sphinx-linkfix/issues
Review the documentation for detailed usage examples
Ensure all dependencies are correctly installed
See Also
Contributing - How to contribute to the project