Skip to content

Commit e33fbb2

Browse files
committed
chore: Create package with entrypoint
- Refactor structure to avoid circular imports - Get package verion from metadata - Create empty pg_anon.py script to keep back compatibility - Remove all wildcard imports
1 parent 5a63ba1 commit e33fbb2

23 files changed

+867
-646
lines changed

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
### Installation ###
55

6-
```bash
6+
```commandline
77
git clone https://github.com/TantorLabs/pg_anon.git
88
cd pg_anon
99
@@ -12,7 +12,7 @@ pip3 install -r requirements.txt
1212
```
1313

1414
You must have a local database installed to test the functionality of `pg_anon`. Example of installing PostgreSQL on ubuntu:
15-
```bash
15+
```commandline
1616
echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt focal-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
1717
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
1818
apt update && apt --yes remove postgresql\*
@@ -47,7 +47,7 @@ python3 test/full_test.py -v PGAnonValidateUnitTest
4747
```
4848

4949
You can override test database connection settings as follows:
50-
```bash
50+
```commandline
5151
set TEST_DB_USER=anon_test_user
5252
set TEST_DB_USER_PASSWORD=mYy5RexGsZ
5353
set TEST_DB_HOST=127.0.0.1
@@ -61,13 +61,13 @@ set TEST_TARGET_DB=test_target_db
6161

6262
If tests raised error like:
6363

64-
```bash
64+
```commandline
6565
asyncpg.exceptions.ExternalRoutineError: program "gzip > ... *.dat.gz" failed
6666
```
6767

6868
in this case needs to configure permissions:
6969

70-
```bash
70+
```commandline
7171
usermod -a -G current_user_name postgres
7272
chmod -R g+rw /home/current_user_name/Desktop/pg_anon
7373
chmod g+x /home/current_user_name/Desktop/pg_anon/output/test
@@ -99,7 +99,7 @@ Input: source database, empty target database, dictionary
9999

100100
Task: copy full structure of DB and all data using dictionary
101101

102-
```bash
102+
```commandline
103103
# Common options in any mode:
104104
# --debug (default false)
105105
# --verbose = [info, debug, error] (default info)
@@ -266,26 +266,32 @@ dependency management tool for managing dependencies and creating packages.
266266
For [adding new dependencies](https://python-poetry.org/docs/managing-dependencies/)
267267
install Poetry and run command:
268268

269-
```bash
269+
```commandline
270270
poetry add <package_name>
271271
```
272272
For locking the dependencies use command:
273273

274-
```bash
274+
```commandline
275275
poetry lock --no-update
276276
```
277277

278278
Additionally, [export](https://python-poetry.org/docs/cli/#export)
279279
the latest packages to *requirements.txt* using poetry export plugin:
280280

281-
```bash
281+
```commandline
282282
poetry export -f requirements.txt --output requirements.txt
283283
```
284284

285285
### Build package
286286

287287
For [building](https://python-poetry.org/docs/libraries/#packaging) the package use command:
288288

289-
```bash
289+
```commandline
290290
poetry build
291291
```
292+
293+
Additionally package could be build package using setuptools:
294+
295+
```commandline
296+
python3 setup.py sdist
297+
```
File renamed without changes.

0 commit comments

Comments
 (0)