Skip to content

Commit

Permalink
Merge branch 'release-v2.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
fedejaure committed Jul 26, 2021
2 parents 193ebf6 + 2a6a3c2 commit 124525b
Show file tree
Hide file tree
Showing 19 changed files with 166 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
commit = True
tag = False
current_version = 2.0.0
current_version = 2.0.1

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jobs:
tests:
needs: linting
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [Ubuntu, MacOS]
python-version: [3.7, 3.8, 3.9]
fail-fast: true
steps:
Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ repos:
- id: check-json
exclude: "^{{cookiecutter.project_name}}/"
- id: end-of-file-fixer
exclude: "^{{cookiecutter.project_name}}/"
- repo: https://github.com/timothycrosley/isort
rev: 5.8.0
rev: 5.9.2
hooks:
- id: isort
exclude: "^{{cookiecutter.project_name}}/"
- repo: https://github.com/psf/black
rev: 21.5b2
rev: 21.7b0
hooks:
- id: black
exclude: "^{{cookiecutter.project_name}}/"
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.1] - 2021-07-26
### Fixed
- package discovery when `project_name` != `project_slug`.
- `end-of-file` hook.
- pypi release step only for open source projects.

### Changed
- isort from `^5.8.0` to `^5.9.2`.
- black from `^21.5b2` to `^21.7b0`.
- watchdog from `^2.1.2` to `^2.1.3`.
- xdoctest from `^0.15.4` to `^0.15.5`.
- mypy from `^0.902` to `^0.910`.
- sphinx from `^4.0.2` to `^4.1.1`.
- invoke from `^1.5.0` to `^1.6.0`.
- actions/upload-artifact from `v2.2.0` to `v2.2.4`.
- actions/download-artifact from `v2.0.5` to `v2.0.10`.
- codecov/codecov-action from `v1.3.1` to `v2.0.2`.
- pypa/gh-action-pypi-publish for `v1.4.1` to `v1.4.2`.

## [2.0.0] - 2021-06-12
### Added
- optional `CODE_OF_CONDUCT.md` file.
Expand Down Expand Up @@ -227,7 +246,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First release.


[Unreleased]: https://github.com/fedejaure/cookiecutter-modern-pypackage/compare/v2.0.0...develop
[Unreleased]: https://github.com/fedejaure/cookiecutter-modern-pypackage/compare/v2.0.1...develop
[2.0.1]: https://github.com/fedejaure/cookiecutter-modern-pypackage/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/fedejaure/cookiecutter-modern-pypackage/compare/v1.2.3...v2.0.0
[1.2.3]: https://github.com/fedejaure/cookiecutter-modern-pypackage/compare/v1.2.2...v1.2.3
[1.2.2]: https://github.com/fedejaure/cookiecutter-modern-pypackage/compare/v1.2.1...v1.2.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pip install -U cookiecutter
Generate a Python package project:

```
cookiecutter gh:fedejaure/cookiecutter-modern-pypackage --checkout v2.0.0
cookiecutter gh:fedejaure/cookiecutter-modern-pypackage --checkout v2.0.1
```

Then:
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"email": "[email protected]",
"github_username": "fedejaure",
"project_name": "modern-python-boilerplate",
"project_slug": "{{ cookiecutter.project_name.lower().replace('-', '_').replace('-', '_') }}",
"project_slug": "{{ cookiecutter.project_name.lower().replace('-', '_') }}",
"project_title": "{{ cookiecutter.project_name.replace('-', ' ').title() }}",
"project_short_description": "Python Boilerplate contains all the boilerplate you need to create a modern Python package.",
"version": "0.1.0",
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
# built documents.
#
# The short X.Y version.
version = "2.0.0"
version = "2.0.1"
# The full version, including alpha/beta/rc tags.
release = "2.0.0"
release = "2.0.1"

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx==4.0.2
sphinx==4.1.1
recommonmark==0.7.1
2 changes: 1 addition & 1 deletion docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Use cookiecutter, pointing it at the cookiecutter-pypackage repo:

.. code-block:: bash
$ cookiecutter gh:fedejaure/cookiecutter-modern-pypackage --checkout v2.0.0
$ cookiecutter gh:fedejaure/cookiecutter-modern-pypackage --checkout v2.0.1
You'll be asked to enter a bunch of values to set the package up.
If you don't know what to enter, stick with the defaults.
Expand Down
151 changes: 84 additions & 67 deletions poetry.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cookiecutter-modern-pypackage"
version = "2.0.0"
version = "2.0.1"
description = "Cookiecutter template for a modern Python package."
authors = ["Federico Jaureguialzo <[email protected]>"]
license = "MIT"
Expand Down Expand Up @@ -33,7 +33,7 @@ python = "<3.10,>=3.7"

[tool.poetry.dev-dependencies]
pre-commit = "^2.13.0"
invoke = "^1.5.0"
invoke = "^1.6.0"
flake8 = "^3.9.2"
flakehell = "^0.9.0"
flake8-builtins = "^1.5.3"
Expand All @@ -44,18 +44,18 @@ flake8-annotations = "^2.6.2"
flake8-docstrings = "^1.6.0"
flake8-bandit = "^2.1.2"
darglint = "^1.8.0"
isort = "^5.8.0"
black = "^21.5b2"
isort = "^5.9.2"
black = "^21.7b0"
safety = "^1.10.3"
mypy = "^0.902"
sphinx = "^4.0.2"
mypy = "^0.910"
sphinx = "^4.1.1"
recommonmark = "^0.7.1"
bump2version = "^1.0.1"
pytest = "^6.2.4"
xdoctest = "^0.15.4"
xdoctest = "^0.15.5"
cookiecutter = "^1.7.3"
pytest-cookies = "^0.6.1"
watchdog = {version = "^2.1.2", extras = ["watchmedo"]}
watchdog = {version = "^2.1.3", extras = ["watchmedo"]}

[tool.flakehell]
format = "grouped"
Expand Down
28 changes: 13 additions & 15 deletions tests/test_bake_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
COOKIE_CONTEXT_CLI = {"command_line_interface": "Click"}
COOKIE_CONTEXT_BSD = {"open_source_license": "BSD"}
COOKIE_CONTEXT_NO_CLI = {"command_line_interface": "No command-line interface"}
COOKIE_CONTEXT_DIFF_NAME_AND_SLUG = {
"project_name": "some-project-name",
"project_slug": "some_project",
}


@contextmanager
Expand Down Expand Up @@ -111,6 +115,11 @@ def _test_bake_and_run_invoke_tasks(
assert result.exit_code == 0
assert result.exception is None

assert run_inside_dir("git init", str(result.project_path)) == 0
assert run_inside_dir("git add .", str(result.project_path)) == 0
assert run_inside_dir('git config user.email "[email protected]"', str(result.project_path)) == 0
assert run_inside_dir('git config user.name "Test User"', str(result.project_path)) == 0
assert run_inside_dir("git commit -m 'initial commit'", str(result.project_path)) == 0
assert run_inside_dir("poetry install", str(result.project_path)) == 0
for task in inv_tasks:
assert run_inside_dir(f"poetry run inv {task}", str(result.project_path)) == 0
Expand All @@ -123,31 +132,20 @@ def _test_bake_and_run_invoke_tasks(
COOKIE_CONTEXT_NOT_OPEN_SOURCE,
{**COOKIE_CONTEXT_NOT_OPEN_SOURCE, **COOKIE_CONTEXT_NO_CLI},
{**COOKIE_CONTEXT_CLI, **COOKIE_CONTEXT_BSD},
COOKIE_CONTEXT_DIFF_NAME_AND_SLUG,
],
)
def test_bake_and_run_invoke(cookies: Cookies, extra_context: Dict[str, str]) -> None:
"""Test bake the project and check invoke tasks."""
invoke_tasks = [
"install-hooks",
"hooks",
"clean",
"lint",
"mypy",
"tests",
"coverage",
"version -d minor",
"docs",
]
_test_bake_and_run_invoke_tasks(cookies, extra_context, invoke_tasks)


@skip_on_windows
@pytest.mark.parametrize(
"extra_context",
[
{},
COOKIE_CONTEXT_NOT_OPEN_SOURCE,
{**COOKIE_CONTEXT_NOT_OPEN_SOURCE, **COOKIE_CONTEXT_NO_CLI},
{**COOKIE_CONTEXT_CLI, **COOKIE_CONTEXT_BSD},
],
)
def test_bake_and_build_docs(cookies: Cookies, extra_context: Dict[str, str]) -> None:
"""Test bake the project and check invoke docs task."""
_test_bake_and_run_invoke_tasks(cookies, extra_context, ["docs"])
12 changes: 7 additions & 5 deletions {{cookiecutter.project_name}}/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% raw %}name: release
{% set is_open_source = cookiecutter.open_source_license != 'Not open source' %}
name: release

on:
push:
Expand All @@ -25,20 +26,21 @@ jobs:
- name: Build package
run: |
poetry build --ansi
{% if is_open_source %}{% raw %}
- name: Publish package on PyPI
uses: pypa/[email protected].1
uses: pypa/[email protected].2
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

- name: Publish package on TestPyPI
uses: pypa/[email protected].1
uses: pypa/[email protected].2
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/

{% endraw %}{% endif %}
{% raw %}
github_release:
needs: release
name: Create Github Release
Expand Down
6 changes: 3 additions & 3 deletions {{cookiecutter.project_name}}/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
run: nox --force-color -s safety

- name: Upload coverage data
uses: actions/[email protected].0
uses: actions/[email protected].4
with:
name: coverage-data
path: ".coverage.*"
Expand All @@ -85,7 +85,7 @@ jobs:
poetry config virtualenvs.in-project true
- name: Download coverage data
uses: actions/[email protected].5
uses: actions/[email protected].10
with:
name: coverage-data

Expand All @@ -95,6 +95,6 @@ jobs:
nox --force-color --session=coverage -- --fmt xml
- name: Upload coverage report
uses: codecov/codecov-action@v1.3.1
uses: codecov/codecov-action@v2.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}{% endraw %}
4 changes: 2 additions & 2 deletions {{cookiecutter.project_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ repos:
- id: check-json
- id: end-of-file-fixer
- repo: https://github.com/timothycrosley/isort
rev: 5.8.0
rev: 5.9.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 21.5b2
rev: 21.7b0
hooks:
- id: black
- repo: local
Expand Down
3 changes: 1 addition & 2 deletions {{cookiecutter.project_name}}/LICENSE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,4 @@ may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

{% endif %}
{% endif %}
4 changes: 1 addition & 3 deletions {{cookiecutter.project_name}}/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

{% if cookiecutter.open_source_license != 'Not open source' %}
.. toctree::
:hidden:

License <license>

{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx==4.0.2
sphinx==4.1.1
recommonmark==0.7.1
20 changes: 12 additions & 8 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ classifiers=[
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]

{% if cookiecutter.project_name.lower().replace('-', '_') != cookiecutter.project_slug %}
packages = [
{ include = "{{ cookiecutter.project_slug }}", from = "src" },
]
{% endif %}

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_name }}/issues"
Expand All @@ -49,7 +53,7 @@ click = "^8.0.1"

[tool.poetry.dev-dependencies]
pre-commit = "^2.13.0"
invoke = "^1.5.0"
invoke = "^1.6.0"
flake8 = "^3.9.2"
flakehell = "^0.9.0"
flake8-builtins = "^1.5.3"
Expand All @@ -60,18 +64,18 @@ flake8-annotations = "^2.6.2"
flake8-docstrings = "^1.6.0"
flake8-bandit = "^2.1.2"
darglint = "^1.8.0"
isort = "^5.8.0"
black = "^21.5b2"
isort = "^5.9.2"
black = "^21.7b0"
safety = "^1.10.3"
mypy = "^0.902"
sphinx = "^4.0.2"
mypy = "^0.910"
sphinx = "^4.1.1"
recommonmark = "^0.7.1"
bump2version = "^1.0.1"
pytest = "^6.2.4"
xdoctest = "^0.15.4"
xdoctest = "^0.15.5"
coverage = {version = "^5.3", extras = ["toml"]}
pytest-cov = "^2.10.1"
watchdog = {version = "^2.1.2", extras = ["watchmedo"]}
watchdog = {version = "^2.1.3", extras = ["watchmedo"]}

[tool.coverage.paths]
source = ["src", "*/site-packages"]
Expand Down

0 comments on commit 124525b

Please sign in to comment.