Skip to content

Commit 9b1de4e

Browse files
committed
Add documentation for the project
1 parent 2afd517 commit 9b1de4e

File tree

13 files changed

+867
-0
lines changed

13 files changed

+867
-0
lines changed

.github/workflows/docs.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
build-and-deploy:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: '3.13'
28+
29+
- name: Cache dependencies
30+
uses: actions/cache@v3
31+
with:
32+
path: ~/.cache/pip
33+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pip-
36+
37+
- name: Install dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install mkdocs mkdocstrings[python] pymdown-extensions
41+
42+
- name: Build documentation (PR test)
43+
if: github.event_name == 'pull_request'
44+
run: |
45+
mkdocs build --clean --strict --verbose
46+
echo "📚 Documentation build successful for PR!"
47+
48+
- name: Comment on PR
49+
if: github.event_name == 'pull_request'
50+
uses: actions/github-script@v7
51+
with:
52+
script: |
53+
github.rest.issues.createComment({
54+
issue_number: context.issue.number,
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
body: '📚 Documentation build **successful**! ✅\n\n' +
58+
'🔍 Changes validated:\n' +
59+
'- MkDocs build completed without errors\n' +
60+
'- All links and references checked\n' +
61+
'- ReadTheDocs theme applied\n\n' +
62+
'💡 Ready to merge for deployment!'
63+
})
64+
65+
- name: Configure Git for deployment
66+
if: github.ref == 'refs/heads/main'
67+
run: |
68+
git config --global user.name "github-actions[bot]"
69+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
70+
71+
- name: Deploy to GitHub Pages
72+
if: github.ref == 'refs/heads/main'
73+
run: |
74+
mkdocs gh-deploy --force

.readthedocs.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.13"
12+
13+
# Build documentation in the docs/ directory with MkDocs
14+
mkdocs:
15+
configuration: mkdocs.yml
16+
17+
# Optionally declare the Python requirements required to build your docs
18+
python:
19+
install:
20+
- requirements: requirements.txt
21+
- method: pip
22+
path: .
23+
extra_requirements:
24+
- docs

docs/changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
For the complete and up-to-date changelog, see the [CHANGELOG.md](https://github.com/befeleme/pyp2spec/blob/main/CHANGELOG.md) file in the project root.
4+
5+
## Links
6+
7+
- [Full Changelog](https://github.com/befeleme/pyp2spec/blob/main/CHANGELOG.md)
8+
- [GitHub Releases](https://github.com/befeleme/pyp2spec/releases)
9+
- [PyPI Package](https://pypi.org/project/pyp2spec/)
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Development Setup
2+
3+
This guide helps you set up a development environment for contributing to pyp2spec.
4+
5+
## Prerequisites
6+
7+
- Python 3.9 or higher
8+
- Git
9+
- Linux environment (preferably Fedora)
10+
11+
## Setting Up the Development Environment
12+
13+
### 1. Clone the Repository
14+
15+
```bash
16+
git clone https://github.com/befeleme/pyp2spec.git
17+
cd pyp2spec
18+
```
19+
20+
### 2. Create a Virtual Environment
21+
22+
```bash
23+
python -m venv venv
24+
source venv/bin/activate
25+
```
26+
27+
### 3. Install Dependencies
28+
29+
```bash
30+
pip install -r requirements.txt
31+
pip install -e .
32+
```
33+
34+
### 4. Install Development Dependencies
35+
36+
```bash
37+
pip install -e ".[test,docs]"
38+
```
39+
40+
## Running Tests
41+
42+
Use tox to run the test suite:
43+
44+
```bash
45+
tox
46+
```
47+
48+
Or run tests directly with pytest:
49+
50+
```bash
51+
pytest
52+
```
53+
54+
## Code Style
55+
56+
The project uses ruff for linting. Run it with:
57+
58+
```bash
59+
ruff check pyp2spec/
60+
```
61+
62+
## Documentation
63+
64+
### Building Documentation
65+
66+
```bash
67+
pip install -e ".[docs]"
68+
mkdocs serve
69+
```
70+
71+
The documentation will be available at `http://localhost:8000`.
72+
73+
### Making Documentation Changes
74+
75+
1. Edit files in the `docs/` directory
76+
2. Preview changes with `mkdocs serve`
77+
3. Build the final documentation with `mkdocs build`
78+
79+
## Making Changes
80+
81+
1. Create a new branch for your feature or fix
82+
2. Make your changes
83+
3. Add tests for new functionality
84+
4. Update documentation if needed
85+
5. Run tests to ensure everything works
86+
6. Submit a pull request
87+
88+
## Debugging
89+
90+
To debug pyp2spec during development:
91+
92+
```bash
93+
python -m pyp2spec.pyp2spec package-name
94+
95+
# Or run individual components
96+
python -m pyp2spec.pyp2conf package-name
97+
python -m pyp2spec.conf2spec package-name.conf
98+
```

docs/docs-readme.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Documentation
2+
3+
This documentation is built with [MkDocs](https://www.mkdocs.org/) using the ReadTheDocs theme.
4+
5+
## ReadTheDocs Deployment
6+
7+
The documentation is automatically deployed to ReadTheDocs when changes are pushed to the main branch.
8+
9+
### Setup
10+
11+
1. **Import your repository** to [ReadTheDocs](https://readthedocs.org/):
12+
- Sign in to ReadTheDocs with your GitHub account
13+
- Click "Import a Project"
14+
- Select your `pyp2spec` repository
15+
16+
2. **Configure the project**:
17+
- The `.readthedocs.yaml` configuration file will be automatically detected
18+
- Python version is set to 3.13
19+
- Documentation dependencies are installed from the `docs` extra in `pyproject.toml`
20+
21+
3. **Documentation URL**: https://pyp2spec.readthedocs.io/
22+
23+
### Local Development
24+
25+
To build and serve the documentation locally:
26+
27+
```bash
28+
# Install documentation dependencies
29+
pip install -e .[docs]
30+
31+
# Serve the documentation locally
32+
mkdocs serve
33+
34+
# Build the documentation
35+
mkdocs build
36+
```
37+
38+
The documentation will be available at http://127.0.0.1:8000/
39+
40+
### Configuration Files
41+
42+
- `.readthedocs.yaml`: ReadTheDocs configuration
43+
- `mkdocs.yml`: MkDocs configuration
44+
- `pyproject.toml`: Python project configuration with documentation dependencies

docs/examples/automode.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Automode
2+
3+
Automode is designed for automated environments where you need packages that build successfully without manual intervention (like Copr).
4+
It applies convenient defaults that increase the chances of creating a buildable package.
5+
Automode applies sensible defaults for fields that couldn't be automatically determined.
6+
7+
## Notable features
8+
Import checks are limited to top-level modules only, reducing the chance of import failures due to missing system dependencies.
9+
10+
### License handling
11+
12+
- All found license names are validated as SPDX identifiers
13+
- Compliance with Fedora Legal data is checked
14+
- Warnings are issued for incorrect licenses but don't prevent spec generation
15+
- Valid SPDX expressions are automatically combined with "AND" operator
16+
17+
## Enabling automode
18+
19+
Use the `--automode` or `-a` flag:
20+
21+
```bash
22+
pyp2spec --automode package-name
23+
pyp2spec -a package-name
24+
```
25+
26+
## Limitations
27+
28+
!!! warning "Not for production"
29+
Packages generated with automode may not fully comply with Fedora packaging guidelines and should not be submitted for official review without manual review and adjustment.

0 commit comments

Comments
 (0)