Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sicara/sicarator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.6.0
Choose a base ref
...
head repository: sicara/sicarator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Nov 14, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c4c99bf View commit details

Commits on Feb 26, 2024

  1. Add comment in Makefile about VIRTUAL_ENV var

    Jerome Assouline authored and Jerome Assouline committed Feb 26, 2024
    Copy the full SHA
    d6ca055 View commit details
  2. Merge pull request #81 from sicara/feature_install

    Add comment in Makefile about VIRTUAL_ENV var
    jeromeassouline authored Feb 26, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d1bfdf1 View commit details

Commits on Feb 28, 2024

  1. Fix terraform setup for GCP (#82)

    Co-authored-by: Jerome Assouline <jeromeassouline@MacBook-Air-de-Jerome.local>
    jeromeassouline and Jerome Assouline authored Feb 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9a7b494 View commit details

Commits on Jul 2, 2024

  1. fix: check files to commit even if excluded in pyproject.toml

    SimonPlaye committed Jul 2, 2024
    Copy the full SHA
    db0448f View commit details

Commits on Jul 3, 2024

  1. feat: add dot-env-plugin for env variables

    DanielRodriguezCiotti committed Jul 3, 2024
    Copy the full SHA
    5bdc107 View commit details

Commits on Jul 10, 2024

  1. update ruff commands

    agatheminaro committed Jul 10, 2024
    Copy the full SHA
    0e19405 View commit details

Commits on Jul 19, 2024

  1. Merge pull request #88 from sicara/add-dot-env-plugin

    feat: add dot-env-plugin for env variables
    jeromeassouline authored Jul 19, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    56092d3 View commit details

Commits on Jul 22, 2024

  1. Merge pull request #89 from sicara/update-linter-versions

    update: ruff commands
    CorentinBrtx authored Jul 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1885fd2 View commit details
  2. Merge pull request #86 from sicara/fix-lint-check-in-pre-commit

    fix: Inconstancy between make and pre-commit files
    CorentinBrtx authored Jul 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    826d641 View commit details
  3. Copy the full SHA
    01292e4 View commit details
  4. Format README.md file

    CorentinBrtx committed Jul 22, 2024
    Copy the full SHA
    66b7f4d View commit details

Commits on Jul 24, 2024

  1. Merge pull request #90 from sicara/add-direnv

    Add .env.example file and instructions about direnv in the README
    CorentinBrtx authored Jul 24, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1e25094 View commit details

Commits on Aug 23, 2024

  1. add: automate dvc checkout when switching of branch

    SimonPlaye committed Aug 23, 2024
    Copy the full SHA
    fc5fb65 View commit details
  2. Merge pull request #91 from sicara/add/dvc-checkout-in-pre-commit

    add: automate dvc checkout when switching of branch
    SimonPlaye authored Aug 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    86ce01d View commit details

Commits on Nov 15, 2024

  1. Copy the full SHA
    1d1c872 View commit details
  2. Update Makefile depending on package manager choice

    julienperichon committed Nov 15, 2024
    Copy the full SHA
    56c8a22 View commit details
  3. Update pyproject.toml with package manager choice

    Warning: we still have to find a solution for poetry-dotenv-plugin
    package
    julienperichon committed Nov 15, 2024
    Copy the full SHA
    d825c31 View commit details
  4. Update README.md

    julienperichon committed Nov 15, 2024
    Copy the full SHA
    eaec1c6 View commit details
  5. Update Streamlit app README.md

    julienperichon committed Nov 15, 2024
    Copy the full SHA
    7c97596 View commit details

Commits on Nov 26, 2024

  1. Fix typo in ruff rule identifier to ignore

    Julien Perichon committed Nov 26, 2024

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    562418d View commit details

Commits on Jan 8, 2025

  1. Copy the full SHA
    c2ea7c6 View commit details
  2. Copy the full SHA
    515886d View commit details
  3. feat (azure): add uv to azure ci

    tbernard01 committed Jan 8, 2025
    Copy the full SHA
    3abe2bd View commit details

Commits on Jan 16, 2025

  1. fix(index): at generation, only lock instead of syncing

    The venv is removed just after anyway, so there is no value to
    installing the venv at this stage
    julienperichon committed Jan 16, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    9da3a21 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    6a1aa78 View commit details
  3. feat(Dockerfile): add uv version of Dockerfile

    julienperichon committed Jan 16, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    8eb1fb0 View commit details

Commits on Jan 19, 2025

  1. Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    006f53d View commit details
  2. fix(formatting): resolve ruff format issues

    julienperichon committed Jan 19, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    25bfed0 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    552d1d6 View commit details
  4. Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    d1e3a0c View commit details
  5. feat(ci): update ci config to install uv before ci tests

    julienperichon committed Jan 19, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    f887dae View commit details

Commits on Jan 20, 2025

  1. docs(readme): update generator readme for requirements

    julienperichon committed Jan 20, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    1753e4a View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    368b3a4 View commit details
  3. feat(ci): add uv version of circle ci pipeline

    julienperichon committed Jan 20, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    702adea View commit details

Commits on Jan 21, 2025

  1. fix (gitlab): install make in before_script template

    tbernard01 committed Jan 21, 2025
    Copy the full SHA
    b14e9cd View commit details
  2. fix(gitlab-ci): fix comments on gitlab CI

    julienperichon committed Jan 21, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    julienperichon Julien Perichon
    Copy the full SHA
    863530d View commit details

Commits on Jan 30, 2025

  1. Copy the full SHA
    d9ce742 View commit details
  2. Merge pull request #92 from sicara/feat/migrate-to-uv

    Feat/migrate to uv
    julienperichon authored Jan 30, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6f9fd43 View commit details
  3. Merge pull request #98 from sicara/chore/update-upload-artifacts

    chore: update upload-artifacts action from v3 to v4
    m-romanenko authored Jan 30, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6d0556d View commit details
Showing with 428 additions and 158 deletions.
  1. +2 −0 .circleci/config.yml
  2. +14 −3 README.md
  3. +58 −96 __tests__/app.js
  4. +53 −21 generators/app/index.js
  5. +11 −3 generators/app/templates/api/Dockerfile
  6. +1 −0 generators/app/templates/api/src/api/main.py
  7. +1 −0 generators/app/templates/api/src/api/types.py
  8. +1 −0 generators/app/templates/api/tests/api/test_main.py
  9. +18 −2 generators/app/templates/ci/.azure-pipelines.yml
  10. +36 −0 generators/app/templates/ci/.circleci/config.yml
  11. +15 −2 generators/app/templates/ci/.github/workflows/actions/install_dependencies/action.yml
  12. +2 −2 generators/app/templates/ci/.github/workflows/tests.yml
  13. +37 −0 generators/app/templates/ci/.gitlab-ci.yml
  14. +1 −0 generators/app/templates/common/.env.example
  15. +12 −1 generators/app/templates/common/.pre-commit-config.yaml
  16. +13 −7 generators/app/templates/common/Makefile
  17. +97 −13 generators/app/templates/common/README.md
  18. +47 −7 generators/app/templates/common/pyproject.toml
  19. +1 −0 ...rators/app/templates/dvc_streamlit_example/src/streamlit_app/pages/1_📊_DVC_+_Streamlit_example.py
  20. +1 −0 generators/app/templates/dvc_streamlit_utils/src/streamlit_app/utils/selectors.py
  21. +1 −0 generators/app/templates/dvc_streamlit_utils/src/utils/dvc_utils.py
  22. +3 −0 generators/app/templates/gitignore/gitignore
  23. +1 −1 generators/app/templates/streamlit/src/streamlit_app/README.md
  24. +1 −0 generators/app/templates/streamlit/src/streamlit_app/utils/set_page_config.py
  25. +1 −0 generators/app/templates/streamlit/tests/streamlit_app/test_pages.py
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@ jobs:
- run:
name: Run jest
command: |
curl -LsSf https://astral.sh/uv/0.5.5/install.sh | env UV_UNMANAGED_INSTALL="$HOME/uv" sh
export PATH=$PATH:$HOME/uv
npm run test:ci
environment:
JEST_JUNIT_OUTPUT_DIR: ./reports/junit/
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -5,10 +5,13 @@

![Demo GIF](./demo.gif)

To know more about the story behind Sicarator and its philosophy, you can read [this blog article](https://www.sicara.fr/blog-technique/sicarator).

## Main components of the generated project

- **Python** development environment with:
- [Poetry](https://python-poetry.org/) for dependency management
- [Astral/uv](https://github.com/astral-sh/uv) (recommended) or [poetry](https://python-poetry.org/) for dependency
management
- [Pytest](https://docs.pytest.org/) for testing
- [Ruff](https://docs.astral.sh/ruff/) for static analysis & code formatting
- [Mypy](https://mypy.readthedocs.io/) for type checking
@@ -33,15 +36,23 @@

## Requirements

### Pyenv
### Astral/uv (recommended)

Install [uv](https://github.com/astral-sh/uv) to manage your Python versions, virtual environments, dependencies and
tooling configs:
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

### Pyenv (if not using uv)

Install [pyenv](https://github.com/pyenv/pyenv) to manage your Python versions and virtual environments:
```bash
curl -sSL https://pyenv.run | bash
```
*If you are on MacOS and experiencing errors on Python install with PyEnv, follow this [comment](https://github.com/pyenv/pyenv/issues/1740#issuecomment-738749988)*

### Poetry
### Poetry (if not using uv)

Install [Poetry](https://python-poetry.org) to manage your dependencies and tooling configs:
```bash
154 changes: 58 additions & 96 deletions __tests__/app.js
Original file line number Diff line number Diff line change
@@ -55,6 +55,7 @@ const GCP_PROJECT_ID = "gcp-project-id";
const GCP_REGION = "us-west1";

const DEFAULT_ANSWERS = {
packageManager: "pyenv + poetry",
pythonVersion: LAST_PYTHON_VERSION,
includeApi: false,
apiInfrastructure: null,
@@ -82,6 +83,9 @@ const GCP_INFRA_ANSWERS = {
gcpProjectId: GCP_PROJECT_ID,
gcpRegion: GCP_REGION
};
const UV_PACKAGE_MANAGER_ANSWERS = {
packageManager: "astral/uv"
};

describe("generator-sicarator:app", () => {
describe.each([
@@ -133,6 +137,11 @@ describe("generator-sicarator:app", () => {
...ALL_OPTIONS_EXCEPT_INFRA_ANSWERS,
...GCP_INFRA_ANSWERS
},
{
description: "uv package manager",
...DEFAULT_ANSWERS,
...UV_PACKAGE_MANAGER_ANSWERS
},
{
description: "Python 3.10 (all options & AWS infra)",
...DEFAULT_ANSWERS,
@@ -143,6 +152,7 @@ describe("generator-sicarator:app", () => {
])(
"Generate project with $description",
({
packageManager,
pythonVersion,
includeApi,
apiInfrastructure,
@@ -160,6 +170,7 @@ describe("generator-sicarator:app", () => {
.run(path.join(__dirname, "../generators/app"))
.withPrompts({
projectName: PROJECT_NAME,
packageManager,
pythonVersion,
includeApi,
apiInfrastructure,
@@ -174,51 +185,26 @@ describe("generator-sicarator:app", () => {
})
.withLocalConfig({})
.on("end", () => {
exec("make install", (error, stdout, stderr) => {
if (stdout) {
console.log(`stdout:\n ${stdout}`);
}

if (stderr) {
console.log(`stderr:\n ${stderr}`);
}

if (error) {
done(error);
} else {
done();
}
});
exec("make install", defaultCallback(done));
});
});

afterAll(done => {
exec(
`pyenv virtualenv-delete --force ${PROJECT_SLUG}`,
(error, stdout, stderr) => {
if (stdout) {
console.log(`stdout:\n ${stdout}`);
}

if (stderr) {
console.log(`stderr:\n ${stderr}`);
}

if (error) {
done(error);
} else {
done();
}
}
);
let cleanVirtualenvCommand =
packageManager === "pyenv + poetry"
? `pyenv virtualenv-delete --force ${PROJECT_SLUG}`
: "rm -rf .venv/";
exec(cleanVirtualenvCommand, defaultCallback(done));
});

it("creates common files", () => {
assert.file(COMMON_FILES_PATHS);
});

it("creates poetry.lock", () => {
assert.file("poetry.lock");
it("creates lock file", () => {
let lockfile =
packageManager === "pyenv + poetry" ? "poetry.lock" : "uv.lock";
assert.file(lockfile);
});

it("creates .gitignore", () => {
@@ -294,7 +280,11 @@ describe("generator-sicarator:app", () => {
});

it("has correct Python version", () => {
assert.fileContent("pyproject.toml", `python = "${pythonVersion}"`);
if (packageManager === "pyenv + poetry") {
assert.fileContent("pyproject.toml", `python = "${pythonVersion}"`);
} else {
assert.fileContent("pyproject.toml", `python = "==${pythonVersion}"`);
}
});

it("has correct terraform backend bucket name", () => {
@@ -327,84 +317,38 @@ describe("generator-sicarator:app", () => {

it("runs unit tests successfully", done => {
if (includeHelloWorld || includeApi || includeStreamlit) {
execInPyenvVenv("make test", (error, stdout, stderr) => {
if (stdout) {
console.log(`stdout:\n ${stdout}`);
}

if (stderr) {
console.log(`stderr:\n ${stderr}`);
}

if (error) {
done(error);
} else {
done();
}
});
execInVenv("make test", packageManager, defaultCallback(done));
} else {
// No tests to run
done();
}
});

it("runs linter successfully", done => {
execInPyenvVenv("make lint-check", (error, stdout, stderr) => {
if (stdout) {
console.log(`stdout:\n ${stdout}`);
}

if (stderr) {
console.log(`stderr:\n ${stderr}`);
}

if (error) {
done(error);
} else {
done();
}
});
execInVenv("make lint-check", packageManager, defaultCallback(done));
});

it("runs type checking successfully", done => {
execInPyenvVenv("make type-check", (error, stdout, stderr) => {
if (stdout) {
console.log(`stdout:\n ${stdout}`);
}

if (stderr) {
console.log(`stderr:\n ${stderr}`);
}

if (error) {
done(error);
} else {
done();
}
});
execInVenv("make type-check", packageManager, defaultCallback(done));
});

it("runs formatting check successfully", done => {
execInPyenvVenv("make format-check", (error, stdout, stderr) => {
if (stdout) {
console.log(`stdout:\n ${stdout}`);
}

if (stderr) {
console.log(`stderr:\n ${stderr}`);
}

if (error) {
done(error);
} else {
done();
}
});
execInVenv("make format-check", packageManager, defaultCallback(done));
});
}
);
});

function execInVenv(command, packageManager, callback) {
if (packageManager === "pyenv + poetry") {
execInPyenvVenv(command, callback);
} else {
exec(command, { env: { ...process.env } }, (error, stdout, stderr) => {
callback(error, stdout, stderr);
});
}
}

function execInPyenvVenv(command, callback) {
// Execute 'pyenv prefix' command to get the venv path
exec("pyenv prefix", (error, stdout, stderr) => {
@@ -436,3 +380,21 @@ function execInPyenvVenv(command, callback) {
);
});
}

function defaultCallback(done) {
return (error, stdout, stderr) => {
if (stdout) {
console.log(`stdout:\n ${stdout}`);
}

if (stderr) {
console.log(`stderr:\n ${stderr}`);
}

if (error) {
done(error);
} else {
done();
}
};
}
74 changes: 53 additions & 21 deletions generators/app/index.js
Original file line number Diff line number Diff line change
@@ -80,6 +80,28 @@ module.exports = class extends Generator {
default: this.user.git.email(),
store: true
},
{
name: "packageManager",
message: `${mainMessage(
"Which package manager do you want to use?"
)}${infoMessage(
`astral/uv (${chalk.underline(
"https://github.com/astral-sh/uv"
)}) is much more powerful and simple than pyenv + poetry, but has not been tested on a project yet.`
)}`,
type: "list",
default: "pyenv + poetry",
choices: [
{
name: "pyenv + poetry",
value: "pyenv + poetry"
},
{
name: "astral/uv",
value: "astral/uv"
}
]
},
{
name: "pythonVersion",
message: `${mainMessage(
@@ -91,7 +113,7 @@ module.exports = class extends Generator {
"https://pyreadiness.org/"
)}.`
)}${infoMessage(
"If the chosen version is not installed on your machine, it will be automatically installed by PyEnv."
"If the chosen version is not installed on your machine, it will be automatically installed by PyEnv or uv."
)}`,
type: "list",
default: "3.11.6",
@@ -515,25 +537,35 @@ module.exports = class extends Generator {
}

install() {
this.spawnCommandSync("pyenv", [
"install",
this.answers.pythonVersion,
"--skip-existing"
]);
if (this.answers.packageManager === "pyenv + poetry") {
this.spawnCommandSync("pyenv", [
"install",
this.answers.pythonVersion,
"--skip-existing"
]);

this.log(
`Generating Poetry lock file in a ${chalk.cyan.italic(
"temporary"
)} virtual environment ${chalk.cyan(this.answers.projectSlug)}`
);
this.spawnCommandSync("poetry", ["lock"], {
env: {
...process.env,
PYENV_VERSION: this.answers.pythonVersion, // Allow Poetry to find the correct Python version
POETRY_VIRTUALENVS_IN_PROJECT: 1 // Allow to easily delete the .venv, see below
}
});
} else {
this.log(
`Generating uv lock file in a ${chalk.cyan.italic(
"temporary"
)} virtual environment ${chalk.cyan(this.answers.projectSlug)}`
);
this.spawnCommandSync("uv", ["lock"]);
}

this.log(
`Generating Poetry lock file in a ${chalk.cyan.italic(
"temporary"
)} virtual environment ${chalk.cyan(this.answers.projectSlug)}`
);
this.spawnCommandSync("poetry", ["lock"], {
env: {
...process.env,
PYENV_VERSION: this.answers.pythonVersion, // Allow Poetry to find the correct Python version
POETRY_VIRTUALENVS_IN_PROJECT: 1 // Allow to easily delete the .venv, see below
}
});
// Delete Poetry environment, because the developer will create its own Pyenv environment when installing the project
// Delete virtual environment, because the developer will create their own when installing the project
this.log(
`Deleting ${chalk.cyan.italic(
"temporary"
@@ -542,8 +574,8 @@ module.exports = class extends Generator {
this.log(
infoMessage(
`You will create a new ${chalk.bold.italic(
"pyenv"
)} environment during project installation (see generated README.md).`,
"virtual environment"
)} during project installation (see generated README.md).`,
0,
false
)
Loading