Skip to content

pyprojectx/px-demo

Repository files navigation

Open README.ipynb to view the full README (unfortunately github does not render notebook readme's)

Pyprojectx demo project

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

Python libraries

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()

Lightweight

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.

Simplified CI/CD pipelines

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 style pw build into a single command: python pw build

Getting started with pyprojectx in your own project

See the documentation for more details.

About

Easily install Python tools and command aliases

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published