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
Type
package create
inside the project directory.Answer the questions as the following – note that (default) means to hit enter without modifying anything:
Type
package create
inside the project directory.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
orsbillinge
.- 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
. Unlikeproject_name
, it must be lowercase so that it can be imported asimport 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 inpyproject.toml
orsetup.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 selectNo
.- has_gui_tests:
Whether the package runs headless testing in GitHub CI. If your package does not contain a GUI, type
1
to selectNo
.
Type
ls
to see the project directory.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.
Make sure you have a GitHub account.
Visit
https://github.com/new
.Choose the
Owner
and enter theRepository name
and theDescription
.Set
none
underAdd .gitignore
andChoose a licenese
. We will use the ones generated byscikit-package
.Click the
Create repository
to green button to create the repository.You will have ``https://github.com/<OWNER>/<project-name>`.
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