templatepy: template for derivative python packages
Project description
templatepy
Template repo for python repositories & PyPi integration
Version: "0.0.2"
Usage
- Change files according to overview in
TODO
below - Develop package...
- Install package:
- static/normal install:
pip install .
- editable install:
pip install -e .
- dev install:
pip install -e .[dev]
(some terminals require to escape brackets with\
as\[
, esp. zsh)
- static/normal install:
File overview
General
-
LICENSE
: license text -
README.md
: Github-flavored markdown file -
templatepy
: placeholder folder for any python package that is configured for install viasetup.cfg
andpyproject.toml
__init__.py
: contains basic package info and example function that is called by console entrypoint (seesetup.cfg
)example.data.file.config
: a file to demonstrate that data files are included based onsetup.cfg
criteriaexample.data.file.test-extension-yu48
: a file to demonstrate data exclusion viasetup.py
Packaging system
-
MANIFEST.in
: manifest file describes included/excluded files for build -
pyproject.toml
:- specifies build system: this replaces the usual
setup.py
architecture for setuptools - config for black code formatter
- specifies build system: this replaces the usual
-
setup.cfg
:- package specification and install dependencies
- config for bump2version and
flake8
formatting (see pre-commit)
-
setup.py
: legacy file (see notes on new build-system below)
Code maintenance (linting/formatting/github)
-
.pre-commit-config.yaml
: use pre-commit to run code formatting (e.g. with black andflake8
) and PEP compliance checks- Install pre-commit hook with
pre-commit install
(Note: only installs it in the current virtual environment) - Run it manually with
pre-commit run --all
or leave it to run on commit (requires to re-stage changed files!)
- Install pre-commit hook with
-
.github
: folder that contains github automation workflows and issues templates -
.gitignore
: ignored files/folders in git tools
TODO for adapting template to new project
- Change package name:
- (1)
templatepy
folder - (2) README.md
- (3)
name
argument insetup.cfg
- (4)
.github/workflows
files - (5)
setup.cfg
:[bumpversion:file:templatepy/__init__.py]
- (1)
- Change details about project author, etc. in
setup.cfg
,README.md
, andtemplatepy/__init__.py
- Change license holder in
LICENSE
- Change
README
badge paths at top - Verify inclusions/exclusions of installable files/folders in
MANIFEST.in
andsetup.cfg
- Check
.gitignore
contains relevant criteria - Add all version string locations to
setup.cfg
/bump2version field.- Use same syntax as for
[bumpversion:file:PACKAGEFOLDER/__init__.py]
line to describe how to find version on version increment
- Use same syntax as for
- To upload to pypi: see below for workflow
- To upload to Zenodo if repo is a publication:
- (1) Connect Zenodo to Github account
- (2) Flip switch on zenodo view of repo - NOTE: Zenodo can only copy from public repos
- (3) Create new release version of github repo (manual or via
.github/workflows/CI.yaml
) - (4) Wait! Zenodo view with DOI assignment should update within about a minute
- (5) Add DOI badge to
README
file
Workflow for (automatically) uploading package to pypi or test.pypi
- (1) On pypi, make new API key for repo or general
- (2) On Github, in repository settings add a new actions secret named
TWINE_API_KEY
and copy in the pypi API key - (3) Create a new release manually on github or by triggering the github workflow with a version without release extension (e.g.
x.y.z
)
Notes
New(er) build system with pyproject.toml
and setup.cfg
pip
- tested with
pip install . --use-feature=in-tree-build
for forward-compatibility withpip 21.3
- keeping empty
setup.py
for enabling install in editable mode-e
as this still requires such a file - added
wheel
as build-system dependency for compatibility with pip that does not implementPEP 517
- tested with
setup.cfg
/setup.py
might be fully replaced withpyproject.toml
. See this discussion.
License
This software is released under the BSD 3-Clause License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file templatepy-0.0.2.tar.gz
.
File metadata
- Download URL: templatepy-0.0.2.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d9aebcd86d32bc947bb25c9e92f334485b06e427d178c5be312ac9ee33f58ae |
|
MD5 | 943da97b57e893f342dc580003018091 |
|
BLAKE2b-256 | bc36318bee3e28c95a8ed8aa6a3a8d8146b37fc0539e6068b0353517078258b3 |
File details
Details for the file templatepy-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: templatepy-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ef344526c774e7170463888c7bf7d82f6e3be8c2137334d05b4564ed3db1205 |
|
MD5 | 2934998e3a7fbc89b61cfc0c6664a681 |
|
BLAKE2b-256 | 7bb3dcb1754cb7e456ef217d3d8a3664f3c0403facdeac119fb0ab088846f83a |