Skip to content

Commit

Permalink
Up.
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelmc committed Apr 23, 2023
1 parent d5d976b commit a4b3316
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 162 deletions.
12 changes: 1 addition & 11 deletions .cookiecutterrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

default_context:
allow_tests_inside_package: 'no'
appveyor: 'no'
c_extension_function: longest
c_extension_module: _nameless
c_extension_optional: 'yes'
c_extension_support: 'no'
c_extension_test_pypi: 'no'
c_extension_test_pypi_username: '-'
codacy: 'no'
codacy_projectid: '-'
codeclimate: 'yes'
Expand All @@ -18,16 +15,14 @@ default_context:
coveralls: 'yes'
distribution_name: nameless
email: [email protected]
formatter_quote_style: double
full_name: Ionel Cristian Mărieș
github_actions: 'yes'
github_actions_osx: 'yes'
github_actions_windows: 'yes'
legacy_python: 'no'
license: BSD 2-Clause License
linter: flake8
package_name: nameless
pre_commit: 'yes'
pre_commit_formatter: black
project_name: Nameless
project_short_description: An example package. Generated with cookiecutter-pylibrary.
pypi_badge: 'yes'
Expand All @@ -38,18 +33,13 @@ default_context:
repo_main_branch: main
repo_name: python-nameless
repo_username: ionelmc
requiresio: 'yes'
scrutinizer: 'yes'
setup_py_uses_pytest_runner: 'no'
setup_py_uses_setuptools_scm: 'no'
sphinx_docs: 'yes'
sphinx_docs_hosting: https://python-nameless.readthedocs.io/
sphinx_doctest: 'yes'
sphinx_theme: sphinx-rtd-theme
test_matrix_configurator: 'no'
test_matrix_separate_coverage: 'yes'
travis: 'no'
travis_osx: 'no'
version: 0.1.0
version_manager: bump2version
website: https://blog.ionelmc.ro
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
matrix:
include:
- name: 'check'
python: '3.9'
toxpython: 'python3.9'
python: '3.11'
toxpython: 'python3.11'
tox_env: 'check'
os: 'ubuntu-latest'
- name: 'docs'
python: '3.9'
toxpython: 'python3.9'
python: '3.11'
toxpython: 'python3.11'
tox_env: 'docs'
os: 'ubuntu-latest'
- name: 'py37-cover (ubuntu)'
Expand Down
32 changes: 15 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
# To install the git pre-commit hook run:
# pre-commit install
# To update the pre-commit hooks run:
# pre-commit install-hooks
# To install the git pre-commit hooks run:
# pre-commit install --install-hooks
# To update the versions:
# pre-commit autoupdate
exclude: '^(\.tox|ci/templates|\.bumpversion\.cfg)(/|$)'
# Note the order is intentional to avoid multiple passes of the hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: master
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- repo: https://github.com/timothycrosley/isort
rev: master
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.262
hooks:
- id: isort
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- repo: https://github.com/psf/black
rev: main
rev: 23.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: master
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: flake8
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Changelog
=========

0.1.0 (2022-11-10)
0.1.0 (2023-04-23)
------------------

* First release on PyPI.
4 changes: 1 addition & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To set up `python-nameless` for local development:

Now you can make your changes locally.

4. When you're done making changes run all the checks and docs builder with `tox <https://tox.readthedocs.io/en/latest/install.html>`_ one command::
4. When you're done making changes run all the checks and docs builder with `tox <https://tox.wiki/en/latest/install.html>`_ one command::

tox

Expand All @@ -73,8 +73,6 @@ For merging, you should:
3. Add a note to ``CHANGELOG.rst`` about the changes.
4. Add yourself to ``AUTHORS.rst``.



Tips
----

Expand Down
6 changes: 1 addition & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Overview
* - docs
- |docs|
* - tests
- | |github-actions| |requires|
- | |github-actions|
| |coveralls| |codecov|
| |scrutinizer| |codeclimate|
* - package
Expand All @@ -24,10 +24,6 @@ Overview
:alt: GitHub Actions Build Status
:target: https://github.com/ionelmc/python-nameless/actions

.. |requires| image:: https://requires.io/github/ionelmc/python-nameless/requirements.svg?branch=main
:alt: Requirements Status
:target: https://requires.io/github/ionelmc/python-nameless/requirements/?branch=main

.. |coveralls| image:: https://coveralls.io/repos/ionelmc/python-nameless/badge.svg?branch=main&service=github
:alt: Coverage Status
:target: https://coveralls.io/r/ionelmc/python-nameless
Expand Down
22 changes: 10 additions & 12 deletions ci/bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ruff: noqa: S
import os
import pathlib
import subprocess
Expand All @@ -23,7 +23,7 @@ def exec_in_env():
if not env_path.exists():
import subprocess

print("Making bootstrap env in: {0} ...".format(env_path))
print(f"Making bootstrap env in: {env_path} ...")
try:
check_call([sys.executable, "-m", "venv", env_path])
except subprocess.CalledProcessError:
Expand All @@ -35,43 +35,41 @@ def exec_in_env():
check_call([bin_path / "pip", "install", "jinja2", "tox"])
python_executable = bin_path / "python"
if not python_executable.exists():
python_executable = python_executable.with_suffix('.exe')
python_executable = python_executable.with_suffix(".exe")

print("Re-executing with: {0}".format(python_executable))
print(f"Re-executing with: {python_executable}")
print("+ exec", python_executable, __file__, "--no-env")
os.execv(python_executable, [python_executable, __file__, "--no-env"])


def main():
import jinja2

print("Project path: {0}".format(base_path))
print(f"Project path: {base_path}")

jinja = jinja2.Environment(
loader=jinja2.FileSystemLoader(str(templates_path)),
trim_blocks=True,
lstrip_blocks=True,
keep_trailing_newline=True,
)

tox_environments = [
line.strip()
# 'tox' need not be installed globally, but must be importable
# by the Python that is running this script.
# This uses sys.executable the same way that the call in
# cookiecutter-pylibrary/hooks/post_gen_project.py
# invokes this bootstrap.py itself.
for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], universal_newlines=True).splitlines()
for line in subprocess.check_output([sys.executable, "-m", "tox", "--listenvs"], universal_newlines=True).splitlines()
]
tox_environments = [line for line in tox_environments if line.startswith('py')]

for template in templates_path.rglob('*'):
tox_environments = [line for line in tox_environments if line.startswith("py")]
for template in templates_path.rglob("*"):
if template.is_file():
template_path = str(template.relative_to(templates_path))
destination = base_path / template_path
destination.parent.mkdir(parents=True, exist_ok=True)
destination.write_text(jinja.get_template(template_path).render(tox_environments=tox_environments))
print("Wrote {}".format(template_path))
print(f"Wrote {template_path}")
print("DONE.")


Expand All @@ -82,5 +80,5 @@ def main():
elif not args:
exec_in_env()
else:
print("Unexpected arguments {0}".format(args), file=sys.stderr)
print(f"Unexpected arguments: {args}", file=sys.stderr)
sys.exit(1)
8 changes: 4 additions & 4 deletions ci/templates/.github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
matrix:
include:
- name: 'check'
python: '3.9'
toxpython: 'python3.9'
python: '3.11'
toxpython: 'python3.11'
tox_env: 'check'
os: 'ubuntu-latest'
- name: 'docs'
python: '3.9'
toxpython: 'python3.9'
python: '3.11'
toxpython: 'python3.11'
tox_env: 'docs'
os: 'ubuntu-latest'
{% for env in tox_environments %}
Expand Down
55 changes: 26 additions & 29 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.extlinks",
"sphinx.ext.ifconfig",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
]
source_suffix = '.rst'
master_doc = 'index'
project = 'Nameless'
year = '2019-now'
author = 'Ionel Cristian Mărieș'
copyright = '{0}, {1}'.format(year, author)
version = release = '0.1.0'
source_suffix = ".rst"
master_doc = "index"
project = "Nameless"
year = "2019-now"
author = "Ionel Cristian Mărieș"
copyright = f"{year}, {author}"
version = release = "0.1.0"

pygments_style = 'trac'
templates_path = ['.']
pygments_style = "trac"
templates_path = ["."]
extlinks = {
'issue': ('https://github.com/ionelmc/python-nameless/issues/%s', '#'),
'pr': ('https://github.com/ionelmc/python-nameless/pull/%s', 'PR #'),
"issue": ("https://github.com/ionelmc/python-nameless/issues/%s", "#"),
"pr": ("https://github.com/ionelmc/python-nameless/pull/%s", "PR #"),
}
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

if not on_rtd: # only set the theme if we're building docs locally
html_theme = 'sphinx_rtd_theme'
if not on_rtd: # only set the theme if we are building docs locally
html_theme = "sphinx_rtd_theme"

html_use_smartypants = True
html_last_updated_fmt = '%b %d, %Y'
html_last_updated_fmt = "%b %d, %Y"
html_split_index = False
html_sidebars = {
'**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'],
"**": ["searchbox.html", "globaltoc.html", "sourcelink.html"],
}
html_short_title = '%s-%s' % (project, version)
html_short_title = f"{project}-{version}"

napoleon_use_ivar = True
napoleon_use_rtype = False
Expand Down
47 changes: 45 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,50 @@ requires = [
"wheel",
]

[tool.ruff.per-file-ignores]
"ci/*" = ["S"]

[tool.ruff]
extend-exclude = ["static", "ci/templates"]
ignore = [
"RUF001", # ruff-specific rules ambiguous-unicode-character-string
"S101", # flake8-bandit assert
"S308", # flake8-bandit suspicious-mark-safe-usage
"E501", # pycodestyle line-too-long
]
line-length = 140
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"E", # pycodestyle errors
"EXE", # flake8-executable
"F", # pyflakes
"I", # isort
"INT", # flake8-gettext
"PIE", # flake8-pie
"PLC", # pylint convention
"PLE", # pylint errors
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"Q", # flake8-quotes
"RSE", # flake8-raise
"RUF", # ruff-specific rules
"S", # flake8-bandit
"UP", # pyupgrade
"W", # pycodestyle warnings
]
src = ["src", "tests"]
target-version = "py310"

[tool.ruff.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false

[tool.ruff.isort]
forced-separate = ["conftest"]
force-single-line = true

[tool.black]
line-length = 140
target-version = ['py37']
skip-string-normalization = true
target-version = ["py310"]
11 changes: 0 additions & 11 deletions setup.cfg

This file was deleted.

Loading

0 comments on commit a4b3316

Please sign in to comment.