A boilerplate environment for Python package development.
Project description
Chthonic
A boilerplate environment for Python package development.
The main idea is to make developing packages and packaging them for PyPI as painless as possible by letting Vagrant handle most of the overhead.
Since a lot of my work involves data science-y stuff, I've also baked Jupyter into the environment (instructions below).
Requirements
VirtualBox and Vagrant.
Environment Setup
- Replace references to the dummy package name with your package name via
sh replace_chthonic.sh <your-package-name>
. - Add any package dependencies to
setup.py
andrequirements.txt
.- If you decide to
pip install
new dependencies later on, as you develop, it's all good! Just remember to add them tosetup.py
andrequirements.txt
.
- If you decide to
- Install the environment with
vagrant up
. - Enter the environment with
vagrant ssh
.- To stop running the environment, exit it with
exit
and halt it withvagrant halt
—this can save a lot of CPU and memory when you're not working on the package. Bring it up again anytime withvagrant up
.
- To stop running the environment, exit it with
Package Development.
- Enter the environment with
vagrant ssh
.- A venv for your package will be automatically activated each time you enter.
- The necessary packaging tools are already installed in this venv by default.
- Other development tools (e.g.,
pylint
) are also installed by default; check outrequirements.txt
for the full list.
- A venv for your package will be automatically activated each time you enter.
- Add project files to the appropriate directory (e.g., the package subfolder, whose name is
chthonic
in this example).
Packaging for PyPI
- Enter the Vagrant environment with
vagrant ssh
. - Make sure that your
README.md
is informative about your package. - Make sure that all package dependencies have been added to
setup.py
. python setup.py sdist
1twine upload dist/*
(requires a PyPI account).- Done!
Using Jupyter Notebooks with Vagrant
- Enter the environment with
vagrant ssh
. - Inside the environment, run
jupyter notebook --ip=0.0.0.0
. - Copy the bottom-most URL printed to the console (e.g.,
http://127.0.0.1:8888/?token=5dibo
(the actual token will be way, way, way longer)). - Open your favorite web browser, paste in the URL, and go to it.
1Notice that this doesn't issue bdist_wheel
, in flagrant violation of the official packaging tutorial. I've found wheel construction in Vagrant environments to be a bit buggy and, fortunately, unnecessary for my projects. If you find the lack of wheels disturbing, then you probably know enough about packaging not to need an environment like this in the first place.
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
File details
Details for the file chthonic-1.0.0.tar.gz
.
File metadata
- Download URL: chthonic-1.0.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c266e07a5f1a2a79521607a1c660973fcc5fcf36295a20ffbf1882e13fbaed3 |
|
MD5 | cdbf6c1f307c0ae45875a14181de23cb |
|
BLAKE2b-256 | 363120a4c0d5eb2d3f7319b2ce1f5dd4ceaed75e4a12013116d1c450fca05061 |