diff --git a/.gitignore b/.gitignore index 26f7f0a..61ffa96 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ swh-*/ packages/* snippets/ !packages/README !packages/keys/ - .venv +docker/*.override.yml +docker/tests/*.logs diff --git a/docker/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md similarity index 100% rename from docker/CODE_OF_CONDUCT.md rename to CODE_OF_CONDUCT.md diff --git a/docker/CONTRIBUTORS b/CONTRIBUTORS similarity index 100% rename from docker/CONTRIBUTORS rename to CONTRIBUTORS diff --git a/Makefile b/Makefile index 4bd00a7..470b411 100644 --- a/Makefile +++ b/Makefile @@ -1,47 +1,51 @@ PYMODULES := $(shell bin/ls-py-modules) DB_MODULES = swh-storage swh-archiver swh-scheduler swh-indexer swh-scheduler/sql/updater DOC_MODULE = swh-docs all: # TODO this is too close to "docs" below, but is meant to go away anyhow, when # the dependency graph stuff will migrate to the swh-docs/ module .PHONY: doc doc: make -C doc/ check: $(patsubst %,check/%,$(PYMODULES)) typecheck: $(patsubst %,typecheck/%,$(PYMODULES)) distclean: $(patsubst %,distclean/%,$(PYMODULES)) test: $(patsubst %,test/%,$(PYMODULES)) docs: $(patsubst %,docs/%,$(filter-out $(DOC_MODULE),$(PYMODULES))) docs-assets: $(patsubst %,docs-assets/%,$(filter-out $(DOC_MODULE),$(PYMODULES))) docs-apidoc: $(patsubst %,docs-apidoc/%,$(filter-out $(DOC_MODULE),$(PYMODULES))) docs-clean: $(patsubst %,docs-clean/%,$(filter-out $(DOC_MODULE),$(PYMODULES))) check/%: make -C $* check typecheck/%: make -C $* typecheck distclean/%: make -C $* distclean test/%: make -C $* test docs/%: make -C $*/docs docs-assets/%: make -C $*/docs assets docs-apidoc/%: make -C $*/docs apidoc docs-clean/%: make -C $*/docs clean .PHONY: update clean update: git pull mr up clean: make -C doc/ clean + +.PHONY: check-staged +check-staged: + make -C docker/ check-staged diff --git a/README.md b/README.md index 44209ae..3b9d5a1 100644 --- a/README.md +++ b/README.md @@ -1,82 +1,88 @@ Software Heritage Python development environment ================================================ This repository contains the scaffolding to initialize and keep a local development environment for the Software Heritage Python stack. In particular, it contains pointers to the Git repositories of all Software Heritage Python modules. The repositories are managed using [myrepos][1] (see the .mrconfig file), and the `mr` command. [1]: http://myrepos.branchable.com/ The provided mr config will also install a [pre-commit][2] hook in cloned repositories, so the `pre-commit` tool must be available as well. [2]: https://pre-commit.com/ In Debian, the "mr" command is shipped in the "mr" package. Unfortunately, "pre-commit" itself is not available in Debian for now. However, we strongly suggest you use a [virtualenv][3] to manage your SWH development environment. You can create it using virtualenv, or you can use a virtualenv wrapper tool like [virtualenvwrapper][4] or [pipenv][5] (or any other similar tool). In Debian, both these tools are available as "virtualenvwrapper" and "pipenv". [3]: https://virtualenv.pypa.io/ [4]: https://virtualenvwrapper.readthedocs.io/ [5]: https://pipenv.readthedocs.io/ In the example below we are using virtualenv directly: ```lang=shell git clone https://forge.softwareheritage.org/source/swh-environment.git cd swh-environment python3 -m venv .venv . .venv/bin/activate pip install pre-commit ``` then you can use the following helper for both initial code checkout and subsequent updates: ```lang=shell bin/update ``` Note that the first time you run `bin/update` it will add the `swh-environment/.mrconfig` file to your `~/.mrtrust` (we use this to be able to setup pre-commit hooks upon repository checkouts) and install "pre-commit" as git precommit hook in each git repository. See `MR(1)` for more information about trusted `mr` repositories. You can also checkout/update repositories by hand using `mr up`. See `.mrconfig` for the actual list of repositories. Upgrade from makefile-based hooks --------------------------------- Git pre commit hooks used to be makefile-based scripts. Running `mr update` will automatically replace these by the `pre-commit` tool, Initialize a new Python package repository ------------------------------------------ 1. create the remote Git repository on the forge 2. add it to `.mrconfig` (e.g. using mr register) 3. mr update this will clone the (empty) repository locally 4. bin/init-py-repo REPO_NAME this will fill the repository with the template for SWH Python packages, and make an initial commit 5. cd REPO_NAME ; git push + + +Docker based test environment +----------------------------- + +Check the README file in the docker/ directory. diff --git a/docker/.gitignore b/docker/.gitignore deleted file mode 100644 index 6b8a876..0000000 --- a/docker/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -docker-compose.override.yml -docker-compose.storage-replica.override.yml -tests/swh-docker-compose.logs diff --git a/docker/docker-compose.override.yml.example b/docker/docker-compose.override.yml.example index 5221796..258829a 100644 --- a/docker/docker-compose.override.yml.example +++ b/docker/docker-compose.override.yml.example @@ -1,6 +1,6 @@ version: '2' services: swh-objstorage: volumes: - - "/home/ddouard/src/swh-environment/swh-objstorage:/src/swh-objstorage" + - "../swh-objstorage:/src/swh-objstorage" diff --git a/docker/docs/Makefile b/docker/docs/Makefile deleted file mode 100644 index c30c50a..0000000 --- a/docker/docs/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../../swh-docs/Makefile.sphinx