Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Add directions for using dev containers #237

Merged
merged 7 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 70 additions & 40 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,64 +102,93 @@ and use Python's built-in web server for a preview in your web browser

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

Project Setup
=============

Code Contributions
==================
Clone the repository
--------------------

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

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

Submit an issue
---------------
Install dependencies and plugins
--------------------------------

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

Create an environment
---------------------
There are two ways to set up the environment for local development:

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

virtualenv <PATH TO VENV>
source <PATH TO VENV>/bin/activate
#. Dev Container setup

or Miniconda_::
Method 1: Manual environment setup
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

Clone the repository
--------------------
virtualenv <PATH TO VENV>
source <PATH TO VENV>/bin/activate

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

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

#. You should run::
#. You should run::

pip install -U pip setuptools -e .
pip install -U pip setuptools -e .

to be able to import the package under development in the Python REPL.
to be able to import the package under development in the Python REPL.

.. todo:: if you are not using pre-commit, please remove the following item:
.. todo:: if you are not using pre-commit, please remove the following item:

#. Install |pre-commit|_::

pip install pre-commit
pre-commit install

``strawberry-sqlalchemy-mapper`` comes with a lot of hooks configured to automatically help the
developer to check the code being written.


Method 2: Dev Container setup
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. Install `Dev Containers`_.

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

pip install pre-commit
pre-commit install
#. Select the root directory of this repository.
Dev Containers will now install the environment dependencies as well as |pre-commit|_

#. When installation is complete, press ``Ctrl+Shift+P`` to open the command tab and enter ``Python Select Interpreter``

#. Select the environment labeled 'poetry'.


Code Contributions
==================

``strawberry-sqlalchemy-mapper`` comes with a lot of hooks configured to automatically help the
developer to check the code being written.
.. todo:: Please include a reference or explanation about the internals of the project.

An architecture description, design principles or at least a summary of the
main concepts will make it easy for potential contributors to get started
quickly.

Submit an issue
---------------

Before you work on any non-trivial code contribution it's best to first create
a report in the `issue tracker`_ to start a discussion on the subject.
This often provides additional considerations and avoids unnecessary work.

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

.. _repository: https://github.com/<USERNAME>/strawberry-sqlalchemy-mapper
.. _issue tracker: https://github.com/<USERNAME>/strawberry-sqlalchemy-mapper/issues
.. _repository: https://github.com/strawberry-graphql/strawberry-sqlalchemy
.. _issue tracker: https://github.com/strawberry-graphql/strawberry-sqlalchemy/issues
.. <-- end -->


Expand All @@ -329,6 +358,7 @@ on PyPI_, the following steps can be used to release a new version for
.. _contribution-guide.org: https://www.contribution-guide.org/
.. _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
.. _descriptive commit message: https://chris.beams.io/posts/git-commit
.. _Dev Containers: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
.. _docstrings: https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
.. _first-contributions tutorial: https://github.com/firstcontributions/first-contributions
.. _flake8: https://flake8.pycqa.org/en/stable/
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ If you have a suggestion that would make this better, please fork the repo and c
4. Push to the Branch (git push origin feature)
5. Open a Pull Request

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)


### Prerequisites

Expand Down
Loading