Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More docs? #6

Open
yajo opened this issue Sep 21, 2023 · 14 comments
Open

More docs? #6

yajo opened this issue Sep 21, 2023 · 14 comments
Labels
documentation Improvements or additions to documentation

Comments

@yajo
Copy link
Contributor

yajo commented Sep 21, 2023

Hey there, I was looking on how to use this, but there are absolutely no docs... Would you mind adding at least something basic?

@sbidoul
Copy link
Owner

sbidoul commented Sep 21, 2023

Yep yep, that will come before November.

@sbidoul
Copy link
Owner

sbidoul commented Sep 22, 2023

@yajo I added some basic info in the README. More to come in the coming weeks.

@yajo
Copy link
Contributor Author

yajo commented Sep 22, 2023

Hey, thanks a lot!

I've been reviewing it and I have a couple of questions:

whool/README.md

Lines 30 to 31 in f071acd

`whool` will package all the files that are under `git` control and ignore everything
else.

whool/README.md

Lines 38 to 39 in f071acd

The version of the generated distribution packages is influenced by the `git`
commit history in the following way.

What happens if I download the addon source as a tarball (surely it will happen for me), if someone downloads sources with --depth=1 (will happen all the time), or if somebody wants to use an alternate VCS such as Mercurial or Pijul (probably won't happen for me)?

Note
Going a bit off-topic.

Regarding dynamic version maintenance, I've been using commitizen for about a year and it's very pleasing:

  • It can enforce a particular commit format (configurable; defaults to conventional commits)
  • Then it can parse the commit history to generate
    • Version bumps. It writes pyproject.toml automatically.
    • Changelogs. It writes CHANGELOG.md automatically.

The benefits of this approach:

  • Project source code contains statically accurate info: the version and changelog.
  • That info doesn't depend on having to download Git history.
  • All you have to care about is committing properly.
    • There's the cz c command to help you on that.
  • Less logic needs to be bundled in build tools such as whool.
  • Builds can be reproducible in a pure environment such as Nix.

@sbidoul
Copy link
Owner

sbidoul commented Sep 22, 2023

What happens if I download the addon source as a tarball (surely it will happen for me),

If it's a proper sdist (with a PKG-INFO file, as generated by pipx run build -s), then it includes all the files in the addon directory

Otherwise, if git ls-files does not work for any reason, it fails. That was a protection measure to protect against older pip versions that did not build in place (we need to correct directory name to get the addon name). We can probably remove this protection now. There is a TODO in the code about that.

if someone downloads sources with --depth=1

I think you'll get the manifest version with an incorrect commit count since last manifest version change in the 6th digit.
You can also disable that versioning behaviour with the post version strategy override option.

if somebody wants to use an alternate VCS such as Mercurial or Pijul

Other VCS are not supported ATM. PRs welcome (the file selection logic is here, and the versioning logic is in manifestoo-core).

I've been using commitizen

Thanks for the tip. I had heard about it but never looked in detail. I'll put that on my list of things to investigate.
Does not sound trivial to apply to OCA, though, but worth investigating nevertheless.

@oyale
Copy link

oyale commented Jan 9, 2024

Hi!

In the current docs, there is a mention about multi-addon projects, but in the hatch-odoo README there is a notice:

💡 This project is best used when working with end-customer projects. To package
individual reusable addons, consider the whool
project.

So, what would be the tool to replace the setuptools-odoo-make-default -d . command, which would create the individual config file for each addon in a repository, allowing to reuse them individually?

I assumed that the answer was whool, and after run pipx run whool -h, I read the subdirectory part.

This is done in the current directory if it is an addon, else in immediate subdirectories
                 that are addons.

So I just ran pipx run whool init and all worked like a charm!

Maybe it's worth clarifying it on README?


I've been using commitizen

Thanks for the tip. I had heard about it but never looked in detail. I'll put that on my list of things to investigate. Does not sound trivial to apply to OCA, though, but worth investigating nevertheless.

Regarding adapting commitizen for OCA workflows, we did some exploration on this in the past:

https://git.coopdevs.org/coopdevs/tooling/commitizen-oca

@sbidoul
Copy link
Owner

sbidoul commented Jan 10, 2024

@oyale thanks for the valuable feedback. I improved the README in 9f2e080.

@Lionel-cl
Copy link

Hi,
What you are doing is awesome!
But indeed a complete example will be very useful. And even better it would be to have a little tutorial.

To start: can you tell us an OCA repo that uses this new approach? This would be a good example of achievement.
Thanks

@sbidoul sbidoul changed the title Minimal docs? More docs? May 8, 2024
@sbidoul
Copy link
Owner

sbidoul commented May 8, 2024

@Lionel-cl thanks. Have you had a look at the README recently, specifically the Quick start section ? What's missing in the docs, IMO, concerns advanced use cases that are very rarely useful with recent Odoo versions anyway.

Otherwise, all 17.0 branches in OCA have a pyproject.toml in each addon.

@Lionel-cl
Copy link

@sbidoul Thank you for your answer. Yes I read the readme but it is not that clear to me.
I just saw that this work was an extension of Hatch https://hatch.pypa.io/. So I'm going to start by reading this doc.
An introduction with cross-references could be useful for those like me who land directly on your repo.
My questions are:

  • what should be installed?
  • what are the commands to run to install such a "super" module on my odoo instance ?
  • how can I create a "super" module with sub-modules?
    A lot of the answers should be in this Hatch doc. I will then come back to your tool.

I'm currently using odoo 16 and haven't looked at 17.0 branches in OCA yet.

@sbidoul
Copy link
Owner

sbidoul commented May 8, 2024

Ah, I see. You are probably looking for hatch-odoo instead of this project. I added a note at the top of the README.

@polyudov
Copy link

polyudov commented Sep 30, 2024

Hi @sbidoul! Thank you for project!

Could you help me with problem with requires-python.
In my pyproject.toml of my odoo16 addon

[project]
requires-python = ">=3.7"

But after build in METADATA file in wheel,a have Requires-Python: >=3.10

Metadata-Version: 2.1
Name: odoo-addon-myaddon
Version: 16.0.3.0.1
Requires-Python: >=3.10
Requires-Dist: odoo>=16.0a,<16.1dev

Where am I wrong?

@sbidoul
Copy link
Owner

sbidoul commented Sep 30, 2024

@polyudov since Odoo 16 does not support python 3.7, why do you want to do this?

In any case, whool is not going to read the [project] table. It is a very specialized build backend to build individual Odoo addons, by reading the metadata from __manifest__.py. For higher level projects, you may want to consider hatch-odoo.

@polyudov
Copy link

@sbidoul My odoo16 uses python3.9 on my local machine and server. I have problem with Requires-Python: >=3.10 from METADATA during the installation process. What should I do in this case? Change python version to 3.10?

@sbidoul
Copy link
Owner

sbidoul commented Sep 30, 2024

@polyudov Yes, unfortunately, we don't support python 3.9 for Odoo 16, you'll need to use python 3.10, or 3.12, which works well too with the latest Odoo 16.

@sbidoul sbidoul added the documentation Improvements or additions to documentation label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants