Skip to content

Commit

Permalink
Modernize (#60)
Browse files Browse the repository at this point in the history
### What kind of change does this PR introduce?

* Mostly changes to the top-level organization of the repo
* `blackdoc` should now autoupdate itself

### Does this PR introduce a breaking change?

No.

### Other information:

There's enough of a difference here that we could probably mount our own
documentation on ReadTheDocs. This PR nearly sets that up.
  • Loading branch information
Zeitsperre authored Sep 19, 2024
2 parents 1455670 + 51817e2 commit 1d9ee5f
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 66 deletions.
12 changes: 11 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@ updates:
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
groups:
actions:
patterns:
- "*"

- package-ecosystem: pip
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 5
groups:
python:
patterns:
- "setup.py"
ci:
patterns:
- "CI/*"
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- tox-env: py312
python-version: "3.12"
- tox-env: py313
python-version: "3.13.0-rc.1"
python-version: "3.13.0-rc.2"
- tox-env: pypy39
python-version: "pypy3.9"
- tox-env: pypy310
Expand All @@ -57,9 +57,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install tox
- name: Install CI dependencies
run: |
python -m pip install --require-hashes -r requirements.txt
python -m pip install --require-hashes -r CI/requirements_ci.txt
- name: Environment Caching
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
Expand Down
12 changes: 8 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "mambaforge-22.9"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
python:
install:
- method: pip
path: .
extra_requirements:
- dev
- docs
File renamed without changes.
4 changes: 2 additions & 2 deletions requirements.txt → CI/requirements_ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --generate-hashes --output-file=requirements.txt requirements.in
# pip-compile --generate-hashes --output-file=requirements_ci.txt requirements_ci.in
#
cachetools==5.4.0 \
--hash=sha256:3ae3b49a3d5e28a77a0be2b37dbcb89005058959cb2323858c2657c4a8cab474 \
Expand Down Expand Up @@ -55,7 +55,7 @@ tomli==2.0.1 \
tox==4.18.0 \
--hash=sha256:0a457400cf70615dc0627eb70d293e80cd95d8ce174bb40ac011011f0c03a249 \
--hash=sha256:5dfa1cab9f146becd6e351333a82f9e0ade374451630ba65ee54584624c27b58
# via -r requirements.in
# via -r requirements_ci.in
virtualenv==20.26.3 \
--hash=sha256:4c43a2a236279d9ea36a0d76f98d84bd6ca94ac4e0f4a3b9d46d05e10fea542a \
--hash=sha256:8cc4a31139e796e9a7de2cd5cf2489de1217193116a8fd42328f1bd65f434589
Expand Down
14 changes: 8 additions & 6 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ If you are proposing a new feature:
Get Started!
------------

Ready to contribute? Here's how to set up `cookiecutter-pypackage` for local development. Please note this documentation assumes you already have `virtualenv` and `Git` installed and ready to go.
Ready to contribute? Here's how to set up `cookiecutter-pypackage` for local development.
Please note this documentation assumes you already have `virtualenv` and `Git` installed and ready to go.

#. Fork the `cookiecutter-pypackage` repo on GitHub.

Expand Down Expand Up @@ -82,7 +83,7 @@ Ready to contribute? Here's how to set up `cookiecutter-pypackage` for local dev
Now you can make your changes locally.

#. When you're done making changes, check that your changes pass flake8. Since, this package contains mostly templates the flake should be run for tests directory:
#. When you're done making changes, check that your changes pass `flake8`. Since, this package contains mostly templates the flake should be run for tests directory:

.. code-block:: bash
Expand All @@ -100,15 +101,15 @@ Ready to contribute? Here's how to set up `cookiecutter-pypackage` for local dev
.. code-block:: bash
# Update pip
pip install -U pip
pip install --upgrade pip
#. Before raising a pull request you should also run tox. This will run the tests across different versions of Python:
#. Before raising a pull request you should also run `tox`. This will run the tests across different versions of Python:

.. code-block:: bash
tox
If you are missing flake8, pytest and/or tox, just `pip install` them into your virtualenv.
If you are missing `flake8`, `pytest` and/or `tox`, just `pip install` them into your virtualenv.

#. If your contribution is a bug fix or new feature, you may want to add a test to the existing test suite. See section Add a New Test below for details.

Expand All @@ -131,7 +132,8 @@ Before you submit a pull request, check that it meets these guidelines:

#. 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.rst.

#. The pull request should work for Python 3.8, 3.9, 3.10, 3.11, and for PyPy. Check https://github.com/Ouranosinc/cookiecutter-pypackage/actions/workflows/main.yml and make sure that the tests pass for all supported Python versions.
#. The pull request should work for Python 3.8 up to Python 3.13, and for PyPy 3.11 and PyPy 3.12.
Check https://github.com/Ouranosinc/cookiecutter-pypackage/actions/workflows/main.yml and make sure that the tests pass for all supported Python versions.

Add a New Test
--------------
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Features
--------

* Testing setup with ``unittest`` with ``coverage run`` or ``pytest``
* `pyproject.toml`_ with flit_ backend for PEP 517/621-compliant packaging.
* `GitHub Actions`_: Ready for GitHub Actions Continuous Integration testing.
* `pyproject.toml`_ with the flit_ backend for PEP 517/621-compliant packaging.
* `GitHub Actions`_: Ready for GitHub Actions Continuous Integration testing and Deployment.
* `Conda`_ environment file: Optionally use ``conda env create -f environment-dev.yml`` to create a new environment with the correct Python version.
* Tox_ testing: Setup to easily test for Python 3.8, 3.9, 3.10, 3.11, 3.12, and PyPy3.
* Tox_ testing: Setup to easily test for Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and PyPy3.
* Sphinx_ docs: Documentation ready for generation with, for example, `Read the Docs`_
* pre-commit_ hook: Run your tests and linting (e.g. `black`, `flake8`, `pylint`, etc.) before you commit your code!
* `pre-commit.ci`_: Automate `pre-commit` checks and corrections in your Pull Requests.
Expand All @@ -31,7 +31,7 @@ Features
Build Status
-------------

Upstream (audreyfeldroy/cookiecutter-pypackage): |docs-upstream| |pyup-upstream|
Upstream (audreyfeldroy/cookiecutter-pypackage): |docs-upstream|

Quickstart
----------
Expand Down
21 changes: 11 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import datetime

# import sys
# import os
Expand Down Expand Up @@ -51,18 +52,18 @@
master_doc = 'index'

# General information about the project.
project = 'cookiecutter-pypackage'
copyright = '2015, Audrey Roy Greenfeld'
author = 'Audrey Roy Greenfeld'
project = 'cookiecutter-pypackage-ouranos'
copyright = f'2020-{datetime.datetime.now().year}, Trevor James Smith'
author = 'Trevor James Smith'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.9.0'
version = '0.1.0'
# The full version, including alpha/beta/rc tags.
release = '0.9.0'
release = '0.1.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -228,8 +229,8 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'cookiecutter-pypackage.tex', 'cookiecutter-pypackage Documentation',
'Audrey Roy Greenfeld', 'manual'),
(master_doc, 'cookiecutter-pypackage-ouranos.tex', 'cookiecutter-pypackage-ouranos Documentation',
'Trevor James Smith', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -258,7 +259,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'cookiecutter-pypackage', 'cookiecutter-pypackage Documentation',
(master_doc, 'cookiecutter-pypackage-ouranos', 'cookiecutter-pypackage-ouranos Documentation',
[author], 1)
]

Expand All @@ -272,8 +273,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'cookiecutter-pypackage', 'cookiecutter-pypackage Documentation',
author, 'cookiecutter-pypackage', 'One line description of project.',
(master_doc, 'cookiecutter-pypackage-ouranos', 'cookiecutter-pypackage-ouranos Documentation',
author, 'cookiecutter-pypackage-ouranos', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
11 changes: 0 additions & 11 deletions requirements_dev.txt

This file was deleted.

12 changes: 0 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
[bumpversion]
current_version = 0.5.10
commit = True
tag = True

[metadata]
description-file = README.rst

[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'

[tool:pytest]
addopts =
--verbose
Expand Down
34 changes: 26 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# !/usr/bin/env python

from distutils.core import setup

from setuptools import setup
from pathlib import Path

setup(
name="cookiecutter-pypackage",
name="cookiecutter-pypackage-ouranos",
packages=[],
version="0.1.0",
description="Cookiecutter template for a Python package",
author="Audrey M. Roy Greenfeld",
long_description=Path(__file__).parent.joinpath("README.rst").read_text(),
long_description_content_type="text/x-rst",
author="Trevor James Smith",
license="BSD",
author_email="[email protected]",
url="https://github.com/audreyfeldroy/cookiecutter-pypackage",
author_email="[email protected]",
url="https://github.com/Ouranosinc/cookiecutter-pypackage",
keywords=[
"cookiecutter",
"template",
Expand All @@ -24,8 +26,6 @@
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand All @@ -37,4 +37,22 @@
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development",
],
extras_require={
"dev": [
"build >=1.2.2",
"cookiecutter >=2.6.0",
"coverage >=7.5.1",
"flit >=3.9.0",
"pre-commit >=3.5.0",
"pytest-cookies >=0.7.0",
"pytest >=8.2.0",
"tox >=4.18.1",
"twine >=5.1.1",
"watchdog >=4.0.0",
],
"docs": [
"alabaster >=0.7.13",
"sphinx >=7.0.0",
],
},
)
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
minversion = 4.17.1
minversion = 4.18.1
envlist = py{38,39,310,311,312,313}, pypy{39,310}, docs

[testenv:docs]
Expand All @@ -17,8 +17,7 @@ commands =
setenv =
PYTEST_ADDOPTS = "--color=yes"
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements_dev.txt
extras = dev
download = True
commands_pre =
pip list
Expand Down
5 changes: 4 additions & 1 deletion {{cookiecutter.project_slug}}/.github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ updates:
schedule:
interval: monthly
groups:
ci:
patterns:
- "CI/*"
python:
patterns:
- "*"
- "pyproject.toml"
3 changes: 2 additions & 1 deletion {{cookiecutter.project_slug}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ repos:
rev: v0.3.9
hooks:
- id: blackdoc
additional_dependencies: [ 'black==24.4.2' ]
additional_dependencies: [ 'black==24.8.0' ]
- id: blackdoc-autoupdate-black
{%- endif %}
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
Expand Down

0 comments on commit 1d9ee5f

Please sign in to comment.