data-manipulation 0.49__tar.gz → 0.53__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data_manipulation-0.53/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- data_manipulation-0.53/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data_manipulation-0.53/.gitignore +100 -0
- data_manipulation-0.53/CHANGELOG.md +81 -0
- data_manipulation-0.53/CODE_OF_CONDUCT.md +76 -0
- data_manipulation-0.53/CONTRIBUTING.md +19 -0
- data_manipulation-0.53/Makefile +144 -0
- data_manipulation-0.53/PKG-INFO +89 -0
- {data_manipulation-0.49 → data_manipulation-0.53}/README.md +6 -1
- data_manipulation-0.53/RELEASE.md +84 -0
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/__init__.py +8 -4
- data_manipulation-0.53/data_manipulation/_version.py +24 -0
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/base.py +33 -45
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/beautifulsoup_.py +8 -8
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/boto3_.py +5 -1
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/cryptography_.py +11 -2
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/django_.py +7 -3
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/geopandas_.py +11 -5
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/kerberos_.py +5 -1
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/mysql_connector_python_.py +5 -1
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/pandas_.py +80 -67
- data_manipulation-0.53/data_manipulation/polars_.py +87 -0
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/postgres_.py +14 -2
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/pyspark_.py +44 -30
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/smtplib_.py +5 -1
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/sqlalchemy_.py +18 -8
- data_manipulation-0.53/data_manipulation.egg-info/PKG-INFO +89 -0
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation.egg-info/SOURCES.txt +26 -7
- data_manipulation-0.53/docs/api.md +59 -0
- data_manipulation-0.53/docs/changelog.md +81 -0
- data_manipulation-0.53/docs/commands.md +10 -0
- data_manipulation-0.53/docs/getting-started.md +5 -0
- data_manipulation-0.53/docs/hooks.py +10 -0
- data_manipulation-0.53/docs/index.md +13 -0
- data_manipulation-0.53/mkdocs.yml +25 -0
- data_manipulation-0.53/notebooks/.gitkeep +0 -0
- data_manipulation-0.53/pyproject.toml +55 -0
- data_manipulation-0.53/references/.gitkeep +0 -0
- data_manipulation-0.53/reports/.gitkeep +0 -0
- data_manipulation-0.53/reports/figures/.gitkeep +0 -0
- data_manipulation-0.53/setup.cfg +4 -0
- data_manipulation-0.53/setup.sh +37 -0
- data_manipulation-0.53/test_environment.py +26 -0
- data_manipulation-0.53/tox.ini +3 -0
- data_manipulation-0.49/MANIFEST.in +0 -2
- data_manipulation-0.49/PKG-INFO +0 -40
- data_manipulation-0.49/data_manipulation/_version.py +0 -21
- data_manipulation-0.49/data_manipulation/flask_.py +0 -31
- data_manipulation-0.49/data_manipulation.egg-info/PKG-INFO +0 -40
- data_manipulation-0.49/setup.cfg +0 -12
- data_manipulation-0.49/setup.py +0 -58
- data_manipulation-0.49/versioneer.py +0 -2189
- {data_manipulation-0.49 → data_manipulation-0.53}/LICENSE +0 -0
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation/openldap_.py +0 -0
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation.egg-info/dependency_links.txt +0 -0
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation.egg-info/requires.txt +0 -0
- {data_manipulation-0.49 → data_manipulation-0.53}/data_manipulation.egg-info/top_level.txt +0 -0
- /data_manipulation-0.49/data_manipulation/prometheus_.py → /data_manipulation-0.53/models/.gitkeep +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
|
|
5
|
+
# C extensions
|
|
6
|
+
*.so
|
|
7
|
+
|
|
8
|
+
# Distribution / packaging
|
|
9
|
+
.Python
|
|
10
|
+
env/
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
*.egg-info/
|
|
23
|
+
data_manipulation/_version.py
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
# Usually these files are written by a python script from a template
|
|
29
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*.cover
|
|
46
|
+
|
|
47
|
+
# Translations
|
|
48
|
+
*.mo
|
|
49
|
+
*.pot
|
|
50
|
+
|
|
51
|
+
# Django stuff:
|
|
52
|
+
*.log
|
|
53
|
+
|
|
54
|
+
# MkDocs documentation
|
|
55
|
+
/site/
|
|
56
|
+
|
|
57
|
+
# PyBuilder
|
|
58
|
+
target/
|
|
59
|
+
|
|
60
|
+
# DotEnv configuration
|
|
61
|
+
.env
|
|
62
|
+
.pypirc
|
|
63
|
+
|
|
64
|
+
# Database
|
|
65
|
+
*.db
|
|
66
|
+
*.rdb
|
|
67
|
+
|
|
68
|
+
# Pycharm
|
|
69
|
+
.idea
|
|
70
|
+
|
|
71
|
+
# VS Code
|
|
72
|
+
.vscode/
|
|
73
|
+
|
|
74
|
+
# Spyder
|
|
75
|
+
.spyproject/
|
|
76
|
+
|
|
77
|
+
# Jupyter NB Checkpoints
|
|
78
|
+
.ipynb_checkpoints/
|
|
79
|
+
|
|
80
|
+
# exclude data from source control by default
|
|
81
|
+
/data/
|
|
82
|
+
*.csv
|
|
83
|
+
*.xlsx
|
|
84
|
+
|
|
85
|
+
# Mac OS-specific storage files
|
|
86
|
+
.DS_Store
|
|
87
|
+
|
|
88
|
+
# vim
|
|
89
|
+
*.swp
|
|
90
|
+
*.swo
|
|
91
|
+
|
|
92
|
+
# Mypy cache
|
|
93
|
+
.mypy_cache/
|
|
94
|
+
|
|
95
|
+
# custom
|
|
96
|
+
.opencode
|
|
97
|
+
.specstory
|
|
98
|
+
build.sh
|
|
99
|
+
docs/README*
|
|
100
|
+
install_packages.sh
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
### Removed
|
|
6
|
+
|
|
7
|
+
- **`pandas_.clean_none()`** — function has been removed.
|
|
8
|
+
Migrate to pandas built-ins:
|
|
9
|
+
```python
|
|
10
|
+
df = df.replace(r"^\s*$", np.nan, regex=True)
|
|
11
|
+
df = df.where(pd.notnull(df), None)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- **`pandas_.config_pandas_display()`** — function has been removed.
|
|
15
|
+
Set display options directly:
|
|
16
|
+
```python
|
|
17
|
+
pd.set_option("display.max_columns", 500)
|
|
18
|
+
pd.set_option("display.max_colwidth", 500)
|
|
19
|
+
pd.set_option("display.expand_frame_repr", True)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- **`prometheus_` module** — was an empty placeholder; removed from
|
|
23
|
+
the public API and from `__init__` imports.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- **`base.get_none_variation()`** — now returns a `frozenset` of 7
|
|
28
|
+
lowercase canonical strings instead of a 72-item list of case
|
|
29
|
+
permutations. Use `.casefold()` for membership checks:
|
|
30
|
+
```python
|
|
31
|
+
# before
|
|
32
|
+
if value in get_none_variation():
|
|
33
|
+
...
|
|
34
|
+
# after
|
|
35
|
+
if isinstance(value, str) and value.casefold() in get_none_variation():
|
|
36
|
+
...
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **`pyspark_.group_count()`** — the `percent` column is now computed
|
|
40
|
+
as a native Spark column expression instead of a Python UDF.
|
|
41
|
+
Behaviour is identical; performance improves on large datasets.
|
|
42
|
+
|
|
43
|
+
- **`pyspark_.column_into_list()`** — raises `ValueError` (with the
|
|
44
|
+
list of available columns) when the requested column does not exist.
|
|
45
|
+
Previously returned `None` silently.
|
|
46
|
+
|
|
47
|
+
- **`pandas_.print_dataframe_overview()`** — now returns a
|
|
48
|
+
`Dict[str, Dict[str, Any]]` of per-column stats (`unique`,
|
|
49
|
+
`null_count`, `value_counts`). Still prints to stdout as before;
|
|
50
|
+
existing call sites are unaffected.
|
|
51
|
+
|
|
52
|
+
- **`pandas_.compare_dataframes()`** — now returns a comparison
|
|
53
|
+
summary dict (`same_length`, `df1_length`, `df2_length`, `columns`).
|
|
54
|
+
Still prints to stdout as before; existing call sites are unaffected.
|
|
55
|
+
|
|
56
|
+
- **`pyspark_` module** — all `print()` calls replaced with
|
|
57
|
+
`logger.info()` / `logger.debug()`. Output is now routed through
|
|
58
|
+
the standard logging pipeline and can be silenced or redirected.
|
|
59
|
+
|
|
60
|
+
- **`sqlalchemy_.create_sqlalchemy_engine()`** — duplicate
|
|
61
|
+
`if/elif` timeout branches (both setting the same value) consolidated
|
|
62
|
+
into a single condition.
|
|
63
|
+
|
|
64
|
+
- **`django_.django_validate_phone()`** — now has an explicit
|
|
65
|
+
`return None` on failure instead of a bare `return`.
|
|
66
|
+
|
|
67
|
+
### Fixed (previous pass — reference)
|
|
68
|
+
|
|
69
|
+
- `pyspark_.columns_statistics()` — always-true condition in empty-column
|
|
70
|
+
detection (third clause was truthy for any non-empty string).
|
|
71
|
+
- `pandas_.dtypes_dictionary()` — `.iteritems()` removed in pandas 2.0;
|
|
72
|
+
replaced with `.items()`.
|
|
73
|
+
- Bare `except:` replaced with `except Exception:` in `pandas_` and
|
|
74
|
+
`django_`.
|
|
75
|
+
- `base.string_boolean_to_int()` — removed (used `distutils`, dropped
|
|
76
|
+
in Python 3.12).
|
|
77
|
+
- `flask_.py` — deleted (was entirely commented-out dead code).
|
|
78
|
+
- `beautifulsoup_.preprocess()` — fixed mixed tabs/spaces and invalid
|
|
79
|
+
`\s` escape sequences.
|
|
80
|
+
- All modules now guard third-party imports with `try/except`; the
|
|
81
|
+
package imports cleanly even when optional dependencies are missing.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at Shawn.coding.acc@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
72
|
+
|
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
|
74
|
+
|
|
75
|
+
For answers to common questions about this code of conduct, see
|
|
76
|
+
https://www.contributor-covenant.org/faq
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Contributing to data manipulation
|
|
2
|
+
|
|
3
|
+
Whether you are a novice or experienced software developer, all contributions and suggestions are welcome!
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
If you are looking to contribute to the *data manipulation* codebase, the best place to start is the [GitHub "issues" tab](https://github.com/shawnngtq/data-manipulation/issues). This is also a great place for filing bug reports and making suggestions for ways in which we can improve the code and documentation.
|
|
8
|
+
|
|
9
|
+
## Filing Issues
|
|
10
|
+
|
|
11
|
+
If you notice a bug in the code or documentation, or have suggestions for how we can improve either, feel free to create an issue on the [GitHub "issues" tab](https://github.com/shawnngtq/data-manipulation/issues) using [GitHub's "issue" form](https://github.com/shawnngtq/data-manipulation/issues/new). The form contains some questions that will help us best address your issue.
|
|
12
|
+
|
|
13
|
+
## Contributing to the Codebase
|
|
14
|
+
|
|
15
|
+
The code is hosted on [GitHub](https://github.com/shawnngtq/data-manipulation), so you will need to use [Git](https://git-scm.com/) to clone the project and make changes to the codebase. Once you have obtained a copy of the code, you should create a development environment that is separate from your existing Python environment so that you can make and test changes without compromising your own work environment.
|
|
16
|
+
|
|
17
|
+
Before submitting your changes for review, make sure to check that your changes do not break any tests.
|
|
18
|
+
|
|
19
|
+
Once your changes are ready to be submitted, make sure to push your changes to GitHub before creating a pull request. We will review your changes, and you will most likely be asked to make additional changes before it is finally ready to merge. However, once it's ready, we will merge it, and you will have successfully contributed to the codebase!
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
.PHONY: clean data lint requirements sync_data_to_s3 sync_data_from_s3
|
|
2
|
+
|
|
3
|
+
#################################################################################
|
|
4
|
+
# GLOBALS #
|
|
5
|
+
#################################################################################
|
|
6
|
+
|
|
7
|
+
PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
8
|
+
BUCKET = [OPTIONAL] your-bucket-for-syncing-data (do not include 's3://')
|
|
9
|
+
PROFILE = default
|
|
10
|
+
PROJECT_NAME = data_manipulation
|
|
11
|
+
PYTHON_INTERPRETER = python3
|
|
12
|
+
|
|
13
|
+
ifeq (,$(shell which conda))
|
|
14
|
+
HAS_CONDA=False
|
|
15
|
+
else
|
|
16
|
+
HAS_CONDA=True
|
|
17
|
+
endif
|
|
18
|
+
|
|
19
|
+
#################################################################################
|
|
20
|
+
# COMMANDS #
|
|
21
|
+
#################################################################################
|
|
22
|
+
|
|
23
|
+
## Install Python Dependencies
|
|
24
|
+
requirements: test_environment
|
|
25
|
+
$(PYTHON_INTERPRETER) -m pip install -U pip setuptools wheel
|
|
26
|
+
$(PYTHON_INTERPRETER) -m pip install -r requirements.txt
|
|
27
|
+
|
|
28
|
+
## Make Dataset
|
|
29
|
+
data: requirements
|
|
30
|
+
$(PYTHON_INTERPRETER) data_manipulation/data/make_dataset.py data/raw data/processed
|
|
31
|
+
|
|
32
|
+
## Delete all compiled Python files
|
|
33
|
+
clean:
|
|
34
|
+
find . -type f -name "*.py[co]" -delete
|
|
35
|
+
find . -type d -name "__pycache__" -delete
|
|
36
|
+
|
|
37
|
+
## Lint using flake8
|
|
38
|
+
lint:
|
|
39
|
+
flake8 data_manipulation
|
|
40
|
+
|
|
41
|
+
## Upload Data to S3
|
|
42
|
+
sync_data_to_s3:
|
|
43
|
+
ifeq (default,$(PROFILE))
|
|
44
|
+
aws s3 sync data/ s3://$(BUCKET)/data/
|
|
45
|
+
else
|
|
46
|
+
aws s3 sync data/ s3://$(BUCKET)/data/ --profile $(PROFILE)
|
|
47
|
+
endif
|
|
48
|
+
|
|
49
|
+
## Download Data from S3
|
|
50
|
+
sync_data_from_s3:
|
|
51
|
+
ifeq (default,$(PROFILE))
|
|
52
|
+
aws s3 sync s3://$(BUCKET)/data/ data/
|
|
53
|
+
else
|
|
54
|
+
aws s3 sync s3://$(BUCKET)/data/ data/ --profile $(PROFILE)
|
|
55
|
+
endif
|
|
56
|
+
|
|
57
|
+
## Set up python interpreter environment
|
|
58
|
+
create_environment:
|
|
59
|
+
ifeq (True,$(HAS_CONDA))
|
|
60
|
+
@echo ">>> Detected conda, creating conda environment."
|
|
61
|
+
ifeq (3,$(findstring 3,$(PYTHON_INTERPRETER)))
|
|
62
|
+
conda create --name $(PROJECT_NAME) python=3
|
|
63
|
+
else
|
|
64
|
+
conda create --name $(PROJECT_NAME) python=2.7
|
|
65
|
+
endif
|
|
66
|
+
@echo ">>> New conda env created. Activate with:\nsource activate $(PROJECT_NAME)"
|
|
67
|
+
else
|
|
68
|
+
$(PYTHON_INTERPRETER) -m pip install -q virtualenv virtualenvwrapper
|
|
69
|
+
@echo ">>> Installing virtualenvwrapper if not already installed.\nMake sure the following lines are in shell startup file\n\
|
|
70
|
+
export WORKON_HOME=$$HOME/.virtualenvs\nexport PROJECT_HOME=$$HOME/Devel\nsource /usr/local/bin/virtualenvwrapper.sh\n"
|
|
71
|
+
@bash -c "source `which virtualenvwrapper.sh`;mkvirtualenv $(PROJECT_NAME) --python=$(PYTHON_INTERPRETER)"
|
|
72
|
+
@echo ">>> New virtualenv created. Activate with:\nworkon $(PROJECT_NAME)"
|
|
73
|
+
endif
|
|
74
|
+
|
|
75
|
+
## Test python environment is setup correctly
|
|
76
|
+
test_environment:
|
|
77
|
+
$(PYTHON_INTERPRETER) test_environment.py
|
|
78
|
+
|
|
79
|
+
#################################################################################
|
|
80
|
+
# PROJECT RULES #
|
|
81
|
+
#################################################################################
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
#################################################################################
|
|
86
|
+
# Self Documenting Commands #
|
|
87
|
+
#################################################################################
|
|
88
|
+
|
|
89
|
+
.DEFAULT_GOAL := help
|
|
90
|
+
|
|
91
|
+
# Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
|
|
92
|
+
# sed script explained:
|
|
93
|
+
# /^##/:
|
|
94
|
+
# * save line in hold space
|
|
95
|
+
# * purge line
|
|
96
|
+
# * Loop:
|
|
97
|
+
# * append newline + line to hold space
|
|
98
|
+
# * go to next line
|
|
99
|
+
# * if line starts with doc comment, strip comment character off and loop
|
|
100
|
+
# * remove target prerequisites
|
|
101
|
+
# * append hold space (+ newline) to line
|
|
102
|
+
# * replace newline plus comments by `---`
|
|
103
|
+
# * print line
|
|
104
|
+
# Separate expressions are necessary because labels cannot be delimited by
|
|
105
|
+
# semicolon; see <http://stackoverflow.com/a/11799865/1968>
|
|
106
|
+
.PHONY: help
|
|
107
|
+
help:
|
|
108
|
+
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
|
|
109
|
+
@echo
|
|
110
|
+
@sed -n -e "/^## / { \
|
|
111
|
+
h; \
|
|
112
|
+
s/.*//; \
|
|
113
|
+
:doc" \
|
|
114
|
+
-e "H; \
|
|
115
|
+
n; \
|
|
116
|
+
s/^## //; \
|
|
117
|
+
t doc" \
|
|
118
|
+
-e "s/:.*//; \
|
|
119
|
+
G; \
|
|
120
|
+
s/\\n## /---/; \
|
|
121
|
+
s/\\n/ /g; \
|
|
122
|
+
p; \
|
|
123
|
+
}" ${MAKEFILE_LIST} \
|
|
124
|
+
| LC_ALL='C' sort --ignore-case \
|
|
125
|
+
| awk -F '---' \
|
|
126
|
+
-v ncol=$$(tput cols) \
|
|
127
|
+
-v indent=19 \
|
|
128
|
+
-v col_on="$$(tput setaf 6)" \
|
|
129
|
+
-v col_off="$$(tput sgr0)" \
|
|
130
|
+
'{ \
|
|
131
|
+
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
|
|
132
|
+
n = split($$2, words, " "); \
|
|
133
|
+
line_length = ncol - indent; \
|
|
134
|
+
for (i = 1; i <= n; i++) { \
|
|
135
|
+
line_length -= length(words[i]) + 1; \
|
|
136
|
+
if (line_length <= 0) { \
|
|
137
|
+
line_length = ncol - indent - length(words[i]) - 1; \
|
|
138
|
+
printf "\n%*s ", -indent, " "; \
|
|
139
|
+
} \
|
|
140
|
+
printf "%s ", words[i]; \
|
|
141
|
+
} \
|
|
142
|
+
printf "\n"; \
|
|
143
|
+
}' \
|
|
144
|
+
| more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: data_manipulation
|
|
3
|
+
Version: 0.53
|
|
4
|
+
Summary: Powerful data manipulation
|
|
5
|
+
Author-email: Shawn Ng <shawn.coding.acc@gmail.com>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/shawnngtq/data-manipulation
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Cython
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: beautifulsoup4
|
|
23
|
+
Requires-Dist: boto3
|
|
24
|
+
Requires-Dist: cryptography
|
|
25
|
+
Requires-Dist: django
|
|
26
|
+
Requires-Dist: flask
|
|
27
|
+
Requires-Dist: geopandas
|
|
28
|
+
Requires-Dist: ipython
|
|
29
|
+
Requires-Dist: loguru
|
|
30
|
+
Requires-Dist: mysql-connector-python
|
|
31
|
+
Requires-Dist: numpy
|
|
32
|
+
Requires-Dist: pandas
|
|
33
|
+
Requires-Dist: psycopg
|
|
34
|
+
Requires-Dist: pyspark
|
|
35
|
+
Requires-Dist: python-dotenv
|
|
36
|
+
Requires-Dist: sqlalchemy
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# Data Manipulation
|
|
40
|
+
|
|
41
|
+
- [Data Manipulation](#data-manipulation)
|
|
42
|
+
- [What is it?](#what-is-it)
|
|
43
|
+
- [Where to get it](#where-to-get-it)
|
|
44
|
+
- [Dependencies](#dependencies)
|
|
45
|
+
- [License](#license)
|
|
46
|
+
- [Maintainer Release](#maintainer-release)
|
|
47
|
+
- [Getting Help](#getting-help)
|
|
48
|
+
- [Discussion and Development](#discussion-and-development)
|
|
49
|
+
- [Contributing to data manipulation](#contributing-to-data-manipulation)
|
|
50
|
+
|
|
51
|
+
My data manipulation library includes functions build on top of popular Python libraries such as Pandas, PySpark and more.
|
|
52
|
+
|
|
53
|
+
## What is it?
|
|
54
|
+
|
|
55
|
+
Data Manipulation is a Python package providing powerful utility functions. It contains many subpackages with utility functions built for popular packages such as Pandas, PySpark and many more.
|
|
56
|
+
|
|
57
|
+
## Where to get it
|
|
58
|
+
|
|
59
|
+
The source code is currently hosted on GitHub at: https://github.com/shawnngtq/data-manipulation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install data-manipulation
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Dependencies
|
|
66
|
+
|
|
67
|
+
The dependencies will be installed automatically along with this package, using metadata in `pyproject.toml`.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
[BSD 3](LICENSE)
|
|
72
|
+
|
|
73
|
+
## Maintainer Release
|
|
74
|
+
|
|
75
|
+
Release and deployment steps are documented in [RELEASE.md](RELEASE.md).
|
|
76
|
+
|
|
77
|
+
## Getting Help
|
|
78
|
+
|
|
79
|
+
For usage questions, the best place to go to is StackOverflow.
|
|
80
|
+
|
|
81
|
+
## Discussion and Development
|
|
82
|
+
|
|
83
|
+
Most development discussion is taking place on github in this repo.
|
|
84
|
+
|
|
85
|
+
## Contributing to data manipulation
|
|
86
|
+
|
|
87
|
+
All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome.
|
|
88
|
+
|
|
89
|
+
As contributors and maintainers to this project, you are expected to abide by our code of conduct. More information can be found at: [Contributor Code of Conduct](https://github.com/shawnngtq/data-manipulation/blob/master/CODE_OF_CONDUCT.md)
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
- [Where to get it](#where-to-get-it)
|
|
6
6
|
- [Dependencies](#dependencies)
|
|
7
7
|
- [License](#license)
|
|
8
|
+
- [Maintainer Release](#maintainer-release)
|
|
8
9
|
- [Getting Help](#getting-help)
|
|
9
10
|
- [Discussion and Development](#discussion-and-development)
|
|
10
11
|
- [Contributing to data manipulation](#contributing-to-data-manipulation)
|
|
@@ -25,12 +26,16 @@ pip install data-manipulation
|
|
|
25
26
|
|
|
26
27
|
## Dependencies
|
|
27
28
|
|
|
28
|
-
The dependencies will be installed automatically along with this package, in `
|
|
29
|
+
The dependencies will be installed automatically along with this package, using metadata in `pyproject.toml`.
|
|
29
30
|
|
|
30
31
|
## License
|
|
31
32
|
|
|
32
33
|
[BSD 3](LICENSE)
|
|
33
34
|
|
|
35
|
+
## Maintainer Release
|
|
36
|
+
|
|
37
|
+
Release and deployment steps are documented in [RELEASE.md](RELEASE.md).
|
|
38
|
+
|
|
34
39
|
## Getting Help
|
|
35
40
|
|
|
36
41
|
For usage questions, the best place to go to is StackOverflow.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Release Guide
|
|
2
|
+
|
|
3
|
+
This guide is for maintainers publishing documentation to GitHub Pages and
|
|
4
|
+
package artifacts to PyPI.
|
|
5
|
+
|
|
6
|
+
## Preconditions
|
|
7
|
+
|
|
8
|
+
- Work from a clean `master` branch.
|
|
9
|
+
- Release versions are derived from git tags by `setuptools-scm`.
|
|
10
|
+
- Never build or upload release artifacts from a dirty worktree.
|
|
11
|
+
- Keep PyPI credentials out of git.
|
|
12
|
+
|
|
13
|
+
Check the release state:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git checkout master
|
|
17
|
+
git pull --ff-only origin master
|
|
18
|
+
git status
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`git status` should report no changes before continuing.
|
|
22
|
+
|
|
23
|
+
## Tag The Release
|
|
24
|
+
|
|
25
|
+
Use the next release version, for example `0.50`:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git tag -a 0.50 -m "Release 0.50"
|
|
29
|
+
git push origin master
|
|
30
|
+
git push origin 0.50
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The tag must point at the exact commit being released.
|
|
34
|
+
|
|
35
|
+
## Publish Documentation
|
|
36
|
+
|
|
37
|
+
Build the MkDocs documentation:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
mkdocs build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Publish the generated HTML to GitHub Pages:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
mkdocs gh-deploy
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This publishes the contents of `site/` to the `gh-pages` branch.
|
|
50
|
+
|
|
51
|
+
## Publish To PyPI
|
|
52
|
+
|
|
53
|
+
Build and validate the distribution artifacts:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
./setup.sh cleanup
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Upload the artifacts:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
./setup.sh upload
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
When prompted by `twine`, enter the PyPI API token. The token should start with
|
|
66
|
+
`pypi-`. It will not be displayed while typing or pasting.
|
|
67
|
+
|
|
68
|
+
## Verify The Release
|
|
69
|
+
|
|
70
|
+
Install the published package in a fresh environment and confirm the version:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python3 -m pip install --upgrade data-manipulation
|
|
74
|
+
python3 -c "import data_manipulation; print(data_manipulation.__version__)"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Security Notes
|
|
78
|
+
|
|
79
|
+
- Do not commit PyPI API tokens, passwords, or `.pypirc` files with credentials.
|
|
80
|
+
- Do not add tokens to shell history as command-line arguments.
|
|
81
|
+
- Prefer entering the PyPI token at the `twine` prompt or using a local secret
|
|
82
|
+
store.
|
|
83
|
+
- If a token is accidentally committed or exposed, revoke it in PyPI immediately
|
|
84
|
+
and create a new one.
|