Skip to content

Commit 1a6f06e

Browse files
committed
Update to reflect recent modernization changes
1 parent b70b69b commit 1a6f06e

1 file changed

Lines changed: 50 additions & 15 deletions

File tree

CONTRIBUTING.rst

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,15 @@ Ready to contribute? Here's how to set up `python_secrets` for local development
7272
$ git clone https://github.com/ztombol/bats-support.git
7373
$ git clone https://github.com/jasonkarns/bats-assert-1.git
7474

75-
#. Install your local copy into a virtualenv. Assuming you have
76-
virtualenvwrapper installed, this is how you set up your fork for
77-
local development::
75+
#. Install your local copy into a conda environment or virtualenv.
76+
Using conda (recommended)::
77+
78+
$ conda create -n python_secrets python=3.10
79+
$ conda activate python_secrets
80+
$ cd python_secrets/
81+
$ make install
82+
83+
Or using virtualenvwrapper::
7884

7985
$ mkvirtualenv python_secrets
8086
$ cd python_secrets/
@@ -87,13 +93,18 @@ Ready to contribute? Here's how to set up `python_secrets` for local development
8793
Now you can make your changes locally.
8894

8995
#. When you're done making changes, check that your changes pass
90-
``flake8`` and ``bandit`` (security) tests, including testing
91-
other Python versions with ``tox``::
96+
linting, security analysis, and all tests including multiple Python
97+
versions with ``tox``::
9298

9399
$ make test
94100

95-
To get ``flake8`` and ``tox``, just ``python -m pip install`` them
96-
into your virtualenv.
101+
For individual testing components::
102+
103+
$ make test-tox # Run Python unit tests across versions
104+
$ make test-bats # Run Bats integration tests
105+
$ tox run -m static # Run static analysis (ruff, bandit, docs)
106+
$ tox -e pep8 # Run ruff linting only
107+
$ tox -e bandit # Run security analysis only
97108

98109
#. Commit your changes and push your branch to GitHub::
99110

@@ -116,21 +127,45 @@ Before you submit a pull request, check that it meets these guidelines:
116127
in ``README.rst``, ``docs/usage.rst``, and ``parser.epilog`` for CLI
117128
commands.
118129

119-
#. The pull request should work for the versions of Python defined in ``tox.ini``
120-
and ``.travis.yml``. Check
121-
https://travis-ci.org/davedittrich/python_secrets/pull_requests
122-
and make sure that the tests pass for all supported Python versions.
130+
#. The pull request should work for Python 3.10, 3.11, and 3.12 as defined
131+
in ``tox.ini``. Run ``make test`` to ensure compatibility across all
132+
supported Python versions.
123133

124134
Tips
125135
----
126136

127-
To run a subset of Python unit tests::
137+
Development and Testing Best Practices
138+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139+
140+
The project uses **pytest** for unit testing with enhanced type safety and modern Python practices.
141+
142+
To run Python unit tests::
143+
144+
$ python -m pytest tests/test_secrets.py -v # Run specific test file
145+
$ python -m pytest tests/ -k "test_name" # Run tests matching pattern
146+
$ python -m pytest tests/ --cov=psec # Run with coverage
147+
148+
To run Bats integration tests::
149+
150+
$ make test-bats # All Bats tests
151+
$ bats tests/runtime_10_groups.bats # Specific test file
152+
153+
Code Quality Standards
154+
~~~~~~~~~~~~~~~~~~~~~~
128155

129-
$ python -m unittest tests.test_secrets
156+
* **Type Hints**: All new code should include proper type annotations using modern Python typing
157+
* **pytest**: New tests should be written using pytest framework, not unittest
158+
* **Ruff**: Code formatting and linting is handled by Ruff (replaces flake8/black)
159+
* **Bandit**: Security analysis is mandatory for all changes
160+
* **Dataclasses**: Prefer dataclasses over traditional classes where appropriate
130161

131-
To run a subset of Bats tests::
162+
Modern Development Workflow
163+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
132164

133-
$ bats tests/secrets.bats
165+
1. Use ``conda activate psec`` to activate the development environment
166+
2. Run ``make test`` to execute the full test suite
167+
3. Use ``tox run -m static`` for quick linting and security checks
168+
4. Follow the existing code patterns for consistency
134169

135170

136171
.. [1] https://github.com/davedittrich/python_secrets/issues

0 commit comments

Comments
 (0)