Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #1

Merged
merged 25 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d90e4e4
:fire: Remove requirements.txt
EarlMilktea Sep 27, 2024
1f4401a
:wrench: Update pyproject
EarlMilktea Sep 27, 2024
beca955
:art: Format README
EarlMilktea Sep 27, 2024
d39f57a
:fire: Remove ruff.toml
EarlMilktea Sep 27, 2024
0a2f02a
:see_no_evil: Ignore lock
EarlMilktea Sep 27, 2024
819a7b3
:technologist: Add Pipfile
EarlMilktea Sep 27, 2024
4a00aa5
:memo: Update README
EarlMilktea Sep 27, 2024
9ed6c5c
:construction: Update sources
EarlMilktea Sep 27, 2024
0d85efe
:wrench: Add py.typed
EarlMilktea Sep 27, 2024
4d609f9
:construction: Update pyproject
EarlMilktea Sep 27, 2024
8c2fa7e
:page_facing_up: Fill placeholders
EarlMilktea Sep 27, 2024
eeafb0b
:wrench: Use pytest-cov
EarlMilktea Sep 27, 2024
f2ada31
:children_crossing: Update error message
EarlMilktea Sep 27, 2024
0eb244c
:construction_worker: Update CI
EarlMilktea Sep 27, 2024
20c5539
:technologist: Use mark.parametrize
EarlMilktea Sep 27, 2024
7f7ea34
:white_check_mark: Update tests
EarlMilktea Sep 27, 2024
a82a57b
:memo: Add badges
EarlMilktea Sep 27, 2024
84b358d
:heavy_plus_sign: Add doc builders
EarlMilktea Sep 27, 2024
7927528
:memo: Add docs
EarlMilktea Sep 27, 2024
3ae42f4
:construction_worker: Use python 3.12
EarlMilktea Sep 27, 2024
ff8c87f
:construction_worker: Add docs CI
EarlMilktea Sep 27, 2024
603d010
:fire: Remove myst_parser
EarlMilktea Sep 27, 2024
6cb1865
:wrench: Comment out unused configs
EarlMilktea Sep 27, 2024
51bf6d8
:memo: Add docs badge
EarlMilktea Sep 27, 2024
0733b11
:memo: Add MIT badge
EarlMilktea Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/black.yaml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: docs

on:
pull_request:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- run: |
pip install pip -U
pip install -e .[dev]

- run: sphinx-build docs/source docs/build --fail-on-warning
43 changes: 28 additions & 15 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
name: Run pytest
name: CI

on: [push, pull_request]
on:
pull_request:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
pytest:
strategy:
fail-fast: false

matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install pytest and self
run: |
python -m pip install --upgrade pip
pip install pytest
pip install .
- name: Test with pytest
run: |

- run: |
pip install pip -U
pip install -e .[dev]

- run: |
pytest
44 changes: 40 additions & 4 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
name: Lint by Ruff
name: staticcheck

on: [push, pull_request]
on:
pull_request:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ruff:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
- uses: actions/checkout@v4

- name: Ruff (lint)
uses: chartboost/ruff-action@v1

- name: Ruff (format)
uses: chartboost/ruff-action@v1
with:
args: "format --check"

typecheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- run: |
pip install pip -U
pip install -e .[dev]

- run: mypy

- run: pyright
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ipython_config.py
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
Expand Down
8 changes: 0 additions & 8 deletions .ruff.toml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) [year] [fullname]
Copyright (c) 2022 Todo group

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 11 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pypkg-template = {extras = ["dev"], file = ".", editable = true}

[dev-packages]
pytest-sugar = "*"
ipython = "*"
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
# pypkg_template

Python package template with the modern toml-based style.
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![CI](https://github.com/todo-group/pypkg_template/actions/workflows/pytest.yaml/badge.svg)](https://github.com/todo-group/pypkg_template/actions/workflows/pytest.yaml)
[![docs](https://github.com/todo-group/pypkg_template/actions/workflows/docs.yaml/badge.svg)](https://github.com/todo-group/pypkg_template/actions/workflows/docs.yaml)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

Python package template with the modern toml-based style.

See [here](https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html) for more details.

## How to use

### `pip` development

```bash
git clone https://github.com/todo-group/pypkg_template.git
cd pypkg_template
pip install pip -U
pip install -e .[dev]
```

### `pipenv` development

```bash
git clone https://github.com/todo-group/pypkg_template.git
cd pypkg_template
pip install pip -U
# Simple installation
# For development purpose, use `pip install -e .[dev]` instead.
pip install -e .
pip install pipenv
pipenv install --dev
pipenv shell
```
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
35 changes: 35 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Sphinx configuration file.""" # noqa: INP001
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import sys
from pathlib import Path

sys.path.insert(0, str(Path("../../src").resolve()))

project = "pypkg_template"
copyright = "2022, SS" # noqa: A001
author = "SS"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
]

# templates_path = ["_templates"]
# exclude_patterns = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "furo"
# html_static_path = ["_static"]
15 changes: 15 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. pypkg_template documentation master file, created by
sphinx-quickstart on Sat Sep 28 03:33:47 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

pypkg_template documentation
============================

This is the documentation for the `pypkg_template` package.

.. toctree::
:maxdepth: 2
:caption: Contents:

modules
7 changes: 7 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pypkg_template
==============

.. toctree::
:maxdepth: 4

pypkg_template
21 changes: 21 additions & 0 deletions docs/source/pypkg_template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pypkg\_template package
=======================

Submodules
----------

pypkg\_template.fibonacci module
--------------------------------

.. automodule:: pypkg_template.fibonacci
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: pypkg_template
:members:
:undoc-members:
:show-inheritance:
Loading
Loading