~sircmpwn/sr.ht-discuss

15 8

Docs addition: setup local dev environment

Details
Message ID
<CHLVKZYKS5OG.2YLDHKVSNYN9S@winston.local>
DKIM signature
missing
Download raw message
Hello everyone

I was looking for "official" documentation on how to setup a local sr.ht
environment for development purposes. 

Unfortunately I didn't get far with the resources I found [1]. Note that
perhaps my searches / use of man.sr.ht was not good enough? 

Anyway after searching online and consulting the community in IRC I was
able to get a local environment running. This was mostly thanks to [2]. 

In the course of this, I compiled some up to date notes on how to setup
a local development environment. 

If I were to further complete and polish these notes, would this be
worthy addition to the documentation on sourcehut? 

Thank you for your feedback. 

Kind regards

---
Michael
michael.anckaert@sinax.be
https://sinax.be
Cara Salter <cara@devcara.com>
Details
Message ID
<20220202214018.o5kpf2dag3u2lw72@vulcan.local>
In-Reply-To
<CHLVKZYKS5OG.2YLDHKVSNYN9S@winston.local> (view parent)
DKIM signature
missing
Download raw message
On Wed, Feb 02, 2022 at 10:23:18PM +0100, Michael Anckaert wrote:
> Hello everyone
> 
> I was looking for "official" documentation on how to setup a local sr.ht
> environment for development purposes. 
The best one I can find is from ~emersion[1]
> 
> Unfortunately I didn't get far with the resources I found [1]. Note that
> perhaps my searches / use of man.sr.ht was not good enough? 
> 
> Anyway after searching online and consulting the community in IRC I was
> able to get a local environment running. This was mostly thanks to [2]. 
Did you forget to include your references? I'm not seeing any.
-- 
Be well,
Cara Salter (she/her/hers)

[1]: https://emersion.fr/blog/2021/setting-up-sr.ht-for-local-development/
Details
Message ID
<CHMBPSGVBHU0.3INHLTWZP1ETI@taiga>
In-Reply-To
<CHLVKZYKS5OG.2YLDHKVSNYN9S@winston.local> (view parent)
DKIM signature
missing
Download raw message
On Wed Feb 2, 2022 at 10:23 PM CET, Michael Anckaert wrote:
> If I were to further complete and polish these notes, would this be
> worthy addition to the documentation on sourcehut? 

Yes, that would be lovely.
Details
Message ID
<CHMCB5TK7GHV.3EJVKI8238AF@winston.local>
In-Reply-To
<CHMBPSGVBHU0.3INHLTWZP1ETI@taiga> (view parent)
DKIM signature
missing
Download raw message
On Thu Feb 3, 2022 at 11:01 AM CET, Drew DeVault wrote:
> On Wed Feb 2, 2022 at 10:23 PM CET, Michael Anckaert wrote:
> > If I were to further complete and polish these notes, would this be
> > worthy addition to the documentation on sourcehut? 
>
> Yes, that would be lovely.

Thanks. 

A followup question regarding Python dependencies. I had to figure out
what the depencies are by trial and error. 

Would it be suitable to add a requirements.txt file to the meta.sr.ht
repository? As meta.sr.ht is required for all other service, I think
this would be a suitable location. 

Can you follow this approach / addition? 

---
Michael Anckaert
michael.anckaert@sinax.be
https://sinax.be
Details
Message ID
<CHMCC0VMJY8G.3ULZUZ9NH6168@taiga>
In-Reply-To
<CHMCB5TK7GHV.3EJVKI8238AF@winston.local> (view parent)
DKIM signature
missing
Download raw message
On Thu Feb 3, 2022 at 11:29 AM CET, Michael Anckaert wrote:
> Would it be suitable to add a requirements.txt file to the meta.sr.ht
> repository? As meta.sr.ht is required for all other service, I think
> this would be a suitable location. 

No. Our dependencies are documented through the distribution packages,
which is the recommended way of installing them.
Details
Message ID
<CHMCG3AHVIA5.2YOYVNBLVLU8J@winston.local>
In-Reply-To
<CHMCC0VMJY8G.3ULZUZ9NH6168@taiga> (view parent)
DKIM signature
missing
Download raw message
On Thu Feb 3, 2022 at 11:30 AM CET, Drew DeVault wrote:
> On Thu Feb 3, 2022 at 11:29 AM CET, Michael Anckaert wrote:
> > Would it be suitable to add a requirements.txt file to the meta.sr.ht
> > repository? As meta.sr.ht is required for all other service, I think
> > this would be a suitable location. 
>
> No. Our dependencies are documented through the distribution packages,
> which is the recommended way of installing them.

Does this mean that for local development, the recommended way is to
install the distribution packages on your system and not for example
create a python venv for the python dependencies? 

Personally I'm more in favour of setting up an environment with 
specific package versions for sourcehut, and not clutter my general
system environment. 

Likewise I'm not comfortable to install the sourcehut services
systemwide on my machine for development reasons. 

I'm sure there is a reason why this is the recommended way but I'd like
to understand the rationale and perhaps help find a better way if there
is one. 


---
Michael Anckaert
michael.anckaert@sinax.be
https://sinax.be
Details
Message ID
<CHMCKG8X9MTZ.1S7C86RQEPJZ8@taiga>
In-Reply-To
<CHMCG3AHVIA5.2YOYVNBLVLU8J@winston.local> (view parent)
DKIM signature
missing
Download raw message
On Thu Feb 3, 2022 at 11:36 AM CET, Michael Anckaert wrote:
> Does this mean that for local development, the recommended way is to
> install the distribution packages on your system and not for example
> create a python venv for the python dependencies? 

Yes. This is the correct way to manage dependencies in a production
setting. I disagree with the "general wisdom" of Python dependency
management. This has been discussed many times and is unlikely to change.
Details
Message ID
<CHMCNX1DG80L.YR33LD6IS5CM@winston.local>
In-Reply-To
<CHMCKG8X9MTZ.1S7C86RQEPJZ8@taiga> (view parent)
DKIM signature
missing
Download raw message
On Thu Feb 3, 2022 at 11:41 AM CET, Drew DeVault wrote:
> On Thu Feb 3, 2022 at 11:36 AM CET, Michael Anckaert wrote:
> > Does this mean that for local development, the recommended way is to
> > install the distribution packages on your system and not for example
> > create a python venv for the python dependencies? 
>
> Yes. This is the correct way to manage dependencies in a production
> setting. I disagree with the "general wisdom" of Python dependency
> management. This has been discussed many times and is unlikely to change.

I think there may be a mis understanding, I'm not referring to a
production setting, but a local development setup. ie when I want to
setup sourcehut services locally for testing when developing. 

I fully agree that using the system's package manager is the only
approach when running a production environment.

---
Michael Anckaert
michael.anckaert@sinax.be
https://sinax.be
Details
Message ID
<CHMCPP2X62UF.31K74UXG4Z33U@taiga>
In-Reply-To
<CHMCNX1DG80L.YR33LD6IS5CM@winston.local> (view parent)
DKIM signature
missing
Download raw message
On Thu Feb 3, 2022 at 11:46 AM CET, Michael Anckaert wrote:
> I think there may be a mis understanding, I'm not referring to a
> production setting, but a local development setup. ie when I want to
> setup sourcehut services locally for testing when developing. 
>
> I fully agree that using the system's package manager is the only
> approach when running a production environment.

Regardless: we use the system package manager.
Details
Message ID
<20220204124356.4889cfc9@gyot.zag.pp.ua>
In-Reply-To
<CHMCKG8X9MTZ.1S7C86RQEPJZ8@taiga> (view parent)
DKIM signature
missing
Download raw message
2022/02/03 11:41:54 +0100 "Drew DeVault" <sir@cmpwn.com>:

> I disagree with the "general wisdom" of Python dependency management.
> This has been discussed many times and is unlikely to change.

Could you please give any hints where to look for the discussions? I tried
searching for "python requirements", "python package", "python system"
keywords on this list with no much luck.
Details
Message ID
<d6cdd414-af55-2f49-5676-c9361cc7b333@bitfehler.net>
In-Reply-To
<20220204124356.4889cfc9@gyot.zag.pp.ua> (view parent)
DKIM signature
missing
Download raw message
On 2/4/22 11:43, Eugen Zagorodniy wrote:
> Could you please give any hints where to look for the discussions? I tried
> searching for "python requirements", "python package", "python system"
> keywords on this list with no much luck.

By no means speaking for Drew, but I think this might be good start:

https://drewdevault.com/2021/11/16/Python-stop-screwing-distros-over.html

Conrad
Details
Message ID
<2498d72a-84f5-936b-2071-5ac84619ff00@bitfehler.net>
In-Reply-To
<CHMCNX1DG80L.YR33LD6IS5CM@winston.local> (view parent)
DKIM signature
missing
Download raw message
Hi,

On 2/3/22 11:46, Michael Anckaert wrote:
 > I think there may be a mis understanding, I'm not referring to a
 > production setting, but a local development setup. ie when I want to
 > setup sourcehut services locally for testing when developing.

Maybe just to provide some ideas: I just did that, and it works very 
well using the system package management. I simply installed the package 
(let's say, meta.sr.ht), which gets me all the dependencies (and keeps 
them up-to-date). I then checked out the git repo and could just build 
and run that for development.

To simply develop the services themselves, this is all you need. If you 
do ever need to make changes to any of the dependencies, there are 
options. For Go modules, you can use the replace directive [1] in go.mod 
(of the service you are developing), e.g.

replace git.sr.ht/~sircmpwn/core-go v0.0.0-20220112154231-e28d47cf5957 
=> /home/conrad/go/src/git.sr.ht/~sircmpwn/core-go

This will compile the service using the current on-disk state of the 
latter path instead of the specified version from the git repo.

For Python, I have not yet had the need to do this, but if I understand 
correctly you can use usercustomize.py [2] to achieve essentially the 
same thing.

Hope that helps. On a side a note, I'd be happy to help you work on the 
docs, especially as I am also going through that process right now 
(haven't setup all services yet).

[1] https://go.dev/doc/modules/gomod-ref#replace
[2] https://stackoverflow.com/a/9935084

Conrad
Details
Message ID
<CHNIPSPIN9GL.A4GK8Z1YLQQZ@winston.local>
In-Reply-To
<2498d72a-84f5-936b-2071-5ac84619ff00@bitfehler.net> (view parent)
DKIM signature
missing
Download raw message
On Fri Feb 4, 2022 at 1:51 PM CET, Conrad Hoffmann wrote:
> Maybe just to provide some ideas: I just did that, and it works very 
> well using the system package management. I simply installed the package 
> (let's say, meta.sr.ht), which gets me all the dependencies (and keeps 
> them up-to-date). I then checked out the git repo and could just build 
> and run that for development.
I agree it works perfectly. But personally I like to keep my system
namespace clean, for Python packages I have a virtualenv per project.
Some projects require version X of a package, others require version Y.
If all projects were to require/recommend system wide installation via
the system package manager, nothing would work. 
> For Python, I have not yet had the need to do this, but if I understand 
> correctly you can use usercustomize.py [2] to achieve essentially the 
> same thing.
See my comment above about a virtualenv, I've found that this works much
better. A python based project just shares a requirements.txt file along
with the source that indicates what dependencies are required. 
> Hope that helps. On a side a note, I'd be happy to help you work on the 
> docs, especially as I am also going through that process right now 
> (haven't setup all services yet).
Thanks for the suggestion, I'll share my current notes when I've
polished them a bit and we can collaborate on them if you like. 

---
Michael Anckaert
michael.anckaert@sinax.be
https://sinax.be
Details
Message ID
<3598117.1644019913@apollo2.minshall.org>
In-Reply-To
<CHNIPSPIN9GL.A4GK8Z1YLQQZ@winston.local> (view parent)
DKIM signature
missing
Download raw message
Michael,

> I agree it works perfectly. But personally I like to keep my system
> namespace clean, for Python packages I have a virtualenv per project.
> Some projects require version X of a package, others require version
> Y.

i wonder if this testing/setup case might be where something like docker
might come in handy?

cheers, Greg
Details
Message ID
<df630b35-16e6-569a-acc2-b67158566203@gmail.com>
In-Reply-To
<3598117.1644019913@apollo2.minshall.org> (view parent)
DKIM signature
missing
Download raw message
On 2/4/22 18:11, Greg Minshall wrote:

> Michael,
>
>> I agree it works perfectly. But personally I like to keep my system
>> namespace clean, for Python packages I have a virtualenv per project.
>> Some projects require version X of a package, others require version
>> Y.
> i wonder if this testing/setup case might be where something like docker
> might come in handy?
I have a working Dockerfile for todo.sr.ht and...uhh, meta.sr.ht? 
together in one image I was using to for unit testing purposes, if 
people are interested I could try expanding on & sharing it.
> cheers, Greg

-- 
--
Ryan
https://refi64.com/
Details
Message ID
<CHNXCMO8HM09.BVSQ4WTJ09K@bellwether>
In-Reply-To
<3598117.1644019913@apollo2.minshall.org> (view parent)
DKIM signature
missing
Download raw message
On Sat Feb 5, 2022 at 2:11 AM IST, Greg Minshall wrote:
> i wonder if this testing/setup case might be where something like docker
> might come in handy?

fwiw, Drew has specifically spoken against using docker or k8s for
sourcehut installations:

https://paste.sr.ht/~sircmpwn/78cc21e1661d5a9d8038f47e532d286807ac89ad
Reply to thread Export thread (mbox)