This project welcomes contributions. All Pull Requests should include proper testing, documentation, and follow all existing checks and practices.
- Project Structure
- Development Workflow
- Pre-commit
- Other helpful commands
- Test
- Developing CICD
- Easily test the plugin in a local astro project
- Alternatively
- Issues
astronomer_starship/index.html
is used for development, andvite build
uses it to compile the Javascript and CSS into thestatic
folderastronomer_starship/src
contains the React Appastronomer_starship/starship.py
contains the Airflow Plugin to inject the React Appastronomer_starship/template/index.html
contains the Flask View HTML
astronomer_starship/starship_api.py
contains the Airflow Plugin to that provides the Starship API Routes
- Create a branch off
main
- Develop, add tests, ensure all tests are passing
- Push up to GitHub (running pre-commit)
- Create a PR, get approval
- Merge the PR to
main
- On
main
: Create a tagVERSION="v$(python -c 'import astronomer_starship; print(astronomer_starship.__version__)')"; git tag -d $VERSION; git tag $VERSION
- Do any manual or integration testing
- Push the tag to GitHub
git push origin --tag
, which will create aDraft
release and upload to test.pypi.org via CICD - Approve the release on GitHub, which will upload to pypi.org via CICD
This project follows Semantic Versioning
This project
uses black
(link), blacken-docs
(link),
and ruff
(link). They run with pre-commit but you can run them directly with ruff check .
in the root.
This project utilizes Doctests and pytest
.
With the dev
extras installed, you can run all tests with pytest
in the root of the project. It will automatically
pick up it's configuration in pyproject.toml
Pre-commit is utilized to run common checks or linting. Install it locally to prevent needing to fix things after they fail in CICD
- This project uses pre-commit
- Install it with
pre-commit install
Install ruff
and black
plugins for your IDE
make pre-commit-install
It will run when you commit, or you can run
pre-commit run
Check out what is in the Justfile
You can run just help
for an overview
The package can be built and manually pushed to Test PyPi.
Note: twine
must be installed
Further instructions are here
and here
Test by adding this to a requirements.txt
--index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ astronomer-starship
and add this to airflow_settings.yaml
and then run astro d object import
airflow:
connections:
- conn_id: aws
conn_type: aws
conn_host:
conn_schema:
conn_login:
conn_password:
conn_port:
conn_extra:
pools:
- pool_name: foo
pool_slot: 999
pool_description:
variables:
- variable_name: foo
variable_value: bar
Use https://github.com/nektos/act to run and test CICD changes locally.
- Make a new project
astro dev init
- Symlink in starship
ln -s /path/to/starship starship
- add the file
docker-compose.override.yml
version: "3.1" services: webserver: volumes: - ./starship:/usr/local/airflow/starship:rw command: > bash -c 'if [[ -z "$$AIRFLOW__API__AUTH_BACKEND" ]] && [[ $$(pip show -f apache-airflow | grep basic_auth.py) ]]; then export AIRFLOW__API__AUTH_BACKEND=airflow.api.auth.backend.basic_auth ; else export AIRFLOW__API__AUTH_BACKEND=airflow.api.auth.backend.default ; fi && { airflow users create "$$@" || airflow create_user "$$@" ; } && { airflow sync-perm || airflow sync_perm ;} && airflow webserver -d' -- -r Admin -u admin -e [email protected] -f admin -l user -p admin
- Edit the file
Dockerfile
FROM quay.io/astronomer/astro-runtime:8.4.0 COPY --chown=astro:astro --chmod=777 starship starship USER root RUN pip install --upgrade pip && pip install ./starship USER astro
- Build with your symlink starship
tar -czh . | docker build -t local -
- Start (or restart) the astro project
astro dev <re>start -i local
- Quickly restart just the webserver with
docker restart $(docker container ls --filter name=webserver --format="{{.ID}}")
- Quickly restart just the webserver with
you may be able to run flask directly, see this
If you see a message like E jwt.exceptions.PyJWKClientConnectionError: Fail to fetch data from the url, err: "<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)>"
, do this: https://stackoverflow.com/a/58525755
pytest-xdist
can prevent a debugger from attaching correctly due to it's distributed/non-local behavior
You can fix this by commenting out --num-processes=auto
from pyproject.toml
or running with --dist no
to return to normal sequential pytest behavior