developing a module and deploying it

122 views
Skip to first unread message

Cato Nano

unread,
Nov 19, 2017, 6:00:09 AM11/19/17
to tryton
I'm going to develop a small module of mine to manage taxes collection by small municipalities

How do you suggest preparing a development worstation ?

Where will I put the code for my module ?
How will I install Tryton ?
How will I run it in order to see it in action ?
Can I set up Emacs with autocompletion on my module code ? How ?
How do I create the scaffold for a module ? Is there any command ?

Also, how will I deploy it when it's ready ?

Are there any guidelines ?

Thanks

Cédric Krier

unread,
Nov 19, 2017, 8:00:07 AM11/19/17
to tryton
On 2017-11-18 22:56, Cato Nano wrote:
> I'm going to develop a small module of mine to manage taxes collection by small municipalities
>
> How do you suggest preparing a development worstation ?

You just need to have a machine with trytond installed which means a
fully functional Python environment.
There is nothing fancy with trytond development, it is just like any
usual Python development
I would recommend to use virtualenv: https://virtualenv.pypa.io/en/stable/

> Where will I put the code for my module ?

Anywhere you want.

> How will I install Tryton ?

Follow you preferred way to install Python packages.

> How will I run it in order to see it in action ?

You will need to have your package installed under trytond/modules or
registered in the entrypoint 'trytond.modules'.

> Can I set up Emacs with autocompletion on my module code ? How ?

See with your editor what feature it provides for Python language.

> How do I create the scaffold for a module ? Is there any command ?

We have a template using cookiecutter:
https://bitbucket.org/tryton/cookiecutter-tryton

> Also, how will I deploy it when it's ready ?

Like you deploy any other Python packages.

> Are there any guidelines ?

I would recommend reading: http://docs.python-guide.org/en/latest/

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Cato Nano

unread,
Nov 24, 2017, 3:55:07 AM11/24/17
to tryton
Cedrik

thank you

I'm sorry for being impertinent but I still need some help

Maybe what I'm experiencing is what is supposed to happen and I don't realize it

I am trying to install an empty module, freshly created with coockiecutter

It shouldn't produce any menu and any button but it should be in the modules list at least

It's not

I'm sorry, I don't now how to set up a python based project.

Il giorno domenica 19 novembre 2017 14:00:07 UTC+1, Cédric Krier ha scritto:
> On 2017-11-18 22:56, Cato Nano wrote:
> > I'm going to develop a small module of mine to manage taxes collection by small municipalities
> >
> > How do you suggest preparing a development worstation ?
>
> You just need to have a machine with trytond installed which means a
> fully functional Python environment.
> There is nothing fancy with trytond development, it is just like any
> usual Python development
> I would recommend to use virtualenv: https://virtualenv.pypa.io/en/stable/
>
> > Where will I put the code for my module ?
>
> Anywhere you want.
>
> > How will I install Tryton ?
>
> Follow you preferred way to install Python packages.
>
> > How will I run it in order to see it in action ?
>
> You will need to have your package installed under trytond/modules

and how do I achieve that ?

I tried

python3 setup.py develop

but the target folder is not the Tryton modules folder. Should it be ?

Should I set

install-dir=...modules ?

> or registered in the entrypoint 'trytond.modules'.

This should be done when building Tryton, as far as I understand

But I'd like to use the apt-get provided one, so this isn't an option for me ?

> We have a template using cookiecutter:
> https://bitbucket.org/tryton/cookiecutter-tryton
>

Thanks in advance

Sergi Almacellas Abellana

unread,
Nov 24, 2017, 5:56:49 AM11/24/17
to try...@googlegroups.com
El 24/11/17 a les 09:10, Cato Nano ha escrit:
> Cedrik
>
> thank you
>
> I'm sorry for being impertinent but I still need some help
>
> Maybe what I'm experiencing is what is supposed to happen and I don't realize it
>
> I am trying to install an empty module, freshly created with coockiecutter
>
> It shouldn't produce any menu and any button but it should be in the modules list at least

If the module is correctly installed you should see on the modules list.
If the database already exists you should update the module list with:

trytond-admin -c <config file> -d <database name> --update-modules-list

>
>
> I tried
>
> python3 setup.py develop

Have you tried installing the module with:


python3 setup.py install


If you use develop, the folder where your code exist should have the
same name as your module.
>
> but the target folder is not the Tryton modules folder. Should it be ?
>
> Should I set
>
> install-dir=...modules ?

It's not required if the entry point is correctly registred.
>
>> or registered in the entrypoint 'trytond.modules'.
>
> This should be done when building Tryton, as far as I understand
>
> But I'd like to use the apt-get provided one, so this isn't an option for me ?
>

THis is done when installing the module via pip o setup.py.

--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Cato Nano

unread,
Nov 26, 2017, 11:30:06 AM11/26/17
to tryton
Il giorno venerdì 24 novembre 2017 11:56:49 UTC+1, Sergi Almacellas Abellana ha scritto:
> El 24/11/17 a les 09:10, Cato Nano ha escrit:
> If the module is correctly installed you should see on the modules list.
> If the database already exists you should update the module list with:
>
> trytond-admin -c <config file> -d <database name> --update-modules-list

Ok

> If you use develop, the folder where your code exist should have the
> same name as your module.

Ah ! This was the problem ! I renamed the folder and my module showed up in the list !
Thanks !

> > but the target folder is not the Tryton modules folder. Should it be ?
> >
> > Should I set
> >
> > install-dir=...modules ?
>
> It's not required if the entry point is correctly registred.

> >> or registered in the entrypoint 'trytond.modules'.

If I understand correctly the entry point for my module is set up in thhe setup.py file written by coockiecutter


> > This should be done when building Tryton, as far as I understand
> >
> > But I'd like to use the apt-get provided one, so this isn't an option for me ?
> >
>
> THis is done when installing the module via pip o setup.py.

Ok, thanks

Thanks Sergi.
This is appreciated !
Reply all
Reply to author
Forward
0 new messages