Skip to content

Commit

Permalink
Replace flake8-alphabetize with ruff, update deps (#47)
Browse files Browse the repository at this point in the history
### What kind of change does this PR introduce?

* Updates dependency versions for the repo and template
* Replaces `flak8-alphabetize` with `ruff`-based checks
* Removed the second `CODE_OF_CONDUCT.md` that was mistakenly committed
at some point

### Does this PR introduce a breaking change?

Yes. The linting from `ruff` is stricter to deal with potential coding
errors.

### Other information:

https://docs.astral.sh/ruff/rules/unsorted-dunder-all/
  • Loading branch information
Zeitsperre authored Jun 14, 2024
2 parents 57b5612 + aa14984 commit f0aab65
Show file tree
Hide file tree
Showing 26 changed files with 154 additions and 235 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ updates:
open-pull-requests-limit: 5

- package-ecosystem: github-actions
directory: "/{{ COOKIECUTTER_PROJECT_SLUG }}/.github/workflows/"
directory: "/\{\{cookiecutter.project_slug\}\}/.github/workflows/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
- tox-env: pypy310
python-version: "pypy3.10"
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- name: Cancel previous runs
uses: styfle/[email protected]
with:
Expand Down
53 changes: 29 additions & 24 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,40 @@
"add_pyup_badge": "n",
"make_docs": "y",
"add_translations": "y",
"command_line_interface": ["Typer", "Click", "Argparse", "No command-line interface"],
"command_line_interface": [
"Typer",
"Click",
"Argparse",
"No command-line interface"
],
"create_author_file": "y",
"open_source_license": [
"MIT license",
"BSD license",
"ISC license",
"Apache Software License 2.0",
"GNU General Public License v3",
"Not open source"
"MIT license",
"BSD license",
"ISC license",
"Apache Software License 2.0",
"GNU General Public License v3",
"Not open source"
],
"generated_with_cruft": "y",
"__gh_slug": "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_name.replace(' ', '-') }}",
"__prompts__": {
"full_name": "Your full name",
"email": "Your email address",
"github_username": "Your GitHub username (or organization)",
"project_name": "The name of your project",
"project_short_description": "A short description of your project",
"pypi_username": "Your PyPI username (or organization)",
"version": "The version of your project",
"use_pytest": "Do you want to use pytest?",
"use_black": "Do you want to use Black for code formatting?",
"use_conda": "Do you want to add configurations for Anaconda package management?",
"add_pyup_badge": "Do you want to add a pyup.io badge? (not recommended)",
"make_docs": "Do you want to generate documentation files",
"add_translations": "Do you want to add translations?",
"command_line_interface": "Which command-line interface do you want to use?",
"create_author_file": "Do you want to create an AUTHORS.rst file?",
"open_source_license": "Which open-source license do you want to use?",
"generated_with_cruft": "Was this project generated with Cruft? (Add a '.cruft.json' file)"
"full_name": "Your full name",
"email": "Your email address",
"github_username": "Your GitHub username (or organization)",
"project_name": "The name of your project",
"project_short_description": "A short description of your project",
"pypi_username": "Your PyPI username (or organization)",
"version": "The version of your project",
"use_pytest": "Do you want to use pytest?",
"use_black": "Do you want to use Black for code formatting?",
"use_conda": "Do you want to add configurations for Anaconda package management?",
"add_pyup_badge": "Do you want to add a pyup.io badge? (not recommended)",
"make_docs": "Do you want to generate documentation files",
"add_translations": "Do you want to add translations?",
"command_line_interface": "Which command-line interface do you want to use?",
"create_author_file": "Do you want to create an AUTHORS.rst file?",
"open_source_license": "Which open-source license do you want to use?",
"generated_with_cruft": "Was this project generated with Cruft? (Add a '.cruft.json' file)"
}
}
2 changes: 0 additions & 2 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ This will:
* Encrypt your PyPI password in your Travis config.
* Activate automated deployment on PyPI when you push a new tag to master branch.

See :ref:`travis-pypi-setup` for more information.

.. _`Travis CI com`: https://travis-ci.com/


Expand Down
133 changes: 0 additions & 133 deletions python_boilerplate/CODE_OF_CONDUCT.md

This file was deleted.

4 changes: 2 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
exclude = [
"*cookiecutter.project_slug*"
]
"*cookiecutter.project_slug*"
]
56 changes: 31 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
# !/usr/bin/env python

from distutils.core import setup


setup(
name='cookiecutter-pypackage',
name="cookiecutter-pypackage",
packages=[],
version='0.1.0',
description='Cookiecutter template for a Python package',
author='Audrey M. Roy Greenfeld',
license='BSD',
author_email='[email protected]',
url='https://github.com/audreyfeldroy/cookiecutter-pypackage',
keywords=['cookiecutter', 'template', 'package', ],
python_requires='>=3.8',
version="0.1.0",
description="Cookiecutter template for a Python package",
author="Audrey M. Roy Greenfeld",
license="BSD",
author_email="[email protected]",
url="https://github.com/audreyfeldroy/cookiecutter-pypackage",
keywords=[
"cookiecutter",
"template",
"package",
],
python_requires=">=3.8",
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'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',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development',
"Development Status :: 4 - Beta",
"Environment :: Console",
"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",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development",
],
)
9 changes: 6 additions & 3 deletions tests/test_bake_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def test_bake_with_defaults(cookies):
assert "environment-dev.yml" in found_toplevel_files
assert "pyproject.toml" in found_toplevel_files
assert "src" in found_toplevel_files
assert "python_boilerplate" in next(result.project_path.joinpath("src").iterdir()).name
assert (
"python_boilerplate"
in next(result.project_path.joinpath("src").iterdir()).name
)
assert "tests" in found_toplevel_files
assert "tox.ini" in found_toplevel_files

Expand Down Expand Up @@ -301,7 +304,7 @@ def test_bake_with_no_console_script(cookies):
assert "cli.py" not in found_project_files

pyproject_path = os.path.join(project_path, "pyproject.toml")
with open(pyproject_path, "r") as setup_file:
with open(pyproject_path) as setup_file:
assert "[project.scripts]" not in setup_file.read()


Expand All @@ -316,7 +319,7 @@ def test_bake_with_console_options_script_files(cookies, option):
assert "cli.py" in found_project_files

pyproject_path = os.path.join(project_path, "pyproject.toml")
with open(pyproject_path, "r") as setup_file:
with open(pyproject_path) as setup_file:
assert "[project.scripts]" in setup_file.read()


Expand Down
3 changes: 0 additions & 3 deletions {{cookiecutter.project_slug}}/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ exclude =
docs,
tests
ignore =
AZ100,
AZ200,
AZ300,
C,
D,
E,
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
directory: /.github/workflows/
schedule:
interval: monthly
open-pull-requests-limit: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
contents: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
actions: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: block
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/.github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: block
Expand Down
Loading

0 comments on commit f0aab65

Please sign in to comment.