The base repository for Starcraft projects.
This template code is the basis for all future starcraft projects, and acts as the testbed for any major tooling changes that we want to make before propagating them across all projects.
TODO
-
Update this guide as you go along, if something is unclear or missing.
-
Use ruff.
-
Pull in the bare minimum
pyproject.tomlneeded to use ruff. -
Make your codebase pass with ruff. Commit after each step:
ruff check --fixruff check --fix --unsafe-fixesruff check --add-noqaruff format
-
Replace use of black, flake8, pydocstyle, isort, and pylint in Makefile/CI with:
ruff check --fixruff format
-
-
Modify top-level files in your project to match what's in Starbase as closely as possible.
-
Makefile– Ensure you useuvand at least have the same targets:setuplinttest-unittest-integration(If this applies to your repo, i.e. the repo is a library rather than an application)coverage
-
pyproject.toml– Expand from just the ruff things: move things into here from yoursetup.py,setup.cfg, andrequirements.*.txt. -
Project files – If any of the repository docs (README, CONTRIBUTING, and so on) aren't written in Markdown, convert them to
.mdwith pandoc:pandoc -o README.md README.rstBe sure to review the changes it makes. Pandoc sometimes does unexpected things when interpreting reStructuredText directives.
-
README.md– Base the contents of the README on the provided README template. Try and align with the model as closely as you can. For an example of this template in use, refer to the Snapcraft README. -
SECURITY.md– Match the content of your project'sSECURITY.mdfile as closely as you can to the structure of the Security policy template. Be sure to follow the comments in the template closely.
-
-
Run all the linters with
make lint.-
mypy:- Mypy checks the same things as
ruff'sANNXXXchecks, butruff'snoqadirectives mean nothing to mypy. You'll need to fix these by hand, mostly by adding type annotations to function definitions.
- Mypy checks the same things as
-
pyright:- For errors along the lines of "Stub file not found for $library", check for
the existence of pip package
typing-$libraryand add it as a dependency. - If you have lots of errors you may need to remove the
strictdirective frompyproject.toml.
- For errors along the lines of "Stub file not found for $library", check for
the existence of pip package
-
-
Do a side-by-side diff of the
.gitignorefiles in your project and Starbase, making them as close as possible and adding anything that makes sense upstream. -
Bring in remaining top-level files:
.editorconfig.pre-commit-config.yaml.shellcheckrctox.ini
-
If you're rebasing a library, add the integrations tests structure. Applications should use spread for integration tests.
-
Finally, once all files are manually synced, actually sync the Git history:
git remote add starbase [email protected]:canonical/starbase.gitgit fetch starbase maingit merge --allow-unrelated-histories starbase/maingit remote remove starbase- Don't forget to review all the new files and dirs that this merge adds -you'll want to delete a lot of them.
- When you merge, DO NOT squash, otherwise the starbase history will not be preserved.
-
Use this template to create your repository.
-
Sync the Git history with starbase to ease future merging:
git clone <your-repo>git remote add starbase [email protected]:canonical/starbase.gitgit fetch starbase maingit merge --allow-unrelated-histories starbase/maingit push -f origin maingit remote remove starbase
-
Ensure the
LICENSEfile represents the current best practices from the Canonical legal team for the specific project you intend to release. We use LGPL v3 for libraries, and GPL v3 for apps. -
Rename any files or directories and ensure references are updated.
-
Replace any instances of the words
Starcraftandstarbasewith the product's name. -
Place contact information in a code of conduct.
-
Rewrite the README.
-
If a Diataxis quadrant (tutorials, how-tos, references, explanations) doesn't yet have content, remove its landing page from the TOC and delete its card in
docs/index.rst. You can re-index it when at least one document has been produced for it. -
Register the product's documentation on our custom domain on Read the Docs for Business
-
Delete
.github/README.md.