From 49d00adcd16996efea9f29d0204093b7be1569c7 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Sat, 22 Feb 2025 15:40:25 -0500 Subject: [PATCH 1/2] chore(dev): replace gitpod with devcontainer As gitpod's moved to no longer be cloud-based, and supports using the devcontainer standard, use that instead to support GitHub Codespaces. Signed-off-by: Mike Fiedler --- .devcontainer/Dockerfile | 8 +++++ .devcontainer/devcontainer.json | 30 +++++++++++++++++++ .devcontainer/post-create.sh | 9 ++++++ .github/CONTRIBUTING.md | 52 +++++++++++++++++++++++++++++++++ .gitignore | 1 + .gitpod.yml | 29 ------------------ README.rst | 7 +++++ pyproject.toml | 4 +++ 8 files changed, 111 insertions(+), 29 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/post-create.sh create mode 100644 .github/CONTRIBUTING.md delete mode 100644 .gitpod.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..2f28e8d --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:noble +ARG PYTHON_PACKAGES="python3.13 python3.12 python3.11 python3.10 python3.9 python3.9-distutils python3 python3-pip python3-venv pipx" +RUN apt-get update \ + && apt-get install --no-install-recommends -yq software-properties-common git \ + && add-apt-repository ppa:deadsnakes/ppa && apt-get update \ + && apt-get install -yq --no-install-recommends ${PYTHON_PACKAGES} \ + && pipx ensurepath \ + && pipx install tox diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..3d2e58d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Python 3", + "build": { + "dockerfile": "Dockerfile" + }, + // "features": { + // // Rust is necessary for the `nh3` package if wheels are unavailable. + // // The current Python versions tested have wheels, so this is commented out. + // "ghcr.io/devcontainers/features/rust:1": {} + // }, + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "bash .devcontainer/post-create.sh", + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "EditorConfig.EditorConfig", + "ms-python.python", + "ms-python.mypy-type-checker", + "tamasfe.even-better-toml" + ] + }, + "settings": { + "python.defaultInterpreterPath": ".venv/bin/python", + "python.terminal.activateEnvInCurrentTerminal": true + } + } +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 0000000..4444276 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -e + +# `tox` testing manages its own environments +# Create virtualenv for local development, editor completion, etc. +python3 -m venv .venv +source .venv/bin/activate +pip install --upgrade pip +pip install -e .[md] diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..83a3d61 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,52 @@ +# Contributing + +The following is a set of guidelines for contributing to this project. +These are just guidelines, not rules. +Use your best judgment, and feel free to propose changes to this document in a pull request. + +## Development Setup + +### The Easy Way + +Use the supplied [Development Container](https://containers.dev/) configuration +to get a development environment up and running quickly. +The configurations can be found in the `.devcontainer` directory. + +[GitHub Codespaces](https://github.com/features/codespaces) can provide +a development environment in the cloud. +GitHub Codespaces also provides a prebuilt image for this repository +from the most recent commit on the `main` branch +to speed up the setup process, including many of the Python runtimes +and tools needed to run the tests. + +Other tools like Visual Studio Code may use the devcontainer configuration +to provide a consistent development environment locally, +if you have a compatible version of a container runtime. + +### The Less-Easy Way + +1. Fork the repository and clone it to your local machine. +1. Install any Python runtimes you wish to test against. +1. Install the `tox` test runner + +Note: You may need other development tools depending on the environment you are working in. + +## Running Tests + +Once started up, in a shell, run `tox -l` to see the available test environments. +To run the tests, use `tox -e ` +where `` is one of the environments listed by `tox -l`. + +Alternatively, you can run `tox` without any arguments to run all the tests. + +### Parallel Testing + +To run all Python tests in parallel on all available CPUs: + + tox -p auto + +Read more about [parallel mode](https://tox.wiki/en/latest/user_guide.html#parallel-mode). + +## Testing Guidelines + +TODO: Explain test fixtures and how to create/update them. diff --git a/.gitignore b/.gitignore index 962e2f9..fb6eab4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ dist/ htmlcov/ .tox/ +.venv/ .cache/ .coverage *.egg-info/ diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index d11f037..0000000 --- a/.gitpod.yml +++ /dev/null @@ -1,29 +0,0 @@ -# See https://www.gitpod.io/docs/references/gitpod-yml for full reference - -tasks: - - name: Setup Development and run Tests - - init: | - # Upgrade pyenv itself - pyenv update - - export PY_VERSIONS="3.9 3.10 3.11 3.12 3.13" - - # Install all supported Python versions - for py in $PY_VERSIONS; - do pyenv install "$py":latest --skip-existing ; - done - - # Make versions available via $PATH, exclude GitPod default - pyenv global $(pyenv versions --bare | grep -v 3.8.13) - - # Install `tox` test orchestrator - pip install tox - - command: tox - -vscode: - extensions: - - ms-python.python - - EditorConfig.EditorConfig - - tamasfe.even-better-toml diff --git a/README.rst b/README.rst index 2cf806c..222d773 100644 --- a/README.rst +++ b/README.rst @@ -29,8 +29,15 @@ Everyone interacting in the readme_renderer project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_. +Contributing +------------ +Contributions are welcome, and they are greatly appreciated! +Every little bit helps. See `CONTRIBUTING.md`_ file for more information. + + .. |twine check| replace:: ``twine check`` .. _twine check: https://packaging.python.org/guides/making-a-pypi-friendly-readme#validating-restructuredtext-markup .. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md +.. _CONTRIBUTING.md: https://github.com/pypa/readme_renderer/blob/main/.github/CONTRIBUTING.md Copyright © 2014, [The Python Packaging Authority]. diff --git a/pyproject.toml b/pyproject.toml index e83c362..e23b8c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,10 @@ Home-page = "https://github.com/pypa/readme_renderer" requires = ["setuptools>=40.8.0"] build-backend = "setuptools.build_meta" +[tool.check-manifest] +ignore = [ + ".devcontainer/*", +] [tool.coverage.run] branch = true From b8fb050f21cfad96c8de790a7402c675e5a769d4 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Sun, 13 Jul 2025 16:52:03 -0400 Subject: [PATCH 2/2] wip Signed-off-by: Mike Fiedler --- .devcontainer/pyenv.Dockerfile | 29 +++++++++++++++++++++++++++++ tox.ini | 5 ++--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/pyenv.Dockerfile diff --git a/.devcontainer/pyenv.Dockerfile b/.devcontainer/pyenv.Dockerfile new file mode 100644 index 0000000..8176e97 --- /dev/null +++ b/.devcontainer/pyenv.Dockerfile @@ -0,0 +1,29 @@ +ARG VARIANT=3.13 +ARG PYTHON_VERSIONS="3.9 3.10 3.11 3.12 3.13" +FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT} + +# Install tox +RUN pipx install tox + +# Install pyenv +USER vscode +WORKDIR /home/vscode + +RUN curl -fsSL https://pyenv.run | bash +ENV PYENV_ROOT="/home/vscode/.pyenv" +ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" + +RUN pyenv install 3.9 3.10 3.11 3.12 3.13 +RUN pyenv local "${PYTHON_VERSIONS}" +RUN pyenv global ${VARIANT} + +# Modify dotfile +RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc +RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc +RUN echo 'export PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc +RUN echo 'export PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc +RUN echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc +RUN echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc + +# Restore root user +USER root diff --git a/tox.ini b/tox.ini index 717538a..4b52746 100644 --- a/tox.ini +++ b/tox.ini @@ -6,11 +6,10 @@ envlist = packaging noextra mypy -isolated_build = True [testenv] package = wheel -wheel_build_env = build_wheel +; wheel_build_env = build_wheel deps = pytest pytest-cov @@ -45,7 +44,7 @@ deps = build twine commands = - check-manifest + ; check-manifest python -m build python -m twine check dist/*