From 8331695b4d0dcedfe6d1a5da1ec1742ea698bc53 Mon Sep 17 00:00:00 2001 From: Daniel Stonier Date: Tue, 26 Nov 2024 12:26:00 -0500 Subject: [PATCH] [infra] developing notes, cleared out setup.py (#11) --- .project | 17 ------ .pydevproject | 8 --- DEVELOPING.md | 26 +++++++++ pyproject.toml | 2 - setup.py | 35 ----------- venv.bash | 156 ------------------------------------------------- 6 files changed, 26 insertions(+), 218 deletions(-) delete mode 100644 .project delete mode 100644 .pydevproject create mode 100644 DEVELOPING.md delete mode 100755 setup.py delete mode 100755 venv.bash diff --git a/.project b/.project deleted file mode 100644 index 37f14fa..0000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - streamlit_parameters - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/.pydevproject b/.pydevproject deleted file mode 100644 index aa7a29a..0000000 --- a/.pydevproject +++ /dev/null @@ -1,8 +0,0 @@ - - - - /${PROJECT_DIR_NAME} - - python interpreter - Default - diff --git a/DEVELOPING.md b/DEVELOPING.md new file mode 100644 index 0000000..2ac22aa --- /dev/null +++ b/DEVELOPING.md @@ -0,0 +1,26 @@ +# Developing + +## Setup + +[Install poetry](https://python-poetry.org/docs/#installation) +into your development environment or use VSCode with the attached +devcontainer configurations that have poetry pre-installed. + +## Usage + +Execute the demo via a python console script: + +``` +poetry install +poetry shell +streamlit-demo-parameters +``` + +Or execute the demo via streamlit: + +``` +poetry install +poetry shell +streamlit run demo.py +``` + diff --git a/pyproject.toml b/pyproject.toml index c64246c..1342f85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,11 +29,9 @@ streamlit = { version = ">=1.30,<2"} [tool.poetry.group.dev.dependencies] tox = ">=3.26" -# tox-poetry-installer = {extras = ["poetry"], version = ">=0.9.0"} pytest = { version = ">=7.1" } pytest-console-scripts = { version = ">=1.3" } pytest-mock = { version = ">=3.14.0" } -# pytest-cov = ">=3.0.0" # transitively depends on coverage[toml] [tool.poetry.group.format.dependencies] ufmt = ">=2.8" # black (style) + usort (import order) diff --git a/setup.py b/setup.py deleted file mode 100755 index ef7ff33..0000000 --- a/setup.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python - -from setuptools import find_packages, setup - - -install_requires = [ - 'streamlit>=1.30,<2' -] - -tests_require = ['pytest', 'pytest-mock', 'tox'] -extras_require = { - 'test': tests_require, -} - -setup( - name='streamlit_parameters', - version='0.1.5', - packages=find_packages(exclude=['tests*', 'docs*']), - install_requires=install_requires, - extras_require=extras_require, - author='Daniel Stonier', - maintainer='Daniel Stonier ', - url='http://github.com/stonier/streamlit_parameters', - zip_safe=True, - description="Streamlit parameter management for page configuration", - long_description="Streamlit parameter management across widgets, session state & the url query string.", - license='BSD', - test_suite='tests', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'streamlit-demo-parameters = streamlit_parameters.demos.parameters:console_main', - ], - }, -) diff --git a/venv.bash b/venv.bash deleted file mode 100755 index 2f67588..0000000 --- a/venv.bash +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/bash - -# Script for setting up the development environment. - -SRC_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -VENV_DIR=${SRC_DIR}/.venv - -############################################################################## -# Colours -############################################################################## - -BOLD="\e[1m" - -CYAN="\e[36m" -GREEN="\e[32m" -RED="\e[31m" -YELLOW="\e[33m" - -RESET="\e[0m" - -padded_message () -{ - line="........................................" - printf "%s %s${2}\n" ${1} "${line:${#1}}" -} - -pretty_header () -{ - echo -e "${BOLD}${1}${RESET}" -} - -pretty_print () -{ - echo -e "${GREEN}${1}${RESET}" -} - -pretty_warning () -{ - echo -e "${YELLOW}${1}${RESET}" -} - -pretty_error () -{ - echo -e "${RED}${1}${RESET}" -} - -############################################################################## -# Methods -############################################################################## - -install_package () -{ - PACKAGE_NAME=$1 - dpkg -s ${PACKAGE_NAME} > /dev/null - if [ $? -ne 0 ]; then - sudo apt-get -q -y install ${PACKAGE_NAME} > /dev/null - else - pretty_print " $(padded_message ${PACKAGE_NAME} "found")" - return 0 - fi - if [ $? -ne 0 ]; then - pretty_error " $(padded_message ${PACKAGE_NAME} "failed")" - return 1 - fi - pretty_warning " $(padded_message ${PACKAGE_NAME} "installed")" - return 0 -} - -############################################################################## - -############################# -# Checks -############################# - -[[ "${BASH_SOURCE[0]}" != "${0}" ]] && SOURCED=1 -if [ -z "$SOURCED" ]; then - pretty_error "This script needs to be sourced, i.e. source './setup.bash', not './setup.bash'" - exit 1 -fi - -############################# -# System Dependencies -############################# - -pretty_header "System Dependencies" -install_package python3-dev || return -install_package python3-venv || return - -############################# -# Virtual Env -############################# - -pretty_header "Virtual Environment" - -if [ -x ${VENV_DIR}/bin/pip3 ]; then - pretty_print " $(padded_message "virtual_environment" "found [${VENV_DIR}]")" -else - python3 -m venv ${VENV_DIR} - pretty_warning " $(padded_message "virtual_environment" "created [${VENV_DIR}]")" -fi - -source ${VENV_DIR}/bin/activate - -############################# -# Pypi Dependencies -############################# - -pretty_header "PyPi Dependencies" - -# upgrade pip3 -python3 -m pip install -U pip - -# build environment depedencies -pip3 install wheel -pip3 install "setuptools==45.2" - -# Get all dependencies for testing, doc generation (fetches those listed in extra_requires) -# Tox handles testing dependencies now, but you still need tox and regardless, it's convenient -# to be able to run the testing tools directly without tox inbetween. -pip3 install -e .[test] - -# Get package dependencies (fetches those listed in install_requires) -python3 setup.py develop - -############################# -# Aliases -############################# - -alias create-pypi-package="rm -rf build dist && python3 setup.py sdist bdist_wheel && twine upload dist/*" -alias create-pypi-package-test="rm -rf build dist && python3 setup.py sdist bdist_wheel && twine upload --repository-url https://test.pypi.org/legacy/ dist/*" -alias create-deb="rm -rf dist deb_dist && python setup.py --command-packages=stdeb.command bdist_deb" -alias create-source-deb="rm -rf dist deb_dist && python setup.py --command-packages=stdeb.command sdist_deb" -alias tox-all="tox -e py38" -alias tox-flake8="tox -e flake8" - -############################# -# Summary -############################# - -echo -e "" -echo -e "${BOLD}---------------------------------------${RESET}" -echo -e "${BOLD} Streamlit Parameters${RESET}" -echo -e "${BOLD}---------------------------------------${RESET}" -echo -e "" -echo -e "${GREEN}Aliases${RESET}" -echo -e "${CYAN} - ${YELLOW}create-pypi-package${RESET}" -echo -e "${CYAN} - ${YELLOW}create-pypi-package-test${RESET}" -echo -e "${CYAN} - ${YELLOW}create-deb${RESET}" -echo -e "${CYAN} - ${YELLOW}create-source-deb${RESET}" -echo -e "${CYAN} - ${YELLOW}tox-all${RESET}" -echo -e "${CYAN} - ${YELLOW}tox-flake8${RESET}" -echo "" -echo "Leave the virtual environment with 'deactivate'" -echo "" -echo "I'm grooty, you should be too." -echo ""