Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from setuppy to pyprojecttoml #214

Merged
merged 31 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
678d407
add devcontainer files
sjev May 5, 2024
8c9f84b
rename prompt
sjev May 5, 2024
a1b388a
rename setup
sjev May 5, 2024
98a65d9
add pyproject
sjev May 5, 2024
76bf98e
add build
sjev May 5, 2024
b6f049f
auto install dev reqs
sjev May 5, 2024
20c7d63
add devcontainer instructions
sjev May 5, 2024
6109b84
try to fix header
sjev May 5, 2024
4abf6d9
add note
sjev May 5, 2024
6e35e5b
remove header
sjev May 5, 2024
2a656a1
rewrite
sjev May 5, 2024
484f3fa
run pre-commit, add licenses
sjev May 5, 2024
4f5e987
remove setup.py
sjev May 5, 2024
435475b
pff.. rst is not md
sjev May 5, 2024
a3c162f
downgrade to 3.11
sjev May 6, 2024
55b687d
remove requirement files
sjev May 6, 2024
45f0804
move `build` dep to dev reqs
sjev May 6, 2024
2657494
change license
sjev May 6, 2024
c94b991
add dummy requirements.txt as workaround for keeping CI script working.
sjev May 6, 2024
41ed0d2
add dev requirements install (+ autoformat indent)
sjev May 6, 2024
7e31cb3
Revert "add dev requirements install (+ autoformat indent)"
sjev May 6, 2024
3a1f3b3
Revert "add dummy requirements.txt as workaround for keeping CI scrip…
sjev May 6, 2024
f3779b8
Revert "remove requirement files"
sjev May 6, 2024
4e4934f
move requirements to external txt files
sjev May 6, 2024
2899011
removed devcontainer
sjev May 31, 2024
ef128a6
remove devcontainer mention from contributing, change install dev req…
FoamyGuy Jun 1, 2024
c773c20
min version 3.9
FoamyGuy Jun 3, 2024
2abf755
change release action for pyproject.toml instead of setup.py
FoamyGuy Jun 3, 2024
23baaeb
configure auto version
FoamyGuy Jun 3, 2024
50561f5
fix release action condition
FoamyGuy Jun 3, 2024
524e552
fix release action
FoamyGuy Jun 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# SPDX-FileCopyrightText: 2024 Jev Kuznetsov, written for Adafruit Industries
sjev marked this conversation as resolved.
Show resolved Hide resolved
#
# SPDX-License-Identifier: MIT

# note: using 3.11 because pre-commit is not compatible with 3.12
FROM python:3.11-slim

ARG USERNAME=dev
ARG UID=1000
ARG GID=1000
ARG VERSION="circup-dev"

# Create the user
RUN groupadd --gid $GID $USERNAME \
&& useradd --uid $UID --gid $GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# dialout group
RUN usermod -a -G dialout $USERNAME

# install packages
RUN apt-get install -y \
locales \
tree \
git \
iputils-ping

# cleanup
RUN rm -rf /var/lib/apt/lists/*

# set locale
RUN export LC_ALL=en_US.UTF-8
RUN export LANG=en_US.UTF-8
RUN locale-gen en_US.UTF-8

RUN pip install --upgrade pip


USER ${USERNAME}
RUN echo 'export PS1="🐍 \[\033[1;36m\]'"${VERSION}"' \[\e[33m\]\W\[\e[m\] \[\033[1;36m\]# \[\033[0m\]"' >> ~/.bashrc

# add local bin to path
RUN echo "export PATH=\$PATH:/home/${USERNAME}/.local/bin" >> ~/.bashrc
ENV PATH="${PATH}:/home/${USERNAME}/.local/bin"

WORKDIR /home/${USERNAME}


# setup folders for saving vscode extensions
# https://code.visualstudio.com/remote/advancedcontainers/avoid-extension-reinstalls
RUN mkdir -p /home/$USERNAME/.vscode-server/extensions \
&& chown -R $USERNAME \
/home/$USERNAME/.vscode-server


# install requirements
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt && rm requirements.txt


# build timestamp
USER root
RUN echo ${VERSION} >> /build_date.txt && \
date >> /build_date.txt

USER ${USERNAME}
WORKDIR /home/${USERNAME}
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"initializeCommand": ".devcontainer/prepare_host.sh", // executed on HOST system
"image": "local/circup-dev",

"mounts": [
"source=/var/tmp/container-extensions,target=/home/dev/.vscode-server/extensions,type=bind,consistency=cached"
],
"postCreateCommand": "pip install -e '.[dev]'",


// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"shardulm94.trailing-spaces",
"njpwerner.autodocstring",
"mhutchie.git-graph",
"doi.fileheadercomment",
"donjayamanne.githistory",
"charliermarsh.ruff"
]
}
}
}
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2024 Jev Kuznetsov, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
25 changes: 25 additions & 0 deletions .devcontainer/prepare_host.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# SPDX-FileCopyrightText: 2024 Jev Kuznetsov, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT


# this script prepares the host for the devcontainer.


# it is easier to use this script to pre-build the image, instead of using
# `build` directive in `devcontainer.json`. Less chance of errors ducing container start.

IMG_NAME="local/circup-dev"
# Get the directory of the script
SCRIPT_DIR=$(dirname "$0")

# create a directory for the container extensions to avoid reinstallation
# on container rebuild. Mounted inside devcontainer.
mkdir -p /var/tmp/container-extensions


# buld image
echo "Building image $IMG_NAME"
docker build -t $IMG_NAME --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f $SCRIPT_DIR/Dockerfile $SCRIPT_DIR
13 changes: 13 additions & 0 deletions .devcontainer/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
bump2version
coverage
invoke
ipython
mypy
pre-commit
pytest
pytest-asyncio
pytest-cov
pytest-coverage
pytest-faulthandler
pytest-random-order
ruff
3 changes: 3 additions & 0 deletions .devcontainer/requirements.txt.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2024 Jev Kuznetsov, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
15 changes: 15 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,26 @@ Developer Setup
`Black code formatter <https://black.readthedocs.io/en/stable/index.html>`_
(which only works with Python 3.6+).



Clone the repository and from the root of the project,


setup a virtual environment and activate it.::

python3 -m venv .env
source .env/bin/activate

install the requirements::

pip install -e ".[dev]"


.. note::
This repository provides a devcontainer environment that can be used in VSCode. For more information, read `VSCode containers docs <https://code.visualstudio.com/docs/devcontainers/containers>`_.
This provides a ready to use development environment when you launch VSCode in the devcontainer.


Run the test suite::

pytest --random-order --cov-config .coveragerc --cov-report term-missing --cov=circup
Expand Down
4 changes: 0 additions & 4 deletions optional_requirements.txt

This file was deleted.

3 changes: 0 additions & 3 deletions optional_requirements.txt.license

This file was deleted.

73 changes: 73 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SPDX-FileCopyrightText: 2024 Jev Kuznetsov, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT

[build-system]
requires = ["setuptools>=61.0", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "circup"
dynamic = ["version"]
description = "A tool to manage/update libraries on CircuitPython devices."
readme = "README.rst"
authors = [{ name = "Adafruit Industries", email = "circuitpython@adafruit.com" }]
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Education",
"Topic :: Software Development :: Embedded Systems",
"Topic :: System :: Software Distribution"
]
keywords = ["adafruit", "blinka", "circuitpython", "micropython", "libraries"]


dependencies = [
"semver~=3.0",
"build",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "build" a new dependency? I'm not familiar with that, but I noticed it wasn't listed in the old requirements.txt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build is required for packaging. Should not be in normal deps. I'll fix that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it a new requirement? Was it required in the past? I'm not familiar with it.

I didn't see it listed in requirements or optional_requirements from before and the packaging was always working properly as far as I understand.

Is there some other specific change within this PR that makes this module now a requirement? Or was it always required and being installed in some other way before?

"click>=8.0",
"appdirs>=1.4.3",
"requests>=2.22.0",
"findimports>=2.1.0",
"toml>=0.10.2",
"update_checker",
"importlib_metadata; python_version == '3.7'"
]
requires-python = ">=3.6"


[project.optional-dependencies]
dev = [
"pytest",
"pylint",
"pytest-cov",
"pytest-random-order>=1.0.0",
"pytest-faulthandler",
"coverage",
"black",
"sphinx",
"wheel",
"twine"
]


[project.scripts]
circup = "circup:main"

[project.urls]
homepage = "https://github.com/adafruit/circup"

[tool.setuptools.packages.find]
where = ["."] # This tells setuptools to look in the project root directory
include = ["circup"] # This pattern includes your main package and any sub-packages within it
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements.txt.license

This file was deleted.

104 changes: 0 additions & 104 deletions setup.py

This file was deleted.

Loading