Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thejaminator committed Jan 20, 2025
1 parent 8cdcdcc commit 58cb948
Show file tree
Hide file tree
Showing 6 changed files with 747 additions and 305 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: docs
on:
push:
branches:
- main
- master
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install poetry
- run: poetry install -E doc
- run: poetry run mkdocs gh-deploy --force
27 changes: 27 additions & 0 deletions docs/api/slist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# API Reference

## Slist Class

::: slist.Slist
options:
show_root_heading: true
show_source: true
heading_level: 2

## Helper Classes

### Group

::: slist.Group
options:
show_root_heading: true
show_source: true
heading_level: 3

### AverageStats

::: slist.AverageStats
options:
show_root_heading: true
show_source: true
heading_level: 3
124 changes: 124 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.

You can contribute in many ways:

## Types of Contributions

### Report Bugs

Report bugs at https://github.com/thejaminator/slist/issues.

If you are reporting a bug, please include:

* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.

### Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.

### Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.

### Write Documentation

slist could always use more documentation, whether as part of the
official slist docs, in docstrings, or even on the web in blog posts,
articles, and such.

### Submit Feedback

The best way to send feedback is to file an issue at https://github.com/thejaminator/slist/issues.

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)

## Get Started!

Ready to contribute? Here's how to set up `slist` for local development.

1. Fork the `slist` repo on GitHub.
2. Clone your fork locally

```
$ git clone git@github.com:your_name_here/slist.git
```
3. Ensure [poetry](https://python-poetry.org/docs/) is installed.
4. Install dependencies and start your virtualenv:
```
$ poetry install -E test -E doc -E dev
$ pip install tox
```
5. Create a branch for local development:
```
$ git checkout -b name-of-your-bugfix-or-feature
```
Now you can make your changes locally.
6. When you're done making changes, check that your changes pass the
tests, including testing other Python versions, with tox:
```
$ poetry run pytest tests
```
7. Commit your changes and push your branch to GitHub:
```
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
```
8. Submit a pull request through the GitHub website.
## Pull Request Guidelines
Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.md.
3. The pull request should work for Python 3.6, 3.7, 3.8 and 3.9. Check
https://github.com/thejaminator/slist/actions
and make sure that the tests pass for all supported Python versions.
## Tips
```
$ poetry run pytest tests/test_slist.py
```
To run a subset of tests.
## Deploying
A reminder for the maintainers on how to deploy.
Make sure all your changes are committed (including an entry in CHANGELOG.md).
Then run:
```
$ poetry run bump2version patch # possible: major / minor / patch
$ git push
$ git push --tags
```
GitHub Actions will then deploy to PyPI if tests pass.
53 changes: 53 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Welcome to Slist Documentation

Slist is a typesafe list implementation for Python that provides enhanced method chaining capabilities and additional utility functions.

## Features

- 🔒 Type-safe: Full type hints and mypy support
- ⛓️ Method chaining: Fluent interface for list operations
- 🛠️ Rich functionality: Many utility methods for common operations
- 🚀 Performance: Minimal overhead over Python's built-in list
- 🔍 Clear API: Well-documented methods with intuitive names

## Installation

```bash
pip install slist
```

Or with Poetry:

```bash
poetry add slist
```

## Quick Example

```python
from slist import Slist

# Create a list of numbers
numbers = Slist([1, 2, 3, 4, 5])

# Chain operations
result = numbers\
.filter(lambda x: x % 2 == 0)\ # Keep even numbers
.map(lambda x: x * 2)\ # Double each number
.reversed()\ # Reverse the order
.add_one(10) # Add one more number

print(result) # Slist([10, 8, 4])
```

## Why Slist?

Slist enhances Python's built-in list with:

1. Method chaining for cleaner code
2. Type-safe operations
3. Additional utility methods
4. Functional programming patterns
5. Async operation support

Check out the [API Reference](api/slist.md) for detailed documentation of all available methods.
60 changes: 60 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
site_name: Slist Documentation
site_description: Documentation for the Slist Python package - a typesafe list with more method chaining!
site_url: https://thejaminator.github.io/slist/
repo_url: https://github.com/thejaminator/slist
repo_name: thejaminator/slist

theme:
name: material
features:
- navigation.instant
- navigation.tracking
- navigation.sections
- navigation.expand
- navigation.top
- search.highlight
- search.share
palette:
- scheme: default
primary: indigo
accent: indigo
toggle:
icon: material/brightness-7
name: Switch to dark mode
- scheme: slate
primary: indigo
accent: indigo
toggle:
icon: material/brightness-4
name: Switch to light mode

plugins:
- search
- mkdocstrings:
default_handler: python
handlers:
python:
paths: [slist]
options:
show_source: true
show_root_heading: true
show_category_heading: true
show_bases: true
heading_level: 2

markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- admonition
- pymdownx.details
- attr_list
- md_in_html

nav:
- Home: index.md
- API Reference:
- Slist: api/slist.md
- Contributing: contributing.md
Loading

0 comments on commit 58cb948

Please sign in to comment.