Skip to content

Commit

Permalink
fix project tooling (#31)
Browse files Browse the repository at this point in the history
adopt as much of `pyproject.toml` as possible
  • Loading branch information
svenevs committed Aug 22, 2021
1 parent ea12b68 commit 6584edf
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 166 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/dist.yml
@@ -0,0 +1,28 @@
name: Dist
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
pip install -U pip
pip install tox
- name: Build Distribution
run: |
tox -e dist
20 changes: 0 additions & 20 deletions README.rst
Expand Up @@ -34,15 +34,9 @@ ci_exec

.. end_badges
.. begin_brief_desc
A wrapper package designed for running continuous integration (CI) build steps using
Python 3.6+.

.. end_brief_desc
.. begin_long_desc
Managing cross platform build scripts for CI can become tedious at times when you need
to e.g., maintain two nearly identical scripts ``install_deps.sh`` and
``install_deps.bat`` due to incompatible syntaxes. ``ci_exec`` enables a single file
Expand Down Expand Up @@ -77,20 +71,9 @@ specifically for running build steps on CI providers. It is
cmake("..", "-G", "Ninja", "-DCMAKE_BUILD_TYPE=Release")
ninja("-j", "2", "test")
.. end_long_desc
.. begin_final_desc
Please refer to the `full documentation <https://ci-exec.readthedocs.io/en/latest/>`_
for more information.

.. end_final_desc
Installation
========================================================================================

.. begin_install
``ci_exec`` is `available on PyPI <https://pypi.org/project/ci-exec/>`_. It can be
installed using your python package manager of choice:

Expand All @@ -108,10 +91,7 @@ There is also a ``setup.py`` here, so you can also install it from source:
$ pip install git+https://github.com/svenevs/ci_exec.git@master
.. end_install
License
========================================================================================

This software is licensed under the Apache 2.0 license.

2 changes: 1 addition & 1 deletion ci_exec/__init__.py
Expand Up @@ -29,7 +29,7 @@
from .provider import Provider
from .utils import cd, merge_kwargs, set_env, unset_env

__version__ = "0.1.2.dev"
__version__ = "0.1.2.dev.1"
__all__ = [
# Core imports from ci_exec.colorize module.
"Ansi", "Colors", "Styles", "colorize", "log_stage",
Expand Down
15 changes: 1 addition & 14 deletions docs/source/index.rst
Expand Up @@ -2,26 +2,13 @@ ci_exec
========================================================================================

.. contents::
:local:
:backlinks: none

About
----------------------------------------------------------------------------------------

.. include:: ../../README.rst
:start-after: begin_brief_desc
:end-before: end_brief_desc

.. include:: ../../README.rst
:start-after: begin_long_desc
:end-before: end_long_desc

Installation
----------------------------------------------------------------------------------------

.. include:: ../../README.rst
:start-after: begin_install
:end-before: end_install
:start-after: end_badges

Intended Audience
----------------------------------------------------------------------------------------
Expand Down
27 changes: 27 additions & 0 deletions pyproject.toml
@@ -0,0 +1,27 @@
[build-system]
requires = ["setuptools >= 40.6.0", "wheel"]
build-backend = "setuptools.build_meta"

################################################################################
[tool.coverage.run]
data_file = ".coverage"
include = [
"ci_exec/**",
"tests/**",
"demos/**"]

################################################################################
[[tool.mypy.overrides]]
module = [
"pytest",
"pygments",
"setuptools"]

################################################################################
[tool.pytest.ini_options]
cache_dir = "tests/.cache"
norecursedirs = [
".git/",
"docs/",
"ci_exec/"]
python_files = ["tests/**.py"]
79 changes: 40 additions & 39 deletions setup.cfg
@@ -1,45 +1,46 @@
[flake8]
max-line-length = 88
exclude =
.git
.eggs
.tox
ignore =
# Missing blank line after last section (waste of space...)
D413,
# I document the class, not __init__
D107,
# Lining up operators is less important than making it easy for users to understand.
W504

[tool:pytest]
cache_dir = tests/.cache
norecursedirs =
.git/
docs/
ci_exec/
python_files =
tests/**.py
[metadata]
name = ci_exec
version = attr: ci_exec.__version__
python_requires = >=3.6
license = Apache v2.0
author = Stephen McDowell
author_email = svenevs.pypi@gmail.com

[coverage:run]
data_file = .coverage
include =
ci_exec/**
tests/**
demos/**
description =
A wrapper package designed for running continuous integration (CI) build steps using
Python 3.6+.
long_description = file: README.rst
long_description_content_type = text/x-rst

[mypy-setuptools]
ignore_missing_imports = true
url = https://github.com/svenevs/ci_exec
project_urls =
Documentation = https://ci-exec.readthedocs.io/en/latest/
Source = https://github.com/svenevs/ci_exec
Tracker = https://github.com/svenevs/ci_exec/issues
classifiers =
Development Status :: 3 - Alpha
Intended Audience :: Developers
Topic :: Software Development :: Build Tools
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

[mypy-pytest]
ignore_missing_imports = true

[mypy-pygments]
ignore_missing_imports = true
[options]
zip_safe = False
include_package_data = True
packages = find:

[mypy-youtube]
ignore_missing_imports = true
[options.package_data]
ci_exec = py.typed

# NOTE: see docs/requirements.txt, this will not be needed in future.
[mypy-sphinx.ext.autodoc]
ignore_missing_imports = true
[options.packages.find]
exclude =
demos
demos.*
docs
docs.*
tests
tests.*
95 changes: 4 additions & 91 deletions setup.py
@@ -1,93 +1,6 @@
# noqa: D100
import os
import sys
#!/usr/bin/env python

from setuptools import find_packages, setup
import setuptools


if sys.version_info < (3, 6):
raise RuntimeError("ci_exec needs Python 3.6+")

sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import ci_exec # noqa: E402, I100

# Extract the descriptions from README.rst.
try:
in_brief = False
brief = ""
in_long = False
in_final = False
long = ""
with open("README.rst") as readme:
for line in readme:
if line.startswith(".. begin_brief_desc"):
in_brief = True
continue
elif line.startswith(".. end_brief_desc"):
in_brief = False
continue
elif line.startswith(".. begin_long_desc"):
in_long = True
continue
elif line.startswith(".. end_long_desc"):
in_long = False
continue
elif line.startswith(".. begin_final_desc"):
in_final = True
continue
elif line.startswith(".. end_final_desc"):
in_final = False
continue

if in_brief:
brief += line.replace("\n", " ") # so it is all on one line.
elif in_long:
long += line
elif in_final:
long += line

if not brief:
raise RuntimeError("Internal error: could not extract brief description.")
if not long:
raise RuntimeError("Internal error: could not extract long description.")
except Exception as e:
raise RuntimeError(f"CRITICAL: {e}")

brief_description = brief.rstrip()
long_description = long.rstrip()

setup(
name="ci_exec",
version=ci_exec.__version__,
requires_python=">=3.6",
author="Stephen McDowell",
author_email="svenevs.pypi@gmail.com",
license="Apache v2.0",
description=brief_description,
long_description=long_description,
long_description_content_type="text/x-rst",
project_urls={
"Documentation": "https://ci-exec.readthedocs.io/en/latest/",
"Source": "https://github.com/svenevs/ci_exec"
},
url="https://github.com/svenevs/ci_exec",
packages=find_packages(exclude=[
"demos", "demos.*",
"docs", "docs.*",
"tests", "tests.*",
]),
package_data={"ci_exec": ["py.typed"]},
include_package_data=True,
zip_safe=False,
python_requires=">=3.6",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9"
]
)
if __name__ == "__main__":
setuptools.setup()
19 changes: 18 additions & 1 deletion tox.ini
Expand Up @@ -2,6 +2,23 @@
# Default environments to run with vanilla `tox`
envlist = py, lint

# See: https://flake8.pycqa.org/en/latest/user/configuration.html#project-configuration
# and: https://github.com/PyCQA/flake8/issues/234
# TL;DR: keep in tox.ini until ?
[flake8]
max-line-length = 88
exclude =
.git
.eggs
.tox
ignore =
# Missing blank line after last section (waste of space...)
D413,
# I document the class, not __init__
D107,
# Lining up operators is less important than making it easy for users to understand.
W504

[testenv]
# Required to be able to send coverage reports from Travis to codecov
passenv = PYTHONWARNINGS TOXENV CI TRAVIS TRAVIS_*
Expand Down Expand Up @@ -68,7 +85,7 @@ setenv =
CI_EXEC_DEMOS_COVERAGE = YES
skip_install = true
deps =
coverage
coverage[toml]
commands =
# Intended use case of this in CI is to do multiple passes, e.g.:
#
Expand Down

0 comments on commit 6584edf

Please sign in to comment.