Setup Projects Blazingly Fast with Snappyr
Project description
Snappyr - Setup Projects Blazingly Fast.
Introduction
I'm someone who works a lot on different projects, especially in python. Having to manually set up things that takes me sometime to do, takes away the fun from it. Tools like poetry or uv are preferred for project management, but in my case, I require just the project setup, I can manage other things.
That's why I created Snappyr. It is a basic tool that just does it for me. With this tool in my arsenal, I focus my energy on creating projects, not worrying about other things. Snappyr is hardly 100 LOC, in pure python without any external dependencies, but it helps me a ton.
Features
Snappyr does a lot of redundant tasks, especially the ones we do in the start of a new python project. These include:
- Create the directory structure. Snappyr sets up the project directory. Snappyr can be made to adjust as per your need. Just fork the project, and create your own version. The format that works for me is:
project_name
|__ src/
|__ tests/
|__ scripts/
|__ docs/
|__ venv
|__ .env
|__ .gitignore
|__ main.py
|__ README.md
|__ requirements.txt
-
Setting up virtual environment. Snappyr uses python virtual environment behind the scenes and creates a venv so that we don't run into dependency conflicts.
-
Setup Git Repository for the project. By default, git is initialized in the project working directory. This can also be connected to a remote repository, or can be later configured using Git CLI.
-
Package Mode. If I'm working on developing a library(which is often the case), I can specify in the Snappyr CLI and it'll configure the
setuptoolsand other necessary requirements to be used for your project. -
Pre-commit hooks. Snappyr also add a boilerplate pre-commit hooks for the project.
Usage
Using snappyr is pretty easy. First, download the package through PyPI:
pip install snappyr
Snappyr is available through CLI, which can be run using poetry. After installing, use the commands to run:
poetry run snappyr --project_name="severance" --is_package=False
The options available in the CLI are
--project_name: This is your project name. You can set this whatever you want.
--is_package: If the project you are working on is a package, Snappyr will add additional things too.
Get it to work.
I feel the right way to use Snappyr is not through package, but setting this up in your machine so you can call it from anywhere. You just need to copy the main.py (renamed to snappyr), and follow the instructions as per your machine.
Windows
-
Save the Script: Save the code as
snappyr.pyin a directory, e.g., C:\my_scripts. -
Add the script to PATH:
- Open the Start Menu and search for "Environment Variables.
- Click Edit the system environment variables > Environment Variables.
- In the System Variables section, find the Path variable, select it, and click Edit.
- Add the path to your directory (e.g., C:\my_scripts) and click OK.
- Make It Callable: In C:\my_scripts, create a batch file (e.g.,
snappyr.bat) with the following content:
@echo off
python %~dp0snappyr.py %*
- This makes the script callable from anywhere in the command prompt as:
snappyr <project_name>
Linux/Mac
-
Save the
main.pyassnappyr.py(or any other name you want) -
Make the file Executable, run the following command:
chmod +x snappyr.py
- Move it to a directory in your PATH (e.g., /usr/local/bin) so you can call it from anywhere:
mv snappyr.py /usr/local/bin/snappyr
- From your terminal, run:
snapper <project_name>
After setting this up, you can set up your projects as(from anywhere!!):
snappyr my_python_project
Contributing
This is a very small project, so it'll be very easy to add features. Get in touch with me if you have any ideas, and we can work on PRs.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snappyr-0.1.1.tar.gz.
File metadata
- Download URL: snappyr-0.1.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.4 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53b25e03c2e440ca90b571e087dc73450f64255a2d4bc6b650f95ba3e71bb660
|
|
| MD5 |
099f0886682c86f6eba639a04363ac4b
|
|
| BLAKE2b-256 |
9548c37e9da0f98f93dfaaf87840f242ad52eaa021a0700a63eb17d7514bbfdc
|
File details
Details for the file snappyr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: snappyr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.4 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
110ad7d76236f96755412e7486bd5322d5941054e0b41ee952037743c141b2a5
|
|
| MD5 |
46b5fadf349c88cda64f472964cc9a1b
|
|
| BLAKE2b-256 |
93cfa0a09abf225f882dfa736f50de8bbeb75778ba63a059260d8f0e5c497f11
|