diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 0000000..f3a5dc0 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,28 @@ +{ + "files": [ + "README.md" + ], + "imageSize": 100, + "commit": false, + "commitType": "docs", + "commitConvention": "angular", + "contributors": [ + { + "login": "ncclementi", + "name": "Naty Clementi", + "avatar_url": "https://avatars.githubusercontent.com/u/7526622?v=4", + "profile": "https://github.com/ncclementi", + "contributions": [ + "code", + "review", + "bug" + ] + } + ], + "contributorsPerLine": 7, + "skipCi": true, + "repoType": "github", + "repoHost": "https://github.com", + "projectName": "pyopensci-workshop-create-python-package", + "projectOwner": "pyOpenSci" +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 015d616..09f2df2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,29 +3,25 @@ { "name": "Python 3", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm", + "image": "mcr.microsoft.com/devcontainers/python:3.12", "features": { "ghcr.io/devcontainers-extra/features/copier:7.0.15": { - "version": "9.10.2" + "version": "9.14.1" }, "ghcr.io/devcontainers-extra/features/hatch:2.0.18": { - "version": "1.14.2" + "version": "1.16.5" }, "ghcr.io/devcontainers-extra/features/pre-commit:2.0.18": { - "version": "4.3.0" + "version": "4.5.1" }, "ghcr.io/devcontainers-extra/features/black:2.0.18": { - "version": "25.9.0" + "version": "26.3.1" }, "ghcr.io/devcontainers-extra/features/isort:2.0.18": { - "version": "6.0.1" - }, - "ghcr.io/rocker-org/devcontainer-features/miniforge:2": { - "version": "latest", - "variant": "Miniforge3" + "version": "8.0.1" }, "ghcr.io/va-h/devcontainers-features/uv:1": { - "version": "0.8.22" + "version": "0.11.3" }, }, "extensions": [ diff --git a/README.md b/README.md index 1bb1662..89de810 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,27 @@ # pyOpenSci: Create a Python Package Workshop Repository + +[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) + This repository supports pyOpenSci workshops focused on Python packaging. ## Getting started -Before the workshop, be sure that you read the setup instructions that you recieved in an email. +Before the workshop, be sure that you read the setup instructions that you received in an email. -You will need a GitHub and a testPyPI account to follow along. +You will need a GitHub and a testPyPI account to follow along. ## GitHub Codespaces -We have GitHub Codespaces configured for this workshop. To be successful during -the workshop, we suggest that you fork and open a codespace prior to attending -the workshop to ensure the enviornment loads properly. The initial codespace build can take up to 15 minutes. +We have GitHub Codespaces configured for this workshop. To use this repository and the dev container associated with it in a workshop, instructor your learners to create a new repository +as a template using this repo. + +![use-template](https://github.com/user-attachments/assets/c4778b46-70dc-4d3e-86d5-b1bd50f8d183) + +Open a codespace prior to attending +the workshop to ensure the environment loads properly. The initial codespace build can take up to 15 minutes. The link above provides you with instructions -one how to do this and how to setup the accounts you need for the workshop. +on how to do this and how to setup the accounts you need for the workshop. ## Creating your package @@ -22,3 +29,116 @@ To use the copier template, follow the [tutorial here](https://www.pyopensci.org The command to run the copier template is: `copier copy gh:pyopensci/pyos-package-template .` + +## Cheat Sheet + +Below is a command cheat sheet that will help you keep track of all of hte various commands used in our tutorials. + +--- + +## Ship It: Command Cheat Sheet + +### Codespace setup (one-time) + +```console +# Shorten your terminal prompt +export PS1="$ " +``` + +```console +# Disable keyring. You need to do this in codesppaces only when publishing to PyPI using Hatch. +export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring +``` + +### Create your package + +```bash +# Call the pyOpenSci package template +copier copy gh:pyOpenSci/pyos-package-template . +``` + +### uv commands + +```bash +# Launch Python in your project environment +uv run python +# Add package dependency +uv add numpy +# Remove package dependency +uv remove numpy +# Add a development dependency +uv add --dev pytest + +``` + +### Hatch environments + +```bash +# View all Hatch environments and scripts +hatch env show +# build your package; check your package distribution files using twine +hatch run build:check +# Run test suite with coverage (across Python versions) +hatch run test:run +# Build sphinx documentation +hatch run docs:build +# Serve sphinx docs locally with live reload +hatch run docs:serve +# Check docstrings & code style +hatch run style:check +# Format code with ruff +hatch run style:format +# Check dependencies for vulnerabilities +hatch run audit:check +``` + +### Build & publish + +```bash +# build sdist + wheel into dist/ using native hatch in your current environment +hatch build + +# Publish with hatch to test pypi (r = repository) +hatch publish -r test +``` + +### Install a package + +```bash +# Install from Test PyPI +uv pip install --index-url https://test.pypi.org/simple/ your-package-name +pip install -i https://test.pypi.org/simple/ your-package-name + +# Install from GitHub +pip install git+https://github.com/username/repo-name +``` + +### Run tests directly with pytest (vs hatch) + +```bash + # Run all tests in your active Python envt with pytest +pytest # Run tests using pytest with coverage +pytest --cov=pyospackage --cov-report=term-missing +``` + +## Contributors ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + + + +
Naty Clementi
Naty Clementi

💻 👀 🐛
+ + + + + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!