Open README.ipynb to view the full README (unfortunately github does not render notebook readme's)
Make it easy for your co-developers/contributors/tutorial readers to get started with your python project.
If you have python 3.8+ and git installed, you're ready to go. No need to install jupyter, libraries, etc.
Clone the project and start experimenting:
git clone https://github.com/houbie/px-demo.git
./pw notebook
Pyprojectx(https://github.com/houbie/pyprojectx) can turn your pyproject.toml config file into an executable build script.
Things you can try out:
- show help:
./pw --help
or./pw -h
- show available tools and commands:
./pw --info
or./pw -i
- run a pdm command:
./pw pdm --help
- use httpie to execute https commands:
./pw https --help
- just type the first letters if you don't remember the full command:
./pw c
- just type enough (camel case) letters to identify an aliased command:
./pw post-json
./pw pJ
./pw p
Make it a habit to manage the libraries that you use with a decent dependency manager like Poetry or PDM.
So instead of using a requirements.txt, or worse, pip install
instructions, list your dependencies in pyproject.toml.
No need to install anything, the pyprojectx wrapper script will make sure that the tools are available. All the required tools are installed inside the project dir (cfg. npm dev dependencies).
Experimenting with your code in a Jupyter notebook f.e., becomes as easy as ./pw notebook
.
NOTE: you need to restart the notebook kernel to activate changes to the project.
# the project and all required libraries are automatically available here
from pycowsay.main import main as cowsay
from px_demo import moo
print("running project code")
moo.say_moo()
print("using pycowsay library")
cowsay()
The pw wrapper script installs all the (Python) tools that your project uses in isolated virtual environments inside .pyprojectx.
This is analogous to how npm stores everything in the node_modules subdirectory of your project directory.
All commands and arguments are then forwarded to the resp. virtual environment by just typing ./pw in front.
Run tests and build a distribution with ./pw build
. See it in action in this project's github action workflow or
the pyprojectx workflow for a full example.
NOTE: If your CI/CD server runs on both linux and windows, you can merge the linux style
./pw build
and the windows stylepw build
into a single command:python pw build
See the documentation for more details.