UI for visualizing self-hosted Pulumi state.
Project description
pyprojen
A minimal, Python-centric port of projen.
Overview
Project templates are great... except that they promote "code duplication at scale" and all the technical debt that come with that.
projen
(the tool this project is based on) represents a new generation of project template tools. projen
helps you manage the "day 2 problem" for project templates, to avoid "template drift".
projen
also helps you treat project configuration as an abstraction, whose implementation details can be changed/improved, without disrupting the developer workflow. Elad Ben-Israel, creator of projen
, AWS CDK
, and Winglang gave a talk on this at CDK day 2020.
- ⚡️ Agility. Centrally push unit-tested updates to all existing projects created from your templates in minutes, not months.
- 🧱 Modularity. Define composable, parameterized "components" that you can add/remove from your project as needed.
Real Examples
pyprojen
is a minimal port of projen
's core functionality to Python.
Specifically, it gets you
- ⚡️ Agility
- Examples:
- 10x the speed of CI for all repos overnight by making CI steps run in parallel instead of serially
- Update a team linting rule in
pyproject.toml
,ruff.toml
, etc. - Add auth steps to publish to or install from a private PyPI registry in CI or
Dockerfile
s - Completely change CI systems with minimal disruption, e.g. switch from Bitbucket Pipelines to GitHub Actions to AWS CodeBuild and back
- 🧱 Modularity
- Examples:
- define an opinionated
PythonPackage
component, and - layer on top a
FastAPIApp
,StreamlitApp
,CdkApp
,PulumiApp
,AirflowDag
,DagsterDag
,BentoMLService
,AwsLambdaPythonFunction
,- etc.
- Add (or remove) as many of these to your repo as you like, whenever you like, and find these packages instantly set up with CI, linting, formatting, tests, packaging, publishing, deploying, etc.
- For example, you might incrementally develop a "mini data science app monorepo" with
- a
MetaflowDag
that trains a model - served in a
FastAPI
app - which you can interact with via a
Streamlit
app - both of which are deployed by an
AwdCdk
app
- a
- all of these components would ideally be instantly set up with CI, linting, formatting, testing, packaging, publishing, deployment, etc. the moment they are added. And "un set up" with those if they are removed.
- For example, you might incrementally develop a "mini data science app monorepo" with
- define an opinionated
Q&A
How does
(py)projen
compare tocopier
orcookiecutter
?
Click to expand
copier
is a reaction to cookiecutter
, built to allow template updates to be propagated to existing projects.
-
Migration. The migration process for
(py)projen
is a single CLI command (python .pyprojenrc.py
). Whereas the migration process forcopier
is a bit more manual and prone to errors. -
Composable components.
copier
is more likecookiecutter
in that it uses Jinja templates to generate a certain set of files.(py)projen
lets you define re-usable components. You can add arbitrary numbers of these components to your project with different parameters and remove them just as easily.
That said, although cookiecutter
and copier
are more limited, they are also simpler.
What is the difference between
pyprojen
andprojen
?
Click to expand
1. Fundamentally, projen
offers a few things:
- A
Project
,Component
, andConstruct
abstraction that lets you define reusable components that you can push updates to. - Primitive components like
TextFile
,YamlFile
,JsonFile
,MarkdownFile
, etc. that you can compose to build "higher-level components". - A library of opinionated, higher-level components like
PythonProject
,TypescriptProject
,DockerCompose
,GithubWorkflow
, ... - An opinionated "task runner" system (think
Makefile/Justfile
,poetry
scripts, etc.) to define project-related commands. - A
projen new
command which creates the initial.projenrc.py
config file for your project
2. pyprojen
implements [1] and [2] from the list above (the unopinionated parts).
It is up to you to create your own components with your own opinions on things like
- when, if, and how to manage virtual environments, e.g.
uv
,pip
,conda
, etc. - which linter/formatter to use, e.g.
ruff
,pre-commit
, etc. - how to structure single- and multi-package repos (monorepos) and CI for them
Coming from tools like cookiecutter
or copier
, many people/teams prefer than using off-the-shelf templates or components.
3. pyprojen
is not a drop-in replacement for projen
, but it tries to get close.
If you write components in Python using pyprojen
, it should be easy to move them over to the projen
Python bindings if you decide to.
Should I use
pyprojen
orprojen
?
Click to expand
TL;DR Bias towards projen
, unless you
- Want a Python-first dev experience, and
- Prefer to fully-define your own project template/components rather than using projen's existing project templates, higher-level components, or task runner system
projen
is a larger project and is primarily maintained by developers at AWS. projen
,
But to develop with projen
, you either need to write TypeScript, or use generated Python bindings that invoke TypeScript.
If you are familiar with writing AWS CDK in Python, developing with projen
in Python is a similar experience, because they both use Python bindings generated from TypeScript using the JSII project.
This means:
- Not all internals of the original TS/JS code is exposed in the TS bindings, e.g. private attributes. You can unexectedly hit dead ends when attributes or methods that are available in TS are simply not available in Python.
- Step debugging is limited. The bindings are thin wrappers around a tool that invokes the original TypeScript/JavaScript code
- Errors raised by python bindings are cryptic and difficult to parse.
- Autocompletion is poor
- You need to have NodeJS installed on your system and in CI
- The JSII is a bit slow. (seconds not milliseconds)
Quick start (TODO)
[!NOTE] Until this section is filled out, you can refer to this repo to get a sense of what projen can do. And the official projen docs contain many of the same concepts that this port uses.
pip install pyprojen
from pyprojen import ...
Developing/Contributing
System requirements
You will need the following installed on your machine to develop on this codebase
make
AKAcmake
, e.g.sudo apt-get update -y; sudo apt-get install cmake -y
- Python 3.7+, ideally using
pyenv
to easily change between Python versions git
# clone the repo
git clone https://github.com/<your github username>/pyprojen.git
# install the dev dependencies
make install
# run the tests
make test
Project details
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
File details
Details for the file pulumi_ui-0.0.3.tar.gz
.
File metadata
- Download URL: pulumi_ui-0.0.3.tar.gz
- Upload date:
- Size: 533.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a5cc3552c0daaaff29b47720427d20b7fc79bc455835b821e9360bd8c62e029 |
|
MD5 | 9ba54bfd10ef71df839dbc5d88e46dfe |
|
BLAKE2b-256 | c0632c24e46aacf9084ce609991bf65fb153a15a8ec2b5a5fa9fe31375f3426f |
File details
Details for the file pulumi_ui-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: pulumi_ui-0.0.3-py3-none-any.whl
- Upload date:
- Size: 532.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ea864d828633177b9305775f73d8583edc011f9f6d7d97f65afd3b94f0a5f95 |
|
MD5 | 375f10487078c20c81f313c814b28549 |
|
BLAKE2b-256 | 7f808f80fbae6f0efc215411f959c987cf668cca54fab63561794d9237aa9346 |