Skip to content

Commit

Permalink
Rebuild Tox configuration, add requirements README, add RTD build (ja…
Browse files Browse the repository at this point in the history
…mescooke#205)

* Unpin upper Python bound

* Add RTD yaml for build, split out docs requirements

* Prevent clean recipe from syncing packages

* Partial refactor of tox.ini config

* Build out py3*-lint_self environment

* Rebuild tox with lint, test and meta environments

* Add requirements README, pin down text reqs

* Bump example requirements, fix tox allowlist

* Fix lint: blacken good black example

* Remove old base requirements

* Clean up requirements dir: README and requirements

* Clean up Makefile: remove old recipes

* Fix local devpypi cache link in test requirements

* Update Changelog
  • Loading branch information
jamescooke authored Feb 26, 2023
1 parent 8447dae commit 8d05b9f
Show file tree
Hide file tree
Showing 20 changed files with 520 additions and 315 deletions.
17 changes: 17 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

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

# Build all formats like pdf, htmlzip, etc
formats: all

python:
install:
- requirements: requirements/docs.txt
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ Added
* 🎈 Support for Python 3.11 `Pull #203
<https://github.com/jamescooke/flake8-aaa/pull/203>`_

* ⛏️ Read the docs build added with supporting docs requirements. `Pull #205
<https://github.com/jamescooke/flake8-aaa/pull/205>`_.

Changed
.......

* ⛏️ Tox configuration rebuilt with lint, test and meta labels. `Pull #205
<https://github.com/jamescooke/flake8-aaa/pull/205>`_.

* ⛏ Requirements cleaned: base requirements removed, specific versions
indicated where builds are required on particular Python versions, README
added. `Pull #205 <https://github.com/jamescooke/flake8-aaa/pull/205>`_.

0.13.0_ - 2023/02/17
--------------------

Expand Down
42 changes: 15 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ rst_files=README.rst CHANGELOG.rst
good_examples = $(wildcard examples/good/*.py examples/good/black/*.py) examples/good/noqa/test_cmd.py
bad_examples = $(wildcard examples/good/noqa/test_0*.py examples/good/black/noqa/test_0*.py examples/bad/*.py)


# Local dev: Install requirements
.PHONY: dev
dev:
pip-sync requirements/base.txt requirements/test.txt requirements/dev.txt

# Local dev: Run all tests for available Python versions
.PHONY: test
test:
tox --skip-missing-interpreters true

# --- Tox recipes ---

.PHONY: lint
Expand All @@ -35,13 +24,6 @@ lint:
@echo "=== setup.py ==="
python setup.py check --metadata --strict

.PHONY: fixlint
fixlint:
@echo "=== fixing isort ==="
isort --quiet --recursive $(lint_files)
@echo "=== fixing yapf ==="
yapf --recursive --in-place $(lint_files)

.PHONY: lintexamples
lintexamples:
@echo "=== flake8 ==="
Expand All @@ -60,13 +42,8 @@ lintexamplespy38:
@echo "=== mypy ==="
mypy examples/good_py38

.PHONY: fixlintexamples
fixlintexamples:
@echo "=== black ==="
black examples/good/black

.PHONY: doc
doc:
.PHONY: docs
docs:
$(MAKE) -C docs html

.PHONY: cmd
Expand All @@ -87,11 +64,10 @@ cmdbad:
echo; \
done


# --- Local dev: Building / Publishing ---

.PHONY: clean
clean: dev
clean:
rm -rf dist build .tox .pytest_cache src/flake8_aaa.egg-info
find . -name '*.pyc' -delete

Expand Down Expand Up @@ -120,6 +96,18 @@ on_master:
tag: on_master
git tag -a $$(python -c 'from src.flake8_aaa.__about__ import __version__; print("v{}".format(__version__))')

.PHONY: fixlint
fixlint:
@echo "=== fixing isort ==="
isort --quiet --recursive $(lint_files)
@echo "=== fixing yapf ==="
yapf --recursive --in-place $(lint_files)

.PHONY: fixlintexamples
fixlintexamples:
@echo "=== black ==="
black examples/good/black

.PHONY: black_examples
black_examples:
$(MAKE) -C examples clean all
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
2 changes: 1 addition & 1 deletion examples/good/black/test_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_in_arrange():
# Let's make a 3, 4, 5 triangle
y = 4

result = x ** 2 + y ** 2
result = x**2 + y**2

assert result == 25

Expand Down
3 changes: 1 addition & 2 deletions requirements/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ all: $(outputs)
pip-compile --verbose --output-file $@ $<

# Dependency chain
test.txt: base.txt
dev.txt: test.txt
dev.txt: ci.txt
47 changes: 47 additions & 0 deletions requirements/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Requirements management
=======================

Summary
-------

* ``ci.in|txt``: Requirements for GitHub Actions built with Python 3.10.

* ``dev.in|txt``: Requirements for working on code. Build with Python 3.8
(can't build on 3.7)

* Tox environments use ``lint.in|txt``, ``test.in|txt`` and
``examples.in|txt``, all built with Python 3.7.

* ``docs.in|txt``: Python 3.10 (match RTD)

CI ``ci.txt`` py310
-------------------

Used by GitHub Actions. Installs tox and GH helper to manage Python versions.

# Requirements for CI
# Currently GitHub actions on their Ubuntu 22.04 images
# These have Python 3.10.6 installed so compile these requirements with py310
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md

Targets Python 3.10 because GHA instance uses that version in ``ubuntu-22.04``
image.

Am using a pinned Tox dependency to allow for tags to be built "in the past" in
scenarios where they might have missed a build / were forgotten. E.g. `tag
v0.12.2 <https://github.com/jamescooke/flake8-aaa/releases/tag/v0.12.2>`_ was
added more than a year after the release was done, but by that point couldn't
be built by latest Tox, so `commit 77e29
<https://github.com/jamescooke/flake8-aaa/commit/77e29b1bbfaebed1664bcbc4bb77580185f00ae8>`_
now shows red 😞.

Development ``dev.txt`` py38
----------------------------

Targets Python 3.8 because it's the oldest version that is easy to build these
requirements for (Python 3.7 fails to build this list with no constraints).

All tools for local development. Tests are run in Tox, so no Pytest. But
linters are run in editor, so those are installed.

Twine available for shipping packages
2 changes: 0 additions & 2 deletions requirements/base.in

This file was deleted.

18 changes: 0 additions & 18 deletions requirements/base.txt

This file was deleted.

5 changes: 1 addition & 4 deletions requirements/ci.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# py310
# Requirements for CI
# Currently GitHub actions on their Ubuntu 22.04 images
# These have Python 3.10.6 installed so compile these requirements with py310
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md

tox
tox-gh-actions
13 changes: 11 additions & 2 deletions requirements/dev.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
-c base.txt
-c test.txt
# py38
# Requirements for local development in editor / outside tox
# Can't be built by py37, target py38 for development. #198

# Constrain with CI requirements so Tox versions match
-c ci.txt

flake8
mypy
pip-tools
pytest
tox
yapf
twine
Loading

0 comments on commit 8d05b9f

Please sign in to comment.