diff --git a/images/commits_by_year_flit.png b/images/commits_by_year_flit.png new file mode 100644 index 0000000000000000000000000000000000000000..6a3e2b4068a6784b12f7a05559c080bb1b12e369 Binary files /dev/null and b/images/commits_by_year_flit.png differ diff --git a/images/commits_by_year_hatch.png b/images/commits_by_year_hatch.png new file mode 100644 index 0000000000000000000000000000000000000000..cb020d52c84a1278fe93d408ee88ba01d53a015e Binary files /dev/null and b/images/commits_by_year_hatch.png differ diff --git a/images/commits_by_year_pdm.png b/images/commits_by_year_pdm.png new file mode 100644 index 0000000000000000000000000000000000000000..47e0d0f26f999df86d5f97fbcd552360b4f7e2cb Binary files /dev/null and b/images/commits_by_year_pdm.png differ diff --git a/images/commits_by_year_poetry.png b/images/commits_by_year_poetry.png new file mode 100644 index 0000000000000000000000000000000000000000..0c008838586c6d4a186c177f782f2d81206095de Binary files /dev/null and b/images/commits_by_year_poetry.png differ diff --git a/images/commits_by_year_setuptools.png b/images/commits_by_year_setuptools.png new file mode 100644 index 0000000000000000000000000000000000000000..feb078e0781f3c10bba615dfa195e5772e47deb2 Binary files /dev/null and b/images/commits_by_year_setuptools.png differ diff --git a/images/python-backends-2018-2023-log-scale.r.png b/images/python-backends-2018-2023-log-scale.r.png new file mode 100644 index 0000000000000000000000000000000000000000..801fcd91d4d2050eadbccbee4bae68b85a9b5de9 Binary files /dev/null and b/images/python-backends-2018-2023-log-scale.r.png differ diff --git a/images/python-backends-2018-2023.r.png b/images/python-backends-2018-2023.r.png new file mode 100644 index 0000000000000000000000000000000000000000..ea1cd2077042ab6dbf9597fbf178360785c374a9 Binary files /dev/null and b/images/python-backends-2018-2023.r.png differ diff --git a/versionner-un-code-python.qmd b/versionner-un-code-python.qmd index 5a69a81f18a1438be34bbed305a4e5c12bb07baf..6cee3589938d771ab883fb0dc4824532a6ea38c0 100644 --- a/versionner-un-code-python.qmd +++ b/versionner-un-code-python.qmd @@ -981,15 +981,34 @@ utiliser. > for packaging. `Flit` can generate a configuration file to quickly set up a > simple project, build source distributions and wheels, and upload them to `PyPI`. -`Flit` est un outil récent ^[Post [PEP 518](https://peps.python.org/pep-0518/)] -et simple pour générer des packages pur Python : sans compilation de code C, -sans intégration de JavaScript, ... +`Flit` est un outil récent ^[Cependant c'est un outil créé avant les +[PEP 517](https://peps.python.org/pep-0517/), +[PEP 621](https://peps.python.org/pep-0621/) et +[PEP 660](https://peps.python.org/pep-0660/), cf +[issue 522](https://github.com/pypa/flit/issues/522)] et simple pour générer +des packages pur Python : sans compilation de code C, sans intégration de +JavaScript, ... `Flit` ne gère pas les dépendances. `Flit` ne gère pas les environnements virtuels. -`Flit` dépendrait d'un seul développeur ? +`Flit` ne veut pas gérer d'identifiant de version dynamique à partir des `tags +git` ^[[RFE: functionality to set __version__ from scm automatically](https://github.com/pypa/flit/issues/257)] + +`Flit` a un contributeur majeur (cf "Statistiques sur le code") + +::: {.notes} +À surveiller : + +- 540 [Document what flit_core includes in a sdist](https://github.com/pypa/flit/issues/540) +- 522 [Discussion: future shape of the 'flit' command](https://github.com/pypa/flit/issues/522) + Flit came about in a very different world, before various standards defined + how packaging tools should work together (in particular, PEPs 517, 621 and + 660). A lot of design decisions I took back then don't really fit with the + world we have now, and I don't have a strong sense of how they should be + reconciled. So, let's have a discussion. +::: ## backend : Flit 2/3 @@ -1090,9 +1109,9 @@ mis en avant par la [Python Packaging Authority](https://www.pypa.io/) dans sa d [Poetry](https://python-poetry.org/) et <br/> [Pipenv](https://pipenv.pypa.io/en/latest/) ^[Par contre, `Pipenv` ne génère pas de packages Python] -Je n'ai pas vu comment `Hatch` gérait les dépendances. +`Hatch` ne gère pas les dépendances. -`Hatch` dépendrait d'un seul développeur ? +`Hatch` a un contributeur majeur (cf "Statistiques sur le code") ## backend : Hatch 2/2 @@ -1292,7 +1311,7 @@ comme **backend de build**. `Poetry` est un outil apprécié par la communauté. -Créé avec les [PEP 518](https://peps.python.org/pep-0518/) et +Créé avant les [PEP 518](https://peps.python.org/pep-0518/) et [PEP 621](https://peps.python.org/pep-0621/), il n'était pas en conformité avec ces nouveaux standards. Et maintenant ? @@ -1302,8 +1321,6 @@ ces nouveaux standards. Et maintenant ? `Poetry` n'est pas un projet de la [Python Packaging Authority](https://www.pypa.io/). -`Poetry` dépendrait d'un seul développeur ? - ## backend : PDM [PDM](https://pdm-project.org/) est mis en avant ^[[pyOpenSci Packaging @@ -1314,9 +1331,9 @@ and is funded by the [Sloan Foundation](https://sloan.org/)] pour le peer review Open Science. En fait, `PDM` est à la fois un **frontend** et un **backend** ce qui était le -cas de `setuptools` et peut prêter à confusion ^[[My User Experience Porting Off +cas de `setuptools` et pourrait prêter à confusion ^[[My User Experience Porting Off setup.py](https://discuss.python.org/t/user-experience-with-porting-off-setup-py/37502/66) -sur [discuss.python.org](https://discuss.python.org/)]. +sur [discuss.python.org](https://discuss.python.org/) ... mais c'est aussi le cas de `Flit` et `Hatch`]. Le projet semble très actif 2500 commits avec beaucoup de contributeurs. Cependant 1789 commits / 2500 sont faits par [un unique contributeur](https://github.com/frostming). @@ -1331,6 +1348,21 @@ permettant un fonctionnement proche de [npm](https://docs.npmjs.com/about-npm). Est-il raisonnable d'adopter un usage sur une spécification rejetée ? ::: +## frontend / backend : une vraie séparation ? + +Un post sur le forum packaging souligne que `PDM` est à la fois un `backend` et +un `frontend` ^[[My User Experience Porting Off setup.py](https://discuss.python.org/t/user-experience-with-porting-off-setup-py/37502/66) +sur [discuss.python.org](https://discuss.python.org/)]. + +C'est également le cas pour `Flit`, créé avant l'élaboration des spécifications +`PEP 517`, `PEP 621`, etc + +Ce qui ennuyeux c'est que `flit build` ne produise pas les mêmes packages +que `python -m build` ^[[Discussion: future shape of the 'flit' command](https://github.com/pypa/flit/issues/522)] + +`Hatch` peut également se comporter en `frontend` puisqu'il propose également +une [commande `build`](https://hatch.pypa.io/latest/build/). + ## Comparaison des backends Le [Scientific Python Library Development Guide](https://learn.scientific-python.org/development/), @@ -1355,11 +1387,11 @@ communauté  -## Statistiques sur le code +## Statistiques sur le code 1/2 +```{.txt} Statistiques de commits -```{.txt} | backend | Premier commit | dernier commit | nb commits | nb commit | nb authors | | | | | | per active day | | | ---------- | -------------- | -------------- | ---------- | -------------- | ---------- | @@ -1367,25 +1399,89 @@ Statistiques de commits | Hatch | 2021-12-29 | 2023-11-13 | 669 | 2.8 | 42 | | setuptools | 1998-12-18 | 2023-11-15 | 14175 | 4.5 | 603 | | PDM | 2019-12-27 | 2023-10-16 | 2501 | 3.4 | 154 | -``` +| Poetry | 2018-02-20 | 2023-11-21 | 3017 | 3.0 | 510 | Principaux contributeurs -```{.txt} -| Flit | Hatch | setuptools | PDM | -| ----------------------- | ----------------------------- | ------------------------ | ------------------------ | -| auteur 1 : 879 (74.62%) | auteur 1 : 590 (88.19%) | auteur 1 : 6094 (42.99%) | auteur 1 : 1916 (76.61%) | -| auteur 2 : 46 (3.90%) | auteur 2 (bot) : 12 (1.79%) | auteur 2 : 1423 (10.04%) | idem : 175 (7.00%) | -| auteur 3 : 26 (2.21%) | auteur 3 : 12 (1.79%) | auteur 3 : 632 (4.46%) | auteur 3 : 53 (2.12%) | -632 (4.46%) +| Flit | Hatch | setuptools | PDM | Poetry | +| ---------------- | ---------------------- | ----------------- | -------------------- | ----------------- | +| 1 : 879 (74.62%) | 1 : 590 (88.19%) | 1 : 6094 (42.99%) | 1 : 1916 (76.61%) | 1 : 1049 (34.77%) | +| 2 : 46 (3.90%) | 2 (bot) : 12 (1.79%) | 2 : 1423 (10.04%) | idem : 175 (7.00%) | 2 : 346 (11.47%) | +| 3 : 26 (2.21%) | 3 : 12 (1.79%) | 3 : 632 (4.46%) | 3 : 53 (2.12%) | 3 : 162 (5.37%) | + +Date de leur dernier commit + +| Flit | Hatch | setuptools | PDM | Poetry | +| -------------- | -------------------- | -------------- | ----------------- | -------------- | +| 1 : 2023-11-08 | 1 : 2023-11-13 | 1 : 2023-10-08 | 1 : 2023-11-13 | 1 : 2022-09-18 | +| 2 : 2023-11-10 | 2 (bot) : 2023-10-08 | 2 : 2023-10-16 | idem : 2020-09-04 | 2 : 2022-06-10 | +| 3 : 2021-03-01 | 3 : 2023-04-02 | 3 : 2001-08-23 | 3 : 2021-05-05 | 3 : 2023-11-19 | ``` ::: aside - Données gitstats sur les dépôts le 2023-11-15 -- TODO : Ajouter Poetry +- Poetry ajouté le 2023-11-22 +::: + +## Statistiques sur le code 2/2 + +:::: {.columns} + +::: {.column width="50%"} + +Flit + +{title="Flit" height="140"} + +Hatch + +{title="Hatch" height="140"} + +setuptools + +{title="setuptools" height="140"} + ::: +::: {.column width="50%"} + +PDM + +{title="PDM" height="140"} + +Poetry + +{title="Poetry" height="140"} + +::: + +:::: + +::: {.notes} +https://quarto.org/docs/authoring/figures.html#figure-panels + +layout-ncol=2 layout-nrow=3 + +{title="Flit" height="120"} +{title="PDM" height="120"} +{title="Hatch" height="120"} +{title="Poetry" height="120"} +{title="setuptools" height="120"} +::: + +## Statistiques PyPI 1/2 + +Extraire les backends utilisés dans le fichier `pyproject.toml` grâce aux +indications et au script proposés dans l'article +[Querying every file in every release on the Python Package Index](https://sethmlarson.dev/security-developer-in-residence-weekly-report-18) + + + +## Statistiques PyPI - log scale 2/2 + + + # Librairies de gestion de l'identifiant de version Il existe des librairies qui récupèrent le **tag** pour le définir @@ -1586,7 +1682,7 @@ Si des packages ont été manuellement installés dans l'environnement et qu'ils ne sont pas présents dans le fichier `requirements.txt`, ils seront désinstallés. ::: -## Doit-on committer son requirements.txt ? +## Gestion des dépendances : committer requirements.txt ? La question est posée dans une [issue pip-tools 1838](https://github.com/jazzband/pip-tools/issues/1838) @@ -1594,6 +1690,9 @@ Il est certains que si les utilisateurs d'un projet ont des environnements différents, un seul requirements.txt (ou xxx.lock) ne peut pas être appliqué pour tous. +::: {.notes} +J'avais trouvé une pratique intéressante mais je ne sais plus où :/ +::: ## Workflow de tag 1/2 @@ -1611,15 +1710,82 @@ Avec ces plugin de récupération de tag dans `git`, quel est le bon workflow à À quel moment faut-il taguer dans le processus de publication de package ? ::: -## Template de projet 1/3 +## Template de projet 1/4 Le [Scientific Python Library Development Guide](https://learn.scientific-python.org/development/), propose des templates de projet très riches à utiliser au choix avec [copier](https://copier.readthedocs.io/en/stable/), -[cookiecutter](https://cookiecutter.readthedocs.io/) ou [cruft](https://cruft.github.io/cruft/). +[cookiecutter](https://cookiecutter.readthedocs.io/) ou [cruft](https://cruft.github.io/cruft/). +Exemple avec `cookiecutter` : + +```{.bash code-line-numbers="1,13,19,26"} +$ cookiecutter gh:scientific-python/cookie + [1/9] The name of your project (package): my_scientific_package + [2/9] The name of your (GitHub?) org (org): fconil + [3/9] The url to your GitHub or GitLab repository (https://github.com/fconil/my_scientific_package): + [4/9] Your name (My Name): Françoise CONIL + [5/9] Your email (me@email.com): fcodvpt@gmail.com + [6/9] A short description of your project (A great package.): Testing the scientific templates for different backends + [7/9] Select a license + 1 - BSD + 2 - Apache + 3 - MIT + Choose from [1/2/3] (1): + [8/9] Choose a build backend + 1 - Hatchling - Pure Python (recommended) + 2 - Flit-core - Pure Python (minimal) + 3 - PDM-backend - Pure Python + 4 - Whey - Pure Python + 5 - Poetry - Pure Python + 6 - Setuptools with pyproject.toml - Pure Python + 7 - Setuptools with setup.py - Pure Python + 8 - Setuptools and pybind11 - Compiled C++ + 9 - Scikit-build-core - Compiled C++ (recommended) + 10 - Meson-python - Compiled C++ (also good) + 11 - Maturin - Compiled Rust (recommended) + Choose from [1/2/3/4/5/6/7/8/9/10/11] (1): 6 + [9/9] Use version control for versioning [y/n] (y): +``` -J'ai fait un test avec `cookiecutter`, avec un template qui utilise -[setuptools_scm](https://setuptools-scm.readthedocs.io/). Le `pyproject.toml` -référence un fichier `_version.py` +## Template de projet 2/4 + +Contenu du projet généré ^[Voir les [templates Scientific-Python Development Guide](https://github.com/scientific-python/cookie) et leur utilisation] : + +```{.bash} +└── my_scientific_package + ├── docs + │  ├── conf.py + │  └── index.md + ├── .git_archival.txt + ├── .gitattributes + ├── .github + │  ├── CONTRIBUTING.md + │  ├── dependabot.yml + │  ├── matchers + │  │  └── pylint.json + │  └── workflows + │  ├── cd.yml + │  └── ci.yml + ├── .gitignore + ├── LICENSE + ├── noxfile.py + ├── .pre-commit-config.yaml + ├── pyproject.toml + ├── README.md + ├── .readthedocs.yml + ├── src + │  └── my_scientific_package + │  ├── __init__.py + │  ├── py.typed + │  └── _version.pyi + └── tests + └── test_package.py +``` + +## Template de projet 3/4 + +Ayant demandé d'utiliser les informations du gestionnaire de version pour +l'identifiant de version. Le template utilise [setuptools_scm](https://setuptools-scm.readthedocs.io/). +Le `pyproject.toml` référence un fichier `_version.py` ```{.toml} [tool.setuptools_scm] @@ -1628,7 +1794,7 @@ write_to = "src/example/_version.py" ignoré par le `.gitignore` du template -```{.git} +```{.txt} # setuptools_scm src/*/_version.py ``` @@ -1648,9 +1814,9 @@ ce seraient des `stub files` pour les controleurs de types statiques : [stub fil [stub files dans la mypy](https://mypy.readthedocs.io/en/stable/stubs.html) ::: -## Template de projet 2/3 +## Template de projet 4/4 -Le fichier généré `src/example/_version.py` +`setuptools_scm` génère `src/example/_version.py` au build. ```{.python} # file generated by setuptools_scm @@ -1671,34 +1837,423 @@ __version__ = version = '0.0.1' __version_tuple__ = version_tuple = (0, 0, 1) ``` -Il n'est pas géré par `git`, et les packages ont bien le tag +les packages ont bien l'identifiant de version correspondant au tag -```{.bash} +```{.bash code-line-numbers="1,3,9"} $ git tag -l -n 0.0.1 Initial release - $ git status Sur la branche main Fichiers non suivis: (utilisez "git add <fichier>..." pour inclure dans ce qui sera validé) .pre-commit-config.yaml - $ ls dist/ example-0.0.1-py3-none-any.whl example-0.0.1.tar.gz ``` ::: {.notes} -Projet généré et testé dans `/tmp`, donc à recommencer si on veut garder une trace. +C'est trop cool et cela amène plein de connaissances et des idées de bonnes +pratiques ! ::: -## Template de projet 3/3 +## Différences de génération de packages entre backends : wheel -C'est trop cool et cela amène plein de connaissances et des idées de bonnes -pratiques ! +:::: {.columns} -Mettre la génération avec `cookiecutter`. +::: {.column width="50%"} + +Flit + +```{.bash code-line-numbers="7"} +├── my_scientific_package +│  ├── __init__.py +│  ├── py.typed +│  ├── _version.py +│  └── _version.pyi +├── my_scientific_package-0.0.2.dist-info +│  ├── LICENSE +│  ├── METADATA (*) +│  ├── RECORD (*) +│  └── WHEEL (*) +``` -## towncrier pour créer des changelogs +setuptools + +```{.bash code-line-numbers="7,10"} +├── my_scientific_package +│  ├── __init__.py +│  ├── py.typed +│  ├── _version.py +│  └── _version.pyi +├── my_scientific_package-0.0.2.dist-info +│  ├── LICENSE +│  ├── METADATA (*) +│  ├── RECORD (*) +│  ├── top_level.txt +│  └── WHEEL (*) +``` + +::: + +::: {.column width="50%"} + +Hatch + +```{.bash code-line-numbers="7-8"} +├── my_scientific_package +│  ├── __init__.py +│  ├── py.typed +│  ├── _version.py +│  └── _version.pyi +├── my_scientific_package-0.0.2.dist-info +│  ├── licenses +│  │  └── LICENSE +│  ├── METADATA (*) +│  ├── RECORD (*) +│  └── WHEEL (*) +``` + +::: {.callout-note title="(*)"} +Différences dues : + +- à des hash (RECORD), +- à la présence du nom backend utilisé (WHEEL) +- à l'ordre des lignes (METADATA) à vérifier cependant. Hath et setuptools + incluent le texte de la licence. +::: + +::: + +:::: + +::: aside +Sur la base de projets générés avec [cookiecutter](https://cookiecutter.readthedocs.io) et les +[templates Scientific-Python Development Guide](https://github.com/scientific-python/cookie) +::: + +## Différences de génération de packages entre backends : sdist 1/2 + +:::: {.columns} + +Packages générés par `python -m build` ^[[Document what flit_core includes in a sdist](https://github.com/pypa/flit/issues/540)]. + +::: {.column width="50%"} +Flit + +```{.bash code-line-numbers="1-11"} +├── my_scientific_package-0.0.2 +│  ├── LICENSE +│  ├── PKG-INFO +│  ├── pyproject.toml +│  ├── README.md +│  └── src +│  └── my_scientific_package +│  ├── __init__.py +│  ├── py.typed +│  ├── _version.py +│  └── _version.pyi +``` +::: + +::: {.column width="50%"} +Hatch + +```{.bash code-line-numbers="2-15,17,19,22,29,30"} +├── my_scientific_package-0.0.2 +│  ├── docs +│  │  ├── conf.py +│  │  └── index.md +│  ├── .git_archival.txt +│  ├── .gitattributes +│  ├── .github +│  │  ├── CONTRIBUTING.md +│  │  ├── dependabot.yml +│  │  ├── matchers +│  │  │  └── pylint.json +│  │  └── workflows +│  │  ├── cd.yml +│  │  └── ci.yml +│  ├── .gitignore +│  ├── LICENSE +│  ├── noxfile.py +│  ├── PKG-INFO +│  ├── .pre-commit-config.yaml +│  ├── pyproject.toml +│  ├── README.md +│  ├── .readthedocs.yml +│  ├── src +│  │  └── my_scientific_package +│  │  ├── __init__.py +│  │  ├── py.typed +│  │  ├── _version.py +│  │  └── _version.pyi +│  └── tests +│  └── test_package.py +``` +::: + +:::: + +::: {.notes} +Ce qui est identique entre Flit et Hatch : code-line-numbers="1,16,18,20,21,23-28" +::: + +## Différences de génération de packages entre backends : sdist 2/2 + +:::: {.columns} + +Packages générés par `python -m build`. + +::: {.column width="50%"} +setuptools + +```{.bash code-line-numbers="23,30-35"} +├── my_scientific_package-0.0.2 +│  ├── docs +│  │  ├── conf.py +│  │  └── index.md +│  ├── .git_archival.txt +│  ├── .gitattributes +│  ├── .github +│  │  ├── CONTRIBUTING.md +│  │  ├── dependabot.yml +│  │  ├── matchers +│  │  │  └── pylint.json +│  │  └── workflows +│  │  ├── cd.yml +│  │  └── ci.yml +│  ├── .gitignore +│  ├── LICENSE +│  ├── noxfile.py +│  ├── PKG-INFO +│  ├── .pre-commit-config.yaml +│  ├── pyproject.toml +│  ├── README.md +│  ├── .readthedocs.yml +│  ├── setup.cfg +│  ├── src +│  │  ├── my_scientific_package +│  │  │  ├── __init__.py +│  │  │  ├── py.typed +│  │  │  ├── _version.py +│  │  │  └── _version.pyi +│  │  └── my_scientific_package.egg-info +│  │  ├── dependency_links.txt +│  │  ├── PKG-INFO +│  │  ├── requires.txt +│  │  ├── SOURCES.txt +│  │  └── top_level.txt +│  └── tests +│  └── test_package.py +``` +::: + +::: {.column width="50%"} +Hatch + +```{.bash code-line-numbers="1-30"} +├── my_scientific_package-0.0.2 +│  ├── docs +│  │  ├── conf.py +│  │  └── index.md +│  ├── .git_archival.txt +│  ├── .gitattributes +│  ├── .github +│  │  ├── CONTRIBUTING.md +│  │  ├── dependabot.yml +│  │  ├── matchers +│  │  │  └── pylint.json +│  │  └── workflows +│  │  ├── cd.yml +│  │  └── ci.yml +│  ├── .gitignore +│  ├── LICENSE +│  ├── noxfile.py +│  ├── PKG-INFO +│  ├── .pre-commit-config.yaml +│  ├── pyproject.toml +│  ├── README.md +│  ├── .readthedocs.yml +│  ├── src +│  │  └── my_scientific_package +│  │  ├── __init__.py +│  │  ├── py.typed +│  │  ├── _version.py +│  │  └── _version.pyi +│  └── tests +│  └── test_package.py +``` +::: + +:::: + +## Différences de génération entre flit frontend et build: sdist + +:::: {.columns} + +::: {.column width="50%"} +`sdist` généré par `python -m build`. + +```{.bash} +├── my_project-0.0.1 +│  ├── LICENSE +│  ├── PKG-INFO +│  ├── pyproject.toml +│  ├── README.md +│  └── src +│  └── my_project +│  └── __init__.py +``` +::: + +::: {.column width="50%"} +`sdist` généré par `flit build`. + +```{.bash code-line-numbers="2-5,13-14"} +├── my_project-0.0.1 +│  ├── docs +│  │  ├── conf.py +│  │  └── index.rst +│  ├── .gitignore +│  ├── LICENSE +│  ├── PKG-INFO +│  ├── pyproject.toml +│  ├── README.md +│  ├── src +│  │  └── my_project +│  │  └── __init__.py +│  └── tests +│  └── test_package.py +``` +::: + +:::: + +:::: {.columns} + +::: {.column width="50%"} +```{.bash code-line-numbers="1-2"} +$ python -m build +* Creating venv isolated environment... +* Installing packages in isolated environment... (flit_core >=3.2,<4) +* Getting build dependencies for sdist... +* Building sdist... +* Building wheel from sdist +* Creating venv isolated environment... +* Installing packages in isolated environment... (flit_core >=3.2,<4) +* Getting build dependencies for wheel... +* Building wheel... +Successfully built my_project-0.0.1.tar.gz and my_project-0.0.1-py3-none-any.whl +``` +::: + +::: {.column width="50%"} +```{.bash code-line-numbers="1-2"} +$ flit build +Found 8 files tracked in git I-flit.sdist +Built sdist: dist/my_project-0.0.1.tar.gz I-flit_core.sdist +Copying package file(s) from /tmp/tmpwbdpows6/my_project-0.0.1/src/my_project I-flit_core.wheel +Writing metadata files I-flit_core.wheel +Writing the record of files I-flit_core.wheel +Built wheel: dist/my_project-0.0.1-py3-none-any.whl I-flit_core.wheel +``` + +Génération sur [ce squelette](https://gitlab.liris.cnrs.fr/fconil-small-programs/python/project-templates/flit-skeleton/-/tree/0.0.1) de projet. +::: + +:::: + +## Différences de génération entre hatch frontend et build 1/2 + +:::: {.columns} + +Aucune différence entre le `sdist` généré par `python -m build` et le `sdist` +généré par `hatch build`. + +::: {.column width="50%"} + +```{.bash} +├── my_project-0.0.1 +│  ├── docs +│  │  ├── conf.py +│  │  └── index.rst +│  ├── .gitignore +│  ├── LICENSE +│  ├── PKG-INFO +│  ├── pyproject.toml +│  ├── README.md +│  ├── src +│  │  └── my_project +│  │  └── __init__.py +│  └── tests +│  └── test_package.py +``` +::: + +::: {.column width="50%"} +```{.bash} +├── my_project-0.0.1 +│  ├── docs +│  │  ├── conf.py +│  │  └── index.rst +│  ├── .gitignore +│  ├── LICENSE +│  ├── PKG-INFO +│  ├── pyproject.toml +│  ├── README.md +│  ├── src +│  │  └── my_project +│  │  └── __init__.py +│  └── tests +│  └── test_package.py +``` +::: + +:::: + +:::: {.columns} + +::: {.column width="50%"} +```{.bash code-line-numbers="1-2"} +$ python -m build +* Creating virtualenv isolated environment... +* Installing packages in isolated environment... (hatchling) +* Getting build dependencies for sdist... +* Building sdist... +* Building wheel from sdist +* Creating virtualenv isolated environment... +* Installing packages in isolated environment... (hatchling) +* Getting build dependencies for wheel... +* Building wheel... +Successfully built my_project-0.0.1.tar.gz and my_project-0.0.1-py3-none-any.whl +``` +::: + +::: {.column width="50%"} +```{.bash code-line-numbers="1-3"} +$ hatch build +[sdist] +dist/my_project-0.0.1.tar.gz + +[wheel] +dist/my_project-0.0.1-py3-none-any.whl +``` +::: + +:::: + +## Différences de génération entre hatch frontend et build 2/2 + +`hatch build` affiche message transitoirement sur une ligne `... building environment`. + +Si on déplace les packages qui ont été générés dans `dist`, et que l'on exécute +`hatch build` à nouveau cette ligne n'est plus affichée comme si +l'environnement était encore actif quelque part et avait une trace du type +"rien n'a changé" (les fichiers sont regénérés à l'identique). + +On ne sait pas où cette information et ces données sont stockées. + +## changelogs : towncrier [towncrier](https://towncrier.readthedocs.io/en/stable/index.html) semble servir à créer des `changelogs`. @@ -1707,3 +2262,7 @@ servir à créer des `changelogs`. Used by Twisted, pytest, pip, BuildBot, and attrs, among others. ::: +## Dépôt GitHub de fichiers `.gitignore` + +[.gitignore Python](https://github.com/github/gitignore/blob/main/Python.gitignore) +