#400 docs: Simplify development set up
Merged 5 years ago by gnaponie. Opened 5 years ago by lholecek.
lholecek/greenwave update-dev-docs  into  master

docs: Simplify development set up
Lukas Holecek • 5 years ago  
file modified
+3
@@ -27,6 +27,9 @@ 

  greenwave-test-cache.dbm*

  .pytest_cache

  

+ # virtualenv

+ .venv/

+ 

  # Other

  .vagrant/

  .vscode/

file modified
+27 -12
@@ -9,17 +9,21 @@ 

  Quick development setup

  =======================

  

- Install dependencies:

+ As an alternative to using virtualenv, described below, you can install system

+ packages listed in Dockerfile.

+ 

+ Set up Python 3 vitualenv:

+ 

+ .. code-block:: console

+ 

+    $ python3 -m venv --system-site-packages .venv

+    $ source .venv/bin/activate

+ 

+ Install development dependencies:

  

  .. code-block:: console

  

-    $ sudo dnf -y install \

-        python3-dogpile-cache \

-        python3-fedmsg \

-        python3-flask \

-        python3-prometheus_client \

-        python3-PyYAML \

-        python3-requests

+    $ pip install -r dev-requirements.txt -r requirements.txt

  

  Create a local configuration file:

  
@@ -45,22 +49,33 @@ 

  

  .. code-block:: console

  

-    $ py.test-3 greenwave/tests/

+    $ python3 -m pytest greenwave

  

  There are also functional tests in the :file:`functional-tests` directory. The

  functional tests will start their own copy of the `ResultsDB`_, `WaiverDB`_,

- and Greenwave servers and then send HTTP requests to them. You can run the

- functional tests like this:

+ and Greenwave servers and then send HTTP requests to them.

+ 

+ You can run the functional tests like this:

  

  .. code-block:: console

  

-    $ py.test-3 functional-tests/

+    $ python3 -m pytest functional-tests

  

  The functional tests assume you have ResultsDB and WaiverDB git checkouts in

  :file:`../resultsdb` and :file:`../waiverdb` respectively. You can tell it to

  find them in a different location by passing ``RESULTSDB`` or ``WAIVERDB``

  environment variables.

  

+ You can quickly clone the repositories (to parent directory) and update

+ development virtualenv with:

+ 

+ .. code-block:: console

+ 

+    $ git clone https://pagure.io/waiverdb.git ../waiverdb/

+    $ git clone https://pagure.io/taskotron/resultsdb.git ../resultsdb/

+    $ pip install -r ../waiverdb/requirements.txt

+    $ pip install -r ../resultsdb/requirements.txt

+ 

  If you'd rather not install all the dependencies necessary to run the functional

  tests, you may use Vagrant to provision a throw-away virtual machine to run

  the tests:

Instead of removing the old version, I would add another version, like we have "running the tests with vagrant", I would put something like "running greenwave with the virtualenv". And leave both sessions (with and without virtualenv)

I removed the old instructions because, apart from the fact that installing packages on dev machine is not very convenient, it's yet another place to list the required packages (it's also in Jenkinsfile, Dockerfile and Vagrantfile).

Not sure if Vagrant is the way to go either. Ideally, we use the Dockerfile because it's used to generate the image for prod - but have a way to mount the dev dirs in container (docker-compose up perhaps).

Can we make this use a pure virtual environment? Is there anything in the system outside of requirements.txt that needs to be available?

Also, why is this not doing a pip install of requirements.txt? And only dev-requirements.txt?

Can we make this use a pure virtual environment?

Unfortunately, using pure venv would still require some packages installed on system (build dependencies for pip) and pip install takes a long time. :'(

Also, why is this not doing a pip install of requirements.txt? And only dev-requirements.txt?

Oops, I expected dev-requirements.txt contains -r requirements.txt. I think it should -- at least I expect it to install everything for development.

I would really like to use the existing Dockerfile instead of venv but there need to be a nice way to mount/sync devel directory with the container. I'd like to try podman pod commands later.

rebased onto ae412ddb8f7d57d50ce0968e08a4bad09af6f95d

5 years ago

rebased onto 967073b766d7f31779b3ad63f652b28f497465a2

5 years ago

I don't really have an opinion on this, but it looks fine to me.

I kinda like how it is right now, because I use resultsdb's virtualenv since I always run the functional tests, but that's my working environment. I would like to keep both version in the doc. The PR look fine anyhow.

I kinda like how it is right now, because I use resultsdb's virtualenv since I always run the functional tests, but that's my working environment. I would like to keep both version in the doc. The PR look fine anyhow.

I don't like keeping the list of dependencies up-to-date in the doc. I could mention that, instead of using virtualenv, you can install the dependencies listed in the Dockerfile.

@gnaponie Would that be OK?

@lholecek yeah that sounds good to me. Let's go with this solution and let's merge this PR.

rebased onto f032cfe

5 years ago

Pull-Request has been merged by gnaponie

5 years ago
Metadata