-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from duarteocarmo/cookiecutter
Make this a cookiecutter
- Loading branch information
Showing
23 changed files
with
116 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# Predictor: An example project | ||
# Duarte's boilerplate | ||
|
||
## Development | ||
This is a [cookiecutter](https://github.com/cookiecutter/cookiecutter) template I use to kickstart python projects. | ||
|
||
1. Make sure you are running in a virtual environment (e.g., `python3 -m venv .env`) | ||
2. Activate it (e.g. `source .env/bin/activate`) | ||
'Cause writing boilerplate is boring. | ||
|
||
```shell | ||
(.env) $ make install-dev | ||
``` | ||
## Installation | ||
|
||
3. Run the tests | ||
Make sure you have cookiecutter installed: | ||
|
||
```shell | ||
(.env) $ make test | ||
$ pipx install cookiecutter | ||
``` | ||
|
||
4. For more help: | ||
Then create your project: | ||
|
||
```shell | ||
(.env) $ make help | ||
$ pipx run cookiecutter gh:duarteocarmo/boilerplate | ||
``` | ||
|
||
Enjoy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"project_slug": "myproject", | ||
"project_title": "My project", | ||
"project_description": "A nice description", | ||
"project_version": "24.4.13" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import subprocess | ||
|
||
print('Initializing git repository...') | ||
subprocess.call(['git', 'init']) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,3 +127,4 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
.DS_Store |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# {{cookiecutter.project_title}} | ||
|
||
{{cookiecutter.project_description}} | ||
|
||
## Development | ||
|
||
Note: We use [uv](https://github.com/astral-sh/uv?tab=readme-ov-file#getting-started) for installing things, make sure you have it. | ||
|
||
1. Make sure you are running in a virtual environment (e.g., `python3 -m venv .env`) | ||
2. Activate it (e.g. `source .env/bin/activate`) | ||
|
||
```shell | ||
(.env) $ make install-dev | ||
``` | ||
|
||
3. Run the tests | ||
|
||
```shell | ||
(.env) $ make test | ||
``` | ||
|
||
4. Run the API | ||
|
||
```shell | ||
(.env) $ make api | ||
``` | ||
|
||
5. For more help: | ||
```shell | ||
(.env) $ make help | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[project] | ||
name = "{{cookiecutter.project_slug}}" | ||
version = "{{cookiecutter.project_version}}" | ||
description = "{{cookiecutter.project_description}}" | ||
readme = "README.md" | ||
requires-python = ">=3.10" | ||
dependencies = ["fastapi", "uvicorn"] | ||
|
||
[project.optional-dependencies] | ||
dev = ["pytest", "pytest-cov", "ruff", "watchdog", "httpx"] | ||
|
||
[tool.ruff] | ||
exclude = [".env", ".venv", "venv", "notebooks"] | ||
line-length = 79 | ||
|
||
[tool.ruff.lint] | ||
ignore = ["E501"] | ||
select = ["E", "F", "I", "W"] | ||
fixable = ["I"] | ||
|
||
[tool.coverage.paths] | ||
source = ["src"] | ||
|
||
[tool.coverage.run] | ||
branch = true | ||
relative_files = true | ||
|
||
[tool.coverage.report] | ||
show_missing = true | ||
fail_under = 80 |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/common/main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from {{cookiecutter.project_slug}}.api.something import a_cool_function | ||
|
||
|
||
def hello_world(): | ||
a_cool_function() | ||
return "We are here" |
2 changes: 1 addition & 1 deletion
2
tests/test_api.py → ...iecutter.project_slug}}/tests/test_api.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
{{cookiecutter.project_slug}}/tests/test_{{cookiecutter.project_slug}}.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from {{cookiecutter.project_slug}}.common.main import hello_world | ||
|
||
|
||
class TestPackage: | ||
def test_hello_world(self): | ||
assert hello_world() == "We are here" |