How to start a new Python project with scikit-package

Installation

To get started, install scikit-package, black, and pre-commit in a new conda environment. Follow the steps below:

Create a new environment named scikit-package_env:

conda create -n scikit-package_env

Activate the environment:

conda activate scikit-package_env

Install packages:

conda install scikit-package black pre-commit

Overview

scikit-package main workflow

  1. Type package create inside the project directory.

  2. Answer the questions as the following – note that (default) means to hit enter without modifying anything:

  1. Type package create inside the project directory.

  2. Answer the questions as follows.

proj stands for “project” and gh for “GitHub”.

proj_owner_name:

e.g., Simon J. L. Billinge.

proj_owner_email:

e.g., sbillinge@columbia.edu.

proj_owner_gh_username:

e.g., sbillinge.

contributors:

e.g., Billinge Group members and community contributors.

license_holders:

e.g., The Trustees of Columbia University in the City of New York.

project_name:

e.g., my-package. For a namespace package, use e.g., diffpy.my-package.

github_org:

The GitHub organization name or owner’s GitHub username. e.g., diffpy or sbillinge.

github_repo_name:

e.g., my-package. The repository name of the project displayed on GitHub.

package_dist_name:

The name in the package distribution in PyPI and conda-forge. If your package name contains _, replace it with -. e.g., my-package. For a namespace package, use e.g., diffpy.my-package.

package_dir_name:

The name of the package directory. e.g., src/my_package. Unlike project_name, it must be lowercase so that it can be imported as import my_package.

proj_short_description:

e.g., Python package for doing science.

keywords:

Each word is separated by a comma and a space. e.g., pdf, diffraction, neutron, x-ray. The keywords may be found in pyproject.toml or setup.py.

min_python_version:

The minimum Python version for package distribution.

max_python_version:

The maximum Python version for package distribution.

needs_c_code_compiled:

Whether the package requires C/C++ code that requires building the package. For pure Python packages, type 1 to select No.

has_gui_tests:

Whether the package runs headless testing in GitHub CI. If your package does not contain a GUI, type 1 to select No.

  1. Type ls to see the project directory.

  2. Type cd <package_dir_name> to change the directory to the re-packaged directory.

3. Ensure you can build your project 4. Check your documentation ————————

# Build your documentation locally:

Host your project on GitHub

Here, we will not use a PR workflow. Instead, the goal here is to host your project on GitHub.

  1. Make sure you have a GitHub account.

  2. Visit https://github.com/new.

  3. Choose the Owner and enter the Repository name and the Description.

  4. Set none under Add .gitignore and Choose a licenese. We will use the ones generated by scikit-package.

  5. Click the Create repository to green button to create the repository.

  6. You will have ``https://github.com/<OWNER>/<project-name>`.

  7. Initialize the repository

    git init
    git remote add origin https://github.com/bobleesj/test-package.git
    git add .
    git commit -m "skpkg: start a new project with scikit-package"
    git branch -M main
    git push --set-upstream origin main
    

Hello world

Helo