Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"name": "substrate",
"image": "ghcr.io/astral-sh/uv:python3.10-bookworm",
"image": "ghcr.io/astral-sh/uv:python3.10-trixie",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"moby": false
},
"ghcr.io/devcontainers-extra/features/devcontainers-cli:1": {},
"ghcr.io/devcontainers-extra/features/starship:1": {}
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
"packages": "starship"
}
},
"remoteEnv": {
"VIRTUAL_ENV": "/opt/venv",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Set up uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v7

- name: Check PR title
run: |
Expand Down
55 changes: 4 additions & 51 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

jobs:
test-copier:
test:
runs-on: ubuntu-latest

strategy:
Expand All @@ -17,16 +17,16 @@ jobs:
project-type: ["app", "package"]
typing: ["optional", "strict"]

name: "Copier: Python ${{ matrix.python-version }} ${{ matrix.project-type }} with ${{ matrix.typing }} typing"
name: "Python ${{ matrix.python-version }} ${{ matrix.project-type }} with ${{ matrix.typing }} typing"

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
path: substrate

- name: Set up uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/uv.lock"
Expand Down Expand Up @@ -66,50 +66,3 @@ jobs:
with:
context: ./my-project/
target: app

test-cookiecutter:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.13"]
project-type: ["app", "package"]

name: "Cookiecutter: Python ${{ matrix.python-version }} ${{ matrix.project-type }}"

steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: poetry-cookiecutter

- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "**/uv.lock"

- name: Scaffold Python project
run: |
uvx cruft create --no-input --extra-context '{"project_type": "${{ matrix.project-type }}", "project_name": "My Project", "python_version": "3.10", "__docker_image":"superlinear/python-gpu:$PYTHON_VERSION-cuda11.8", "with_fastapi_api": "1", "with_typer_cli": "1"}' ./poetry-cookiecutter/
cd my-project
git config --global init.defaultBranch main
git init
git checkout -b test
git add .

- name: Lint and test project
uses: devcontainers/ci@v0.3
with:
subFolder: ./my-project/
runCmd: |
poe lint
poe test

- name: Build app Docker image
if: ${{ matrix.project-type == 'app' }}
uses: docker/build-push-action@v6
with:
context: ./my-project/
target: app
41 changes: 2 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,43 +68,6 @@ If your project is on GitHub, your docs will be published automatically to GitHu
> [!TIP]
> Make sure to [configure the source of your project's GitHub Pages as GitHub Actions in your project settings](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow) to allow the GitHub Actions workflow to publish your docs.

## 🍪 Migrating from Cookiecutter

> [!IMPORTANT]
> This project was formerly known as `Poetry Cookiecutter` and was based on [Poetry](https://github.com/python-poetry/poetry) and [Cookiecutter](https://github.com/cookiecutter/cookiecutter). We will continue to support the original Cookiecutter-based template side by side with the new Copier-based template. However, we do encourage users to upgrade to the new Copier-based template by following the instructions below.

To migrate a project from Cookiecutter to Copier, follow these steps:

1. In your project repository, run:

```sh
# Create a new branch
git checkout -b rescaffold

# Remove unnecessary files
rm -f .cruft.json poetry.lock

# Rescaffold the project without changing src/ and tests/
uvx copier copy --overwrite --exclude src/ --exclude tests/ gh:superlinear-ai/substrate .
```

2. Review the changes to `pyproject.toml` and reinsert your project's dependencies.
3. Review the changes to `README.md` and reinsert your project's documentation.
4. Commit and push all changes with:

```sh
# Stage all changes
git add .

# Commit the staged changes
git commit -m "build: upgrade scaffolding"

# Push the committed changes
git push origin rescaffold
```

5. Create a PR from your branch, review it, and merge it!

## Contributing

<details>
Expand Down Expand Up @@ -150,8 +113,8 @@ The following development environments are supported:
pre-commit install --install-hooks
```

3. _VS Code Dev Container_: clone this repository, open it with VS Code, and run <kbd>Ctrl/⌘</kbd> + <kbd>⇧</kbd> + <kbd>P</kbd> → _Dev Containers: Reopen in Container_.
4. _PyCharm Dev Container_: clone this repository, open it with PyCharm, [create a Dev Container with Mount Sources](https://www.jetbrains.com/help/pycharm/start-dev-container-inside-ide.html), and [configure an existing Python interpreter](https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#widget) at `/opt/venv/bin/python`.
4. _VS Code Dev Container_: clone this repository, open it with VS Code, and run <kbd>Ctrl/⌘</kbd> + <kbd>⇧</kbd> + <kbd>P</kbd> → _Dev Containers: Reopen in Container_.
5. _PyCharm Dev Container_: clone this repository, open it with PyCharm, [create a Dev Container with Mount Sources](https://www.jetbrains.com/help/pycharm/start-dev-container-inside-ide.html), and [configure an existing Python interpreter](https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#widget) at `/opt/venv/bin/python`.

</details>

Expand Down
29 changes: 0 additions & 29 deletions cookiecutter.json

This file was deleted.

1 change: 0 additions & 1 deletion copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,3 @@ project_name_snake_case:
documentation_url:
when: false
default: "{% if ci == 'github' %}https://{{ project_url.rstrip('/').split('/')[-2] }}.github.io/{{ project_url.rstrip('/').split('/')[-1] }}{% else %}{{ project_url }}{% endif %}"

41 changes: 0 additions & 41 deletions hooks/post_gen_project.py

This file was deleted.

8 changes: 6 additions & 2 deletions template/.devcontainer/devcontainer.json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/",
"features": {
{%- if project_type == 'app' %}
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"moby": false
},
{%- endif %}
"ghcr.io/devcontainers-extra/features/starship:1": {}
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
"packages": "starship"
}
},
"overrideCommand": true,
"remoteUser": "user",
Expand Down
2 changes: 1 addition & 1 deletion template/Dockerfile.jinja
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM ghcr.io/astral-sh/uv:python{{ python_version }}-bookworm AS dev
FROM ghcr.io/astral-sh/uv:python{{ python_version }}-trixie AS dev

# Create and activate a virtual environment [1].
# [1] https://docs.astral.sh/uv/concepts/projects/config/#project-environment-path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v7

- name: Build docs
run: uv run mkdocs build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Node.js
uses: actions/setup-node@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Log in to the Docker registry
uses: docker/login-action@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v7

- name: Publish package
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Set up uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v7

- name: Check PR title
run: |
Expand Down

This file was deleted.

Loading
Loading