Skip to content

Commit 9f98569

Browse files
fruitymedleyCkk3
andauthored
doc: Add directions for using dev containers (#237)
* doc: Add directions for using dev containers * doc: add multiple setup options * doc: refer readme to docs * doc: Fix git links * doc: clarify variable Co-authored-by: Luis Gustavo <[email protected]> * doc: move obsolete tutorial to todo * doc: Fix git links again --------- Co-authored-by: Luis Gustavo <[email protected]>
1 parent 2133fd7 commit 9f98569

File tree

2 files changed

+72
-40
lines changed

2 files changed

+72
-40
lines changed

CONTRIBUTING.rst

+70-40
Original file line numberDiff line numberDiff line change
@@ -102,64 +102,93 @@ and use Python's built-in web server for a preview in your web browser
102102

103103
python3 -m http.server --directory 'docs/_build/html'
104104

105+
Project Setup
106+
=============
105107

106-
Code Contributions
107-
==================
108+
Clone the repository
109+
--------------------
108110

109-
.. todo:: Please include a reference or explanation about the internals of the project.
111+
#. Create an user account on |the repository service| if you do not already have one.
112+
#. Fork the project repository_: click on the *Fork* button near the top of the
113+
page. This creates a copy of the code under your account on |the repository service|.
114+
#. Clone this copy to your local disk::
110115

111-
An architecture description, design principles or at least a summary of the
112-
main concepts will make it easy for potential contributors to get started
113-
quickly.
116+
git clone [email protected]:YOUR_USERNAME_HERE/strawberry-sqlalchemy-mapper.git
117+
cd strawberry-sqlalchemy-mapper
114118

115-
Submit an issue
116-
---------------
119+
Install dependencies and plugins
120+
--------------------------------
117121

118-
Before you work on any non-trivial code contribution it's best to first create
119-
a report in the `issue tracker`_ to start a discussion on the subject.
120-
This often provides additional considerations and avoids unnecessary work.
122+
.. todo:: Rewrite the following snippets to use the poetry environment rather than setuptools
121123

122-
Create an environment
123-
---------------------
124+
There are two ways to set up the environment for local development:
124125

125-
Before you start coding, we recommend creating an isolated `virtual
126-
environment`_ to avoid any problems with your installed Python packages.
127-
This can easily be done via either |virtualenv|_::
126+
#. Manual environment setup
128127

129-
virtualenv <PATH TO VENV>
130-
source <PATH TO VENV>/bin/activate
128+
#. Dev Container setup
131129

132-
or Miniconda_::
130+
Method 1: Manual environment setup
131+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133132

134-
conda create -n strawberry-sqlalchemy-mapper python=3 six virtualenv pytest pytest-cov
135-
conda activate strawberry-sqlalchemy-mapper
133+
#. Before you start coding, we recommend creating an isolated `virtual
134+
environment`_ to avoid any problems with your installed Python packages.
135+
This can easily be done via either |virtualenv|_::
136136

137-
Clone the repository
138-
--------------------
137+
virtualenv <PATH TO VENV>
138+
source <PATH TO VENV>/bin/activate
139139

140-
#. Create an user account on |the repository service| if you do not already have one.
141-
#. Fork the project repository_: click on the *Fork* button near the top of the
142-
page. This creates a copy of the code under your account on |the repository service|.
143-
#. Clone this copy to your local disk::
140+
or Miniconda_::
144141

145-
git clone [email protected]:YourLogin/strawberry-sqlalchemy-mapper.git
146-
cd strawberry-sqlalchemy-mapper
142+
conda create -n strawberry-sqlalchemy-mapper python=3 six virtualenv pytest pytest-cov
143+
conda activate strawberry-sqlalchemy-mapper
147144

148-
#. You should run::
145+
#. You should run::
149146

150-
pip install -U pip setuptools -e .
147+
pip install -U pip setuptools -e .
151148

152-
to be able to import the package under development in the Python REPL.
149+
to be able to import the package under development in the Python REPL.
153150

154-
.. todo:: if you are not using pre-commit, please remove the following item:
151+
.. todo:: if you are not using pre-commit, please remove the following item:
152+
153+
#. Install |pre-commit|_::
154+
155+
pip install pre-commit
156+
pre-commit install
157+
158+
``strawberry-sqlalchemy-mapper`` comes with a lot of hooks configured to automatically help the
159+
developer to check the code being written.
160+
161+
162+
Method 2: Dev Container setup
163+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
164+
165+
#. Install `Dev Containers`_.
155166

156-
#. Install |pre-commit|_::
167+
#. Press ``Ctrl+Shift+P`` to open the command tab and enter ``Dev Containers: Open Folder in Container...``.
157168

158-
pip install pre-commit
159-
pre-commit install
169+
#. Select the root directory of this repository.
170+
Dev Containers will now install the environment dependencies as well as |pre-commit|_
171+
172+
#. When installation is complete, press ``Ctrl+Shift+P`` to open the command tab and enter ``Python Select Interpreter``
173+
174+
#. Select the environment labeled 'poetry'.
175+
176+
177+
Code Contributions
178+
==================
160179

161-
``strawberry-sqlalchemy-mapper`` comes with a lot of hooks configured to automatically help the
162-
developer to check the code being written.
180+
.. todo:: Please include a reference or explanation about the internals of the project.
181+
182+
An architecture description, design principles or at least a summary of the
183+
main concepts will make it easy for potential contributors to get started
184+
quickly.
185+
186+
Submit an issue
187+
---------------
188+
189+
Before you work on any non-trivial code contribution it's best to first create
190+
a report in the `issue tracker`_ to start a discussion on the subject.
191+
This often provides additional considerations and avoids unnecessary work.
163192

164193
Implement your changes
165194
----------------------
@@ -314,8 +343,8 @@ on PyPI_, the following steps can be used to release a new version for
314343
.. |the repository service| replace:: GitHub
315344
.. |contribute button| replace:: "Create pull request"
316345

317-
.. _repository: https://github.com/<USERNAME>/strawberry-sqlalchemy-mapper
318-
.. _issue tracker: https://github.com/<USERNAME>/strawberry-sqlalchemy-mapper/issues
346+
.. _repository: https://github.com/strawberry-graphql/strawberry-sqlalchemy
347+
.. _issue tracker: https://github.com/strawberry-graphql/strawberry-sqlalchemy/issues
319348
.. <-- end -->
320349
321350
@@ -329,6 +358,7 @@ on PyPI_, the following steps can be used to release a new version for
329358
.. _contribution-guide.org: https://www.contribution-guide.org/
330359
.. _creating a PR: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request
331360
.. _descriptive commit message: https://chris.beams.io/posts/git-commit
361+
.. _Dev Containers: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
332362
.. _docstrings: https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
333363
.. _first-contributions tutorial: https://github.com/firstcontributions/first-contributions
334364
.. _flake8: https://flake8.pycqa.org/en/stable/

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ If you have a suggestion that would make this better, please fork the repo and c
213213
4. Push to the Branch (git push origin feature)
214214
5. Open a Pull Request
215215

216+
For more details on how to contribute, as well as how to setup the project on your local machine, please refer to [the docs](CONTRIBUTING.rst)
217+
216218

217219
### Prerequisites
218220

0 commit comments

Comments
 (0)