From aff696d3914a3790d5f81136d884670bca18520d Mon Sep 17 00:00:00 2001 From: bsweger Date: Sun, 28 Jan 2024 15:21:39 -0500 Subject: [PATCH] Make additional changes for use as a pdm template --- .github/workflows/pythonapp-workflow.yml | 22 ++++++---------------- .gitignore | 10 ++++++++++ .python-version | 1 - README.md | 16 ++++++++++++++-- pyproject.toml | 4 ++-- src/python_app/{python_app.py => app.py} | 0 6 files changed, 32 insertions(+), 21 deletions(-) delete mode 100644 .python-version rename src/python_app/{python_app.py => app.py} (100%) diff --git a/.github/workflows/pythonapp-workflow.yml b/.github/workflows/pythonapp-workflow.yml index 4dc959c..4ffa23b 100644 --- a/.github/workflows/pythonapp-workflow.yml +++ b/.github/workflows/pythonapp-workflow.yml @@ -6,16 +6,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v5 + - name: Set up PDM + uses: pdm-project/setup-pdm@v4 with: - python-version: '3.10' - cache: 'pip' - - name: install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt -e . - if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi + cache: true + - name: Install dependencies + run: pdm install - name: lint run: | ruff . --fix @@ -26,10 +22,4 @@ jobs: - name: run tests run: | pytest - check-requirements: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: compare requirements to pyproject dependencies - run: | - echo 'not implemented' + diff --git a/.gitignore b/.gitignore index f4a72f7..3d98584 100644 --- a/.gitignore +++ b/.gitignore @@ -130,6 +130,16 @@ ENV/ env.bak/ venv.bak/ +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml +.pdm-python +.pdm-build/ + # Spyder project settings .spyderproject .spyproject diff --git a/.python-version b/.python-version deleted file mode 100644 index 36435ac..0000000 --- a/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.10.8 diff --git a/README.md b/README.md index 169a834..a39ee24 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ -# Python App Template +# python_app -There are so many good Python app templates in the world, but this one is mine. \ No newline at end of file +python_app is a template for use with PDM + +To create a new PDM-based project that uses this template: + +1. [Install PDM](https://pdm-project.org/latest/#installation) +2. Create a new project directory: + ``` + mkdir my_project && cd my_project + ``` +3. Initialize a PDM project, using this repo as a template: + ``` + pdm init https://github.com/bsweger/python-app-template + ``` diff --git a/pyproject.toml b/pyproject.toml index 22fcd28..593b0ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ requires = ['setuptools', 'wheel'] [tools.setuptools] packages = ['python_app'] -[tool.python-app] +[tool.python_app] # to write json-formatted logs to disk, uncomment the following line specify the file location # log_file = '/Users/becky/logs/python_app.log' @@ -47,4 +47,4 @@ extend-select = ['I'] quote-style = 'single' [tool.setuptools.dynamic] -version = {attr = 'python_app.__version__'} \ No newline at end of file +version = {attr = 'python_app.__version__'} diff --git a/src/python_app/python_app.py b/src/python_app/app.py similarity index 100% rename from src/python_app/python_app.py rename to src/python_app/app.py